实验20迭代法求方程的根 Using iteration method solve equation xef(x) Solve equation x=sin(x)+1 Compute square root of X2 :=0..10 1.5 + 1.90929742682568 2194325347008953 141666666666667 319314359910797 141421568627451 41.9356712949771 141421356237469 x=51.93416838388212 141421356237309 141421356237309 193451324569203 1.4142135623731 193455688586229 10193456546111101 √=1414213562373095048801688724209698078570 1111.93456241007837 y11.5 1.9346 eee Convergence is very fast
Convergence is very fast! 0 5 10 1.9 1.95 2 xi 1.9346 i 0 2 4 1 1.5 2 y 2 j j 2 = 1.414213562373095048801688724209698078570 2 = 1.4142135623731 x 0 0 1 2 3 4 5 6 7 8 9 10 11 2 1.90929742682568 1.94325347008953 1.9314359910797 1.93567129497719 1.93416838388212 1.93470361617592 1.93451324569203 1.93458098701091 1.93455688586229 1.93456546111101 1.93456241007837 = y 1.5 1.41666666666667 1.41421568627451 1.41421356237469 1.41421356237309 1.41421356237309 æ ç ç ç ç ç ç è ö ÷ ÷ ÷ ÷ ÷ ÷ ø = y j+1 1 2 y j X y j + æ ç è ö ÷ ø := x i+1 sin x i ( ) y j := 0.. 4 := + 1 0 X := 2 := 1.5 Compute square root of X=2 x i := 0.. 10 0 := 2 Solve equation x=sin(x)+1 0 2 1.9347 sin(x)+1 x 1.9347 x 2 0 2 2 2 - 2 2 1 2 x 2 x + æ ç è ö ÷ ø × x - 2 2 x Using iteration method solve equation x=f(x) 实验20 迭代法求方程的根
←a 1) f(x):=2.89x:(1-x) 107230579 Iteration(f,o.s,2530.7040602 「4|06020692 Y: =iteration(f, 1, 18) 506920615 606150684 70.6840625 806250678 0.8 y:=0.8 oot(f(y)-y, y)=0.6 0 0.2 0.6 0.8 f(x): =.5 cos(x) 05|0686 iteration(f, 0, 10) 4098311 71.1751175 Y:= iteration(f, 0, 20) 1.1751.175
iteration(f, a,n) x i ¬ a y i f x i ¬ ( ) a y i ¬ for i Î 0.. n - 1 augment(x, y) := f(x) := 2.89 × x × (1 - x) iteration(f, 0.5, 25) 0 1 0 1 2 3 4 5 6 7 8 0.5 0.723 0.723 0.579 0.579 0.704 0.704 0.602 0.602 0.692 0.692 0.615 0.615 0.684 0.684 0.625 0.625 0.678 = Y := iteration(f,.1,18) 0 0.2 0.4 0.6 0.8 1 0.2 0.4 0.6 0.8 1 .2 y := 0.8 root(f(y) - y, y) = 0.654 f(x) .5 cos(x) sin x 2 := + ( ) iteration(f, 0,10) 0 1 0 1 2 3 4 5 6 7 8 0 0.5 0.5 0.686 0.686 0.84 0.84 0.983 0.983 1.1 1.1 1.162 1.162 1.175 1.175 1.175 1.175 1.175 = Y := iteration(f,0, 20)
f(t) root(f(x)-x,x)=1.1745
0 0.5 1 1.5 0.5 1 1.5 Y á1ñ f(t) t Y á0ñ , t, t x := 1 root(f(x) - x, x) = 1.1745