看板 Prob_Solve 關於我們 聯絡資訊
牛頓法大致上知道怎麼算,不過下面這題英文我翻出來一直很奇怪.. write a program that uses newton's method to approximate the nth root of a number to six decimal places. if x^n=c,then x^n-c=0. find a root of the second equation will give you c^1/n. test your program on 2^1/2,7^1/3,and -1^1/3. your profram could use c/2 as its initial guess 我試翻的結果: 請試寫一程式,使用牛頓法近似一數之n次方根(如 2^(1/n) ),精準度為小數六位數。 假設 x^n = c, 則可推得 x^n-c=0。 當獲知 c^(1/n) 時,以第二恆等式(x^n-c=0) 求其根。 並以 2^1/2,7^1/3,-1^1/3 (c^1/n) 測試此程式,同時測試時以 c/2 為初值。 一般不就是 an+1(x) = an(x) + (f(x)/f'(x)) 當 |an+1(x) - an(x)| < EPS 時視為收斂, 依題意看來,應為 an+1(x) = an(x) + (x^n-c)/(n*x^(n-1)) 但不懂為什麼還要特地寫 c^1/n ?? 還是我對題意有所誤解?不求程式,我想了解題意為何, 謝謝各位先進指教。 -- YouLoveMe() ? LetItBe() : LetMeFree(); -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 180.177.76.142
tropical72:!! 還是其實就只是要算 c^1/n 根而已? 11/17 19:33
tropical72:不過 c 可能是負數,是否要考慮i值問題? 11/17 19:34
tropical72:轉錄至看板 Math 11/17 19:34
LPH66:那句話我會翻成「求第二式之根可得 c^1/n」 11/17 22:24
tropical72:謝謝 L 大指教. 英文題目還真的看不多 XD 11/17 22:31
tropical72:不過話說回來,這題一開始說要用牛頓,後面又像是要我直 11/17 22:33
tropical72:接調用 pow 函數,還真難理解它到底要我用哪個方法.. 11/17 22:33
tropical72:嗯.解出來了.謝謝LPH66.-1^1/3調用pow解不出來.要用牛 11/17 23:51
tropical72:頓才解得出來.再次感謝您的協助 !! 11/17 23:52