x0disp’初始值为0,牛顿法计算结果为:’x
data
ew_to
x1
fdisp初始值为1,牛顿法计算结果为:x
data
ew_to
x2disp初始值为2,牛顿法计算结果为:
budo
gmfu
ctio
r
databudo
gx0tolif
argi
1tol1e3:e
dx1budo
gfu
x0;
1while
ormx1x0tol
500x0x1x1budo
g_fu
x0;
1:data
x1;e
drx1:
ew_to
mfu
ctio
x
data
ew_to
x0tolif
argi
1tol1e8;e
dx1x0budo
g_fu
x0df1x0
1while
ormx1x0tolx0x1x1x0budo
g_fu
x0df1x0
1data
x1e
dxx1
budo
g_fu
mfu
ctio
fbudo
g_fu
xf13x1cosx2x312f2x1281x2012si
x3106f3expx1x220x310pi31ff1f2f3;
df1mfu
ctio
fdf1xf3si
x2x3x3si
x2x3x22x1162x201cosx3
fexpx1x2x2expx1x2x120
结果:
不动点计算结果为
r
10e012
NaNI
f
56541
初始值为0,牛顿法计算结果为:
x
050000000005236
初始值为1,牛顿法计算结果为:
x
05000
0000005236
初始值为2,牛顿法计算结果为:
x
05000
0000005236
fr