Re: [問題] MATLAB計算已回收

看板MATLAB作者時間16年前 (2009/05/03 18:28), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串2/3 (看更多)
※ 引述《Presider (President)》之銘言: : 用sin x=x/1!-x^3/3!+...計算sinπ/6道第8項的實際相對百分誤差為何? : (%error=(true-approximated)/true*100%) : 第16項時呢? : 請寫程式計算並加註解 : 有哪位高手能幫忙解答 感激不盡!!! x = pi/6; for n = 1:16 i = 1+(n-1)*2; approx(n) = (-1)^(n-1)*x^i/prod(1:i); end approx_8th = sum(approx(1:8)); approx_16th = sum(approx(1:16)); Err_8th = (sin(pi/6)-approx_8th)/sin(pi/6); Err_16th = (sin(pi/6)-approx_16th)/sin(pi/6); -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 114.40.22.233 ※ 編輯: himmel 來自: 114.40.22.233 (05/03 18:32)
文章代碼(AID): #19_N7Bwg (MATLAB)
討論串 (同標題文章)
文章代碼(AID): #19_N7Bwg (MATLAB)