{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

p1 - hwl Jeff Snider I 8 Math 446 S Homework Project 1...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Background image of page 2
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Background image of page 4
Background image of page 5
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: hwl Jeff Snider ' ' / I 8- Math 446 ( /{ S, Homework Project 1 Uri/n January 22, 2010 1) The four calculated roots are equal Within 1e—15: 0.471098319125543 to . 0.471098319125544. The backward error is reported to be 0 for each of the calculated roots. I do feel the bisection method has found the correct root, within 5e—15, since the solution is stable no matter what interval we begin with. L/ 2) The four calculated roots are: 0.349067687988281 0.349063491821289 0.349066162109325 0.349069213867187 These diifer at the 6th decimal place. The backward error is exactly 0 for each of them The calculated root is correct to within perhaps 1e—5, since all guesses for the root are within that range / M 3) The first function has a rather steep slope around the root (-34), and the second a very flat one (-Se-9)- In the first case this creates only a very small region Where fl(xc) will be near zero, making calculated root very stable. In the second case a relatively very large region exists where i2(x‘c) is near zero. The limit of precision in calculation in the second case creates a large zone where fibre) will be calculated as zero or will erroniously vaccilate between barely positive and barely negative. As the bisection method approaches the root, it will find one of these erronious roots in the "zero zone" as the root, and the precision of the answer is actually unknown We might test for the edges of the "zero zone" (find the largest and smallest x where fl(x) crosses zero), and come up with a more accurate estimate for the uncertainty, but finding the smallest and largest apparent root where many exist is challenging with only the bisection method at our disposal. We could also test for the edges of the region where ahs(f2(_x)) is within some small value greater than zero, perhaps 1e—14. Alternatively we could alter the function to steepen the slope, perhaps by multiplying by a large factor and distributing it by hand among the function elements before inlining. W However, a first attempt at this does not eliminate the multiple roots found by bisect dependant on the initial interval selected. So, error is accumulating within the function regardless of the slope. One large value subtracted from a nearly equal large value will have more roundoff error than if we carefully maintain values of moderate magnitude. Perhaps we can rearrange the function by distributing the 1-cos4x term and hope to collect terms in a way that reduces the error to an acceptable level...? Examining the values of each element of the function near the root should allow us to insert parenthesis to eliminate over-large terms from accumulating, and hope that MATLAB (or Octave) respects those parenthesis in its internal calculations! octave—3.2.3.exe:34:~\desktop > format long octave-3.2.3.exe:35:~\desktop > . fl=inline('l0*(1—cos(4*x))*(2*cos(2*x)-4*cos(x)"5+6*cos(x)"2+3 *cos(x)*sin(2*x)"2—12*cos(x)*sin(x)A4-4 f1 = fix) I: 10*(1—oos(4*x))*(2fcos(2*x)—4*cos(x)"5+6*cos(x)"2+3*cos(x)*sin(2*x)"2—12*cos(x)*sin(x)"4—4)r132*cos( octave-3.2.3.exe:36:~\deskt0p > . f2=inline('9*(1—cos(4*x))*(2*cos(2*x)—4*cos(x)"5+6*cos(x)"2+3*cos(x)*sin(2*x)"2—12*cos(x)*sin(x)"4-4) 12 = ' ftx) = 9*(l-cos(4*x))*(2*003(2*x)-4*cos(x)"5+6*cos(x)"2+3*cos(x)*sin(2*x)"2—12*cos(x)*sin(x)"4—4)+32*cos(x octave—3.2.3.exe:37:~\desktop ' > xc=bisect(fl ,0,1 ,5e-19) xc = 0.471098319125543 octave—3.2-3.exe:38:~\desktop > f1(xc) ans = 0 octave-3-2.3.exe:39:~\desktop > xc=bisect(fl ,0.1,1,5e-19) xc : 0.471098319125543 octave—3.2.3-exe:40:~\desktop > f1(xc) ans = 0 octave-3.2.3.exe:41 :~\deskt0p > xc=bisect(fl ,0.2,1,Se—19) xc = 0.471098319125544 octave-3-2.3.exe:42:~\desktop > f1(xc) ans = 0 octave-3.2.3.exe:43:~\desktop ' > xc=bisect(fl ,0.3,1 ,56—19) ' xc = 0-471098319125543 octave—3.2.3.exe:44:~\desktop > f1(xc) ans = 0 octaver3.2.3.exe:45:~\desktop _ >_ % all four cases withifi one digit of each other at the 15th place, and all report forward error of exactly 0. octave~3.2.3.exe:46:~\desktop > xc=bisect(f2,0,1,Se—19) xc = 0.34906TGS7988281 octave-3.2.3.exe:47:~\desktop > 12(xc) ans = 0 octave-3.2.3.exe:48:~\desktop > xc=bisect(12,0.1,1,Se-19) xc = 0.349063491821289 octave-3.2.3.exc:49:~\desktop > f2(xc) ans = 0 octave-3.2-3.exe:50:~\desktop > f2(1) ans = -105.852768811508 octave-3 .23 .exc:5 1 :~\desktop > 12(0) ans = 4 octave-3.2.3.exe:52:~\de‘sktop > xc=bisect(fl,0-2,1,Se-l9) xc = 0.349066162109375 octave-3-2.3.exe:53:~\desktop > 12(0) ans = 4 octave-3.2.3-exe:54:~\desk‘top > f2(xc) ans = 0 octave-3.2.3.exe:55:~\desktop > xc=bisect(fl,0.3,l ,56—19) x0 = 0349069213867 187 octave-3.2.3.cxe:56:~\desktop > f2(xc) ans = 0 octave—3.2.3-exe:57:~\dcsktop - > % all four cases report forward error of 0, but differ at the 6th decimal place. octavefi3.2.3.exe:58:~\deskt0p > quit octave-3.2-3.exe:69:~\desktop > f5=inline('9*10"10*(1-cos(4*x))*(2*003(2*x)—4*cos(x)"5+6*cos(x)"2+3*cos(x)*sin(2*x)"2—l2*cos(x)*sin( B = ' 9*10"l0*(1-cos(4*x))*(2*cos(2*x)—4*cos(x)"5+6*cos(x)"‘2+3*cos(x)*sin(2*x)"2—12*cos(x)*sin(x)"4—4)+3I octave-3.2.3.exe:70:~\desktop > bisect(f3,0,1,5t:—19) ans = 0.349063873291016 octave-3.2-3.exe:71 :~\desktop > bisect(t3,0.1,1,Se-19) ans = 0.349066925048828 octave—3.2.3.exe:72:~\desktop > a a = 0.349060000000000 octave—3.2.3.exe:73:~\desktop > b b = 0.471200000000000 octave-3.2.3.exe:74:~\desktop > b=0-34907 b = 0.349070000000000 octave—3.2.3.exe:75:~\desktop > f3(a) ans = 0.00109863281250000 octave-3.2.3.exe:76:~\desktop > 303) ans = -2.'441406250000006-004 octave-3.2.3.exe:77:~\desktop > (BCb)-f3(a))/(b“a) ' ans = —134.277343749866 octave—3.2.3.exe:78:~\desktop > bisect(13,0,l ,5e—19) ans = 0.349063873291016 octave—3.2.3.exe:79:~\desktop > bisect(13,0-1,l,5e-l9) ans = 0.349066925048828 octave-3.2.3.exe:80:~\desktop > bisect(f3,0.2,l,Se-l9) ans = 0.349066162109375 octave-3 .23 .exe:81:~\desktop > bisect(f3,0.3,1,Se—19) ans = 0.349063873291016 octave—3.2.3.exe:82:~\desktop > bisect(f3,0.3,.4,Se-19) ans = 0.349066162109375 ocmve~3.2.3.exe:83:~\desktop > bisect(13,0.3,.349063,5e-19) error: fla)f(b)<0 not satisfied! error: called from: error: C:\Users\Jefl\desktop\bisect.m at line 8, column 3 octave—3-2.3.exe:83:~\deskmp > bisect(f3,0.3,.349064,56-19) error: f(a)f(b)<0 not satisfied! error: called from: error: C:\Users\Jeff\desktop\bisect.m at line 8, column 3 octave-3.2.3.exe:83:~\desktop > bisect(f3,0.3,.349065,5e— 19) error: f(a)f(b)<0 not satisfied! error: called from: error: C:\Users\Jeffldesktop\bisect.m at line 8, column 3 octave-3.2.3.exe:83:~\desktop > bisect(f3,0.3,.349065,Se-19) error: f(a)f(b)<0 not satisfied! error: called from: error: C:\Users\Jeff\desktop\bisoct.m at line 8, column 3 octave-3.2.3.exc:83:~\dcsktop > f3=inline('9*(l—cos(4*x))*(2*10"10*cos(2*x)—4*10"10*cos(x)"5+6*10‘10*cos(x)"2+3*10"10*cos(x)*si_n(1 13 = . fix} = -9"‘(1-cos(4*x))"‘(2"°10"10”‘cos(2*x)—4*10"10"‘cos(x)"5+6"‘10"10*cos(x)*"2+3"‘10"10'“cos(x)*sin(2”‘x)"2a12'i octave-3.2.3.3xe:84:~\dcsktop > bisect(13,0,l 56-1 9) ans : 0.349063873291016 octave-3.2.3.exe:85:~\desktop > bisect(13,0.1,1,5e-19) ans = 0.349066925048828 octave-3.2.3.exe:86:~\desktop _ ' > bisect(13,0.2,1,56-19) ans = 0.349066162109375 octave-3.2.3.exe:8?:~\desktop >‘djary off ...
View Full Document

{[ snackBarMessage ]}