1樓:常映寒黃彥
設f(x)=2x^3-4x^2+3x-6,對它求導的f'(x)=6x^2-8x+3
根據牛頓迭代公式令x(k+1)=x(k)-f[x(k)]/f'[x(k)]
然後將x(0)=1.5代入方程
xf(x)
f'(x)
1.5-3.75
4.52.33333333
2.2963
17.0000
2.19826
方程的根就是2.19826
取得精度不同,算出來的資料可能稍有差別,如果這個資料精度不夠要求,你可以按照這個方法再往下算幾次就可以了
2樓:相樂心宦業
c語言實現編輯本段問題
已知f(x)=x*e^x-1
針對f(x)=0型別。
迭代方程是:g(x)=x-f(x)/f'(x);其中f'(x)是導數。
針對x*e^x-1=0的牛頓迭代法
求出迭代方程,根據牛頓的是,g(x)=x-f(x)/f'(x)針對x*e^x-1=0,是g(x)=x-(xe^x-1)/(e^x+x*e^x);
**#include
#include
intmain()
{double
f(double
x);double
x,y,d;
x=1;
y=0;//迭代值。
d=0.000000001;//誤差控制
求助:用vb寫牛頓迭代法程式解方程
3樓:匿名使用者
dim q as single, m as single, s as single, r as single
private sub command1_click()
dim x0 as single
doq = val(inputbox("請輸入常數q(≠0) "))
loop until q <> 0
dom = val(inputbox("請輸入常數m(≠0) "))
loop until m <> 0
dos = val(inputbox("請輸入常數s(≠0) "))
loop until s <> 0
dor = val(inputbox("請輸入常數r(≠0) "))
loop until r <> 0
label1 = label1 & "q=" & q & "
m=" & m & "
s=" & s & "
r=" & r
dox0 = val(inputbox("請粗略估計解x0(>0) "))
loop until x0 > 0
y0 = hanshu(x0)
doxielv = daoshu(x0)
deltx = y0 / xielv
x0 = x0 + deltx
y0 = hanshu(x0)
loop until abs(y0) < 0.00005 and abs(deltx) < 0.00005
label1 = label1 & vbcrlf & "x=" & x0 & "
y=" & y0 & "
δx=" & deltx
end sub
private sub command2_click()
for i = 0 to 255
if i mod 10 = 0 then print
print chr$(i); " ";
next i
print "ok"
end sub
private sub form_load()
label1 = "(0.366 * q / m / s) * log(10 * s * sqr(x) / r) - x = 0" & vbcrlf
end sub
private function hanshu(x as single) as single
hanshu = 0.366 * q / m / s * log(10 * s * sqr(x) / r) - x
end function
private function daoshu(x as single) as single
daoshu = 0.366 * q / 2 / x / m / s - 1
end function
注意引數選擇不當,就會出錯。
vb程式設計題,牛頓迭代法。 200
4樓:匿名使用者
private function newton(n as double, eps as double) as double
dim a(100) as double
dim x as double
dim y as double
dim k as double
a(0) = 0
for i = 0 to 99
x = a(i)
y = x ^ 3 - 2 * x ^ 2 + 4 * x + 1k = 3 * x ^ 2 - 4 * x + 4a(i + 1) = x - y / k
print a(i + 1)
if abs(y) < esp then
newton = a(i + 1)
exit function
else
newton = 0
end if
next i
end function
5樓:y小時代
你會了嘛 怎麼做的 我看答案還是看不懂那
6樓:匿名使用者
esp和 eps 筆誤嘍
vb程式設計 用牛頓迭代法求f(x)=3x^3-4x^2-5x+13
7樓:匿名使用者
wkihh,.>=-===236544458kjim=+3.14-------------:[325544]
用牛頓迭代法求方程,用牛頓迭代法求方程f x x 6 x 1 0在區間 1,2 內的實根,要求 f x k 10 8 用C語言編寫此程式設計
include include define eps 1e 8 void main printf 用newton切線法得 12.10lf n t 結果為 t0 1.2065843621,t 0.9809945654t0 0.9809945654,t 0.8207881793t0 0.82078817...
用matlab做牛頓迭代法,用matlab如何編寫牛頓迭代法問題,謝謝
sky不用太多 function a cal a,b,v a,b表示區間,v是精度 i 1 x a b 2 a i x t x x 3 x 1 3 x 2 1 迭代函式 while abs t x v i i 1 x t a a i x t x x 3 x 1 3 x 2 1 迭代函式 enda a...
c編寫程式用牛頓迭代法求一元方程
include iostream include math.h using namespace std typedef double func double double y double x double dy double x double newton double x,func fy,fun...