- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
chapter4_1
Chapter 4 Differentiation and Integration
※ 求一個函數的derivative (導數)的解析解較容易,求一個函數的integral (積分)的解析解通常很難 ( 用數值方法求definite integrals (定積分)的近似解。
§ 4.2 Normal Differentiation
一階微分(first-order derivative): 直接由微分定義求出 The formal definition of the derivative i.e., f(x) 的導函數即在x點的斜率
for small h, we obtain the approximation to the derivative: (4.2.2) 此式稱為前項差分近似(forward difference approximation)
Example: f (x) = x9, f’(x) = 9x8, 畫圖看在x = 1時,h跟error (即?f ’(x) )的關係。(where h = 0.05, 0.005, 0.0005, …)
% ch4_1.m
x=1; h=.5; hvals=[ ]; dfbydx=[ ];
for i=1:17
h=h/10; hvals=[hvals h]; dfbydx(i)=(f401(x+h)-f401(x))/h;
end;
exact=9; % f’(x) = 9x8, f’(1)=9
loglog(hvals,abs(dfbydx-exact),*); % x,y軸都是對數座標
axis([1e-18 1 1e-8 1e4])
xlabel(h value);
ylabel(error in approximation);
% f401.m
function fv=f401(x)
fv=x.^9;
結論: 當h減少,誤差也會下降,但是當h10-9後,rounding error (四捨五入誤差)會使近似結果變差。
(2) 高階微分(higher derivatives): 微分定義出(Taylor series expansion)
Definition: (Taylor Series)Let f be a function with derivatives of all orders throughout some interval containing a as an interior point. Then the Taylor series generated by f at x = a is
Theorem: (Taylor Theorem)If f is differentiable through order n+1 in an open interval I containing a, than for each x in I, there exists a number c between x and a such thatwhere .(Note: 若f(x) = ex, a = 0, I = R時,)
※ 求函數在x = xi的導數之Central Difference Approximation (中央差分近似):(上式中取a=xi,x=xi+h)展開,得到 (*)把f(x) 以h的距離取樣,令 則 (4.2.3)同理,將(*)裡的h用 ?h取代,可得到 (4.2.4)將(4.2.3) ? (4.2.4)得到若忽略掉 的部分,可得一近似解:, with errors of O(h2) (4.2.5)此稱為Central Difference Approximation (中央差分近似)此法比(4.2.2)式更準確,但當h(0時,二者相同。
※ f’’(xi)的近似:將(4.2.3) ? (4.2.4)得到若忽略掉 的部分,可得一近似解:, with errors of O(h2) (4.2.6)
error 0 0 -1 0 1 0 0 O(h2) 0 0 1 -2 1 0 0 0 -1 2 0 -2 1 0 0 1 -4 6 -4 1 0 0 1 -8 0 8 -1
文档评论(0)