x^3+x+1=0
請利用勘根定理的原理運算此方程式的解!!><
很急!! 點數 20點 !!
2007-12-10 18:18:42 · 1 個解答 · 發問者 °【 JC 】 3 in 電腦與網際網路 ➔ 程式設計
dim a as double, b as double, x as double, y as double, err as double
err=10^(-8) '容忍誤差
a=-1: b=0 '根
2007-12-11 00:05:55 補充:
沒寫完:重寫
1. 已知根在 -1, 0之間, 且f(-1)<0, f(0)>0
2. 程式如下:
dim a as double, b as double, x as double, y as double, err as double
err=10^(-8) '容忍誤差
a=-1: b=0 '根在-1, 0之間
while abs(a-b)>err
x=(a+b)/2: y=x^3+x+1
if y>0 then b=x
if y<0 then a=x
if y=0 then a=x: b=x
wend
x=(a+b)/2 '即為所求
2007-12-10 19:01:03 · answer #1 · answered by mathmanliu 7 · 0⤊ 0⤋