Wednesday, October 6, 2010

for later

http://www.wolframalpha.com/input/?i=Fit[+{+%280.1%2C+-0.62049958%29%2C+%28-0.28398668%29%2C+%280.3%2C+0.00660095%29%2C+%280.4%2C+0.24842440%29%2C+%280.5%2C+0.18380945%29+}%2C+{1%2C+x%2C+x^2%2C+x^3%2C+x^4}%2C+x]

2 things

#1 - I am going to attempt this week to try to present the work through a video that I will post through youtube, if it works, it may allow me to explain things better than I think I have (though I will still pretty much be doing out all of the work...)

#2 - The Meriden school system doesn't have school on Friday, if they are not the only one's would anyone like to join me on skype to workout the homework? (I have already completed 1a and 1b and will hopefully be posting it through #1.


please, if you can, comment on this post with your skype name so I an others in the class can have it

Tuesday, October 5, 2010

Gonna try Skyping for homework help

add me on Skype: phillip.mangiaracina

we're going to try for a night or two to chat together. I can share my screen and we can share ideas on how to complete the homework.

Using Wolfram Alpha to get your answers! (HMWK4)

Sorry for the late working, I have been busy (I think... I don't know where the time went)

anyway, I did some searching for a way in which to use WolframAlpha to find the end results. The form is:

Fit[{ (x1, f(x1)), (x2, f(x2)),... (xn, f(xn))}, {1,x, x^2, x^3... x^j}, x] (j is the maximum degree polynomial.

the result for #1 is
THIS

which spits back

0.0208333 x^3-0.2 x^2+0.864167 x+0.005

this can be entered into excel with the x's replaced with the x-values and you will return the exact answer you are looking for, then you can place the xi's (the unknown x's) and you will see what you should expect to get spit back out.

the values look to be a bit off, but within reason...

hope this helps

again, sorry for it taking me so long to get on it

Monday, September 27, 2010

for class...

I am going to try to create a full cheat-sheet for the test on Wednesday. I don't feel like there is a lot to have, most of the trouble with the homework was figuring out what was being asked...

Tuesday, September 21, 2010

H3 #3 c

ci. the estimate for a fixed point {pn} with an initial approximation p0 is |pn-p| =< k^n / 1-k * |p1-p0| where k is the constant above (strictly less than 1)

I don't understand the question exactly since he doesn't give a value for k, but says it is "strictly less than 1"
also it seems as though his given equation is off, it looks as if the left side of the inequality is implying the distance from pn to the actual number p, however Wikipedia gives the full equation:



ii. Given that an approximate value of the fixed point of g is 1.94712296, use the values for pn obtained in Excel for the fixed point iteration of g to find |pn-p|

this is the same issue as 2bii in that he doesn't specify a maximum number of iterations, if you go down far enough, the |pn-p| will always be essentially zero...
in one case, using p0=1 to the 20th iteration: (1.94712296 - 1.94712296) = 0
it might be better to not go so far: the 15th iteration: (1.94712261- 1.94712296) = 0.0000004


3ciii. How does this error compare to 10^-5


0.0000004 < 0.00001

H3 #3 a & b

Show that the function g(x) = (3x^2+3)^(1/4) maps the interval [1,2] into [1,2]. In other words, the range of g(x) for 1 =< x =< 2 is contained in [1,2].

Here it seems that we are dealing with simply mapping the two endpoints into the equation:





p0 p1
1 2
(3*(p0)^2+3)^(1/4) (3*(p1)^2+3)^(1/4)



b. Using the fact that 1 =< x =< 2 show that |g'(x)| =< k for x E [1,2], where k is a constant strictly less than one.



---I don't know exactly but I am playing with the idea that since x is within [1,2] and g(x) seems to map [1,2] to approx [1.56, 1.97] it just makes sense that the derivative will never pass 1...

Monday, September 20, 2010

H2 #4

Use Newton's and the Secant Method to find the 6th root of 2 correct to six decimal digits.
we are looking for 1.12246204830937298

the first part is relatively easy (thanks go to liz for this one)

EDIT 9.15: added f(x) and f'(x) and fixed in sheet; 6x is actually 6x^5.


6root2 = x
2 = x^6
0 = x^6 - 2

f(x) = x^6 - 2
f'(x) = 6x^5





p0
1
=A2-(A2^6-2)/(6*A2^5)

and drag down

the Secant Method takes a few more steps (if you use several rows).



The work is as follows:

addition 9.21: I was in a hurry so I didn't put any real explanation into the answer so it probably doesn't make too much sense. Hopefully this will clarify

I chose initial values; 2 as my p0, 1 as my p1 (or vice-versa). The equation is repeated 3 times due to the numbers being in 3 columns:

f(x) = (x^6 - 2)

= 2 - f(1)*(1-2) / f(1)-f(2)
= 2 - (1^6 - 2) * (1 - 2) / ( (1^6 - 2) * ( 2^6 - 2))
= 1.01587302

and then repeat...

The results are:







p0 p1 pn
1 2 =(A2 - (A2^6-2) * (A2-B2) / ((A2^6-2) - (B2^6-2)))
=(C2-(C2^6-2)*(C2-A2)/((C2^6-2)-(A2^6-2)))
=(C3-(C3^6-2)*(C3-C2)/((C3^6-2)-(C2^6-2)))


then drag from there.

NOTE: This is a more complicated method (but it's how I first did it). It is much easier to make one row, preset the 2 initial values, and then make the third value equation refer back to them that way, it skips having to re-enter the equation manually.

also worth noting: around the 10th iteration you may get the error div/0, this is normal.

Saturday, September 18, 2010

H2 #1 b

I got stranded on this problem last week and I still can't figure it out:

I understand how to use the bisection method to find a root, we know we are looking for where y=0, but how do we do this for an unknown value? I understand that I am going to have to eventually subtract the f(eq1) from f(eq2) but unless I know how they both work, I don't know how to move the midpoint... if that even makes sense

OKAY, NEVER MIND, GOT IT

I know the problem was already due, but it stumped the crap out of me and I know some other people had trouble as well so hopefully this can help them:


1b. Determine the intersection of the equations x^3-2x+1 and y=x^2 correct to 6 decimal places.


Step 1: populate the list with a0, bo, c0, f1(a0), f1(b0), f1(c0), f2(a0, f2(b0), f2(c0)

Step 2: What you need to do here is compare the signs again: the difference here between #1 is that you are comparing the sign of 'the distance of the 2 functions of c' to 'the distance of the 2 functions of a and b'. Beyond that it is the same process.

H3 #3

3. In Assignment 2, we found a solution to x^4-3x^2-3=0 in [1,2] based on a fixed-point iteration method by finding a fixed point for the function g(x) = (3x^2 + 3) ^ 1/4 starting with p0=1. We found that the fixed iteration converges to the solution fairly quickly. In this problem, show the following:

a. Show the the function g maps the interval [1,2] into [1,2]...

H3 #2 b

(I am trying to put a lot of equations and concepts into my own words, I am not sure if it will help anyone else understand it but it helps me to re-translate into a language I can understand.)

i.
If the sequence {pn} approximates a solution p of (1), then
|pn - p| =< b-a / 2^n
where a and be are endpoints of the interval

use the estimate to find the number of iterations N required so that the solution to (a) using the bisection method is correct to the actual solution to within 10^-5

this refers to the Analysis (Wikipedia) of the bisection method.

In simpler terms, the distance from our approximation (pn) to the actual answer (p) must be equal to or less than the distance between the two endpoints divided by the number of times we have halved the interval
(ex. if our initial interval is [0,1] by the 10th iteration, our estimated value MUST be within (1/2^10) or 0.0009765 of the exact answer)

so the question is asking what is the smallest value N with which 0.5-0 /2^n =< 10^-5

to find the answer through excel I made
A1 = 0.5
and then made the progressive rule for A2
=A1/2
and then made all of the B column equal to 10^-5
(notice however that the value of row 1 is equal to n=0, so row An is actually the value of our n-1 iteration)
after dragging the excel worksheet down:











1 0.500000 0.000010
2 0.250000 0.000010
3 0.125000 0.000010
.. .... ...
15 0.000031 0.000010
16 0.000015 0.000010
17 0.000008 0.000010
18 0.000004 0.000010
19 0.000002 0.000010
20 0.000001 0.000010


at row 17 column A becomes less than column B: therefore our answer is N=16
_____________________________________________

ii.
Given that an approximate value of the root is p=0.36623819, use the values for pn that you obtained in excel for part(a) to find |pn-p|


I am not entirely sure exactly what is being asked; does he want us to use the 16th iteration we arrived at for i or can/should we be more precise?

in that case we end up with |0.36622826 - 0.36623819| = 0.00000993
_____________________

iii. How does that compare to 10^-5


0.00000993 < 0.00001

H3 #2 a

Use the Bisection Method to find a solution of 9x^4+18x^3+38x^2-55x+14=0
our answer is x=0.366238

Step 1: populate the spreadsheet with our givens:



a0 b0 f(a0) f(b0)
0 0.5 =9*A2^4 +18*A2^3 +38*A2^2 -55*A2 +14 =9*B2^4 +18*B2^3 +38*B2^2 -55*B2 +14


Step 2: use the bisection method to find c0 (the midpoint of a0 and b0) and f(c0)




c0 f(c0)
=(A2+B2)/2 =9*E2^4+18*E2^3+38*E2^2-55*E2+14


Step 3: From here you check to see if the sign of f(a0) matches f(c0), if it does, change a0 to c0. Do the same checking f(b0) against f(c0)


=IF(SIGN(C2)=SIGN(F2); E2;A2) =IF(SIGN(D2)=SIGN(F2); E2;B2)


if all is done correctly, you should be able to drag the columns down an by the 20th iteration the numbers should match up.

Step-by-step homework 3 problem 1

(please let me know if you like/dislike the way I am presenting this, if there is anything I should add or subtract, and most importantly -- if I am doing something completely incorrectly. I would like this to be a learning experience rather than simply sharing answers, yet I am afraid that this is more of the latter. Please post questions you have or different methods you may have used to find the answers. It's also worth noting that I am using OpenOffice Calc. It is 95% the same as Microsoft excel. One thing that I am noticing is that in the IF statement, it is requiring a semicolon (;) instead of a comma (,). There may be other differences as well)

First of all, I'd like to mention that an important tool that I use is WolframAlpha. It makes it easy to find any solution to a problem so that you at least have an idea what it is that you are aiming for. In the case of this problem I made the input:
e^x-3x^2=0
and received 3 answers
0.910008
-0.458962
3.373308
since we are dealing with the interval [0,1] we are obviously looking to achieve the value 0.910008.

now, when inputting into excel I have:







a0 b0 f(a0) f(b0) c0 f(c0)
0 1 =EXP(A2) - 3*(A2^2) =EXP(B2) - 3*(B2^2) =((D2*A2) - (C2*B2)) / (D2-C2) =EXP(E2)-3*(E2^2)


the value of c0 is the root of the secant line and is expressed by (s: wikipedia):


at this point we have to check signs
=IF(SIGN(C2)=SIGN(F2); E2; A2) for a0 and
=IF(SIGN(D2)=SIGN(F2); E2; B2) for b0

at this point, the cells can simply be extended and the answer should be filled out. By the 8th iteration the answer should match up.

Thursday, September 16, 2010

Welcome

This class has become easily the most challenging class I have yet to encounter. I am having trouble doing the homework and unfortunately , we all have jobs, other classes, and lives that seem to be interfering with doing the homework. Hopefully this blog can be used for all of us to share ideas and tips on how to reach the correct answer and have a generally better understanding of the topic.