CIS-541-–-Numerical-Methods--Department-of-Computer-:顺541–数值方法-计算机系-资料课件.ppt

上传人(卖家):ziliao2023 文档编号:7336875 上传时间:2023-11-29 格式:PPT 页数:38 大小:499.50KB
下载 相关 举报
CIS-541-–-Numerical-Methods--Department-of-Computer-:顺541–数值方法-计算机系-资料课件.ppt_第1页
第1页 / 共38页
CIS-541-–-Numerical-Methods--Department-of-Computer-:顺541–数值方法-计算机系-资料课件.ppt_第2页
第2页 / 共38页
CIS-541-–-Numerical-Methods--Department-of-Computer-:顺541–数值方法-计算机系-资料课件.ppt_第3页
第3页 / 共38页
CIS-541-–-Numerical-Methods--Department-of-Computer-:顺541–数值方法-计算机系-资料课件.ppt_第4页
第4页 / 共38页
CIS-541-–-Numerical-Methods--Department-of-Computer-:顺541–数值方法-计算机系-资料课件.ppt_第5页
第5页 / 共38页
点击查看更多>>
资源描述

1、CSE 541-DifferentiationRoger CrawfisAugust 17,2023OSU/CIS 5412Numerical Differentiation The mathematical definition:Can also be thought of as the tangent line.0()()()limhf xhf xfxhxx+hAugust 17,2023OSU/CIS 5413Numerical Differentiation We can not calculate the limit as h goes to zero,so we need to a

2、pproximate it.Apply directly for a non-zero h leads to the slope of the secant curve.xx+hAugust 17,2023OSU/CIS 5414Numerical Differentiation This is called Forward Differences and can be derived using Taylors Series:22()()()()2!()()()()2!()()()()2!()()()0hf xhf xfx hfhf xhf xfx hff xhf xhfxfhf xhf x

3、fx as hhTheoretically speakingAugust 17,2023OSU/CIS 5415Truncation Errors Let f(x)=a+e,and f(x+h)=a+f.Then,as h approaches zero,ea and fa.With limited precision on our computer,our representation of f(x)a f(x+h).We can easily get a random round-off bit as the most significant digit in the subtractio

4、n.Dividing by h,leads to a very wrong answer for f(x).August 17,2023OSU/CIS 5416Error TradeoffUsing a smaller step size reduces truncation error.However,it increases the round-off error.Trade off/diminishing returns occurs:Always think and test!Log errorLog step sizeTruncation errorRound off errorTo

5、tal errorPoint of diminishingreturnsAugust 17,2023OSU/CIS 5417Numerical Differentiation This formula favors(or biases towards)the right-hand side of the curve.Why not use the left?xx+hx-hAugust 17,2023OSU/CIS 5418Numerical Differentiation This leads to the Backward Differences formula.2()()()()2!()(

6、)()()2!()()()0hf xhf xfx hff xf xhhfxfhf xf xhfx as hhAugust 17,2023OSU/CIS 5419Numerical Differentiation Can we do better?Lets average the two:This is called the Central Difference formula.1()()()()()()()22f xhf xf xf xhf xhf xhfxhhhForward difference Backward differenceAugust 17,2023OSU/CIS 54110C

7、entral Differences This formula does not seem very good.It does not follow the calculus formula.It takes the slope of the secant with width 2h.The actual point we are interested in is not even evaluated.xx+hx-hAugust 17,2023OSU/CIS 54111Numerical Differentiation Is this any better?Lets use Taylors S

8、eries to examine the error:232333()()()()()23!()()()()()23!()()2()()()3!3!hhf xhf xfx hfxfhhf xhf xfx hfxfsubtractinghhf xhf xhfx hffAugust 17,2023OSU/CIS 54112Central Differences The central differences formula has much better convergence.Approaches the derivative as h2 goes to zero!2()()1()(),26f

9、xhf xhfxfhxh xhh2()()()2f xhf xhfxO hhAugust 17,2023OSU/CIS 54113Warning Still have truncation error problem.Consider the case of:Build a table withsmaller values of h.What about largevalues of h for thisfunction?()100100100()21,0.000333,60.01000330.0099966()0.0100500.000666666Relative error:0.01-0.

10、0100500.5%0.01xf xxhxhfxhat xhwith significantdigitsfxAugust 17,2023OSU/CIS 54114Richardson Extrapolation Can we do better?Is my choice of h a good one?Lets subtract the two Taylor Series expansions again:2345452345455533()()()()()()()23!4!5!()()()()()()()23!4!5!()()()()2()222()3!3!5!hhhhf xhf xfx h

11、fxfxfxfxhhhhf xhf xfx hfxffxfxsubtractingfxfxhf xhf xhfx hhhfxAugust 17,2023OSU/CIS 54115Richardson Extrapolation Assuming the higher derivatives exist,we can hold x fixed(which also fixes the values of f(x),to obtain the following formula.Richardson Extrapolation examines the operator below as a fu

12、nction of h.2462461()()()2fxf xhf xha ha ha hh1()()()2hf xhf xhhAugust 17,2023OSU/CIS 54116Richardson Extrapolation This function approximates f(x)to O(h2)as we saw earlier.Lets look at the operator as h goes to zero.246246246246()()()()2222hfxa ha ha hhhhhfxaaaSame leading constantsAugust 17,2023OS

13、U/CIS 54117Richardson Extrapolation Using these two formulas,we can come up with another estimate for the derivative that cancels out the h2 terms.46464315()4()3()24161()()()()232hhfxa ha horhhfxhO h new estimatedifference between old and new estimatesExtrapolates by assuming the new estimate unders

14、hot.August 17,2023OSU/CIS 54118Richardson Extrapolation If h is small(h1),then h4 goes to zero much faster than h2.Cool!Can we cancel out the h6 term?Yes,by using h/4 to estimate the derivative.August 17,2023OSU/CIS 54119Richardson Extrapolation Consider the following property:where L is unknown,as

15、are the coefficients,a2k.221221()()kkkkkkhfxa hLa h 0lim()hLhfxAugust 17,2023OSU/CIS 54120Richardson Extrapolation Do not forget the formal definition is simply the central-differences formula:New symbology(is this a word?):1()()()2hf xhf xhh21,02,02nknkhD nhLA kFrom previous slideAugust 17,2023OSU/

16、CIS 54121Richardson Extrapolation D(n,0)is just the central differences operator for different values of h.Okay,so we proceed by computing D(n,0)for several values of n.Recalling our cancellation of the h2 term.441()()()()2321(1,0)(1,0)(0,0)4 1hhfxhO hDDDO hAugust 17,2023OSU/CIS 54122Richardson Extr

17、apolation If we let hh/2,then in general,we can write:Lets denote this operator as:41()(,0)(,0)(1,0)4 12nhfxD nD nD nO11,1(,0),01,041D nD nD nD nAugust 17,2023OSU/CIS 54123Richardson Extrapolation Now,we can formally define Richardsons extrapolation operator as:or41,(,1)1,1,14141mmmD n mD n mD nmmnn

18、ew estimateold estimate1,(,1),11,141mD n mD n mD n mD nmAugust 17,2023OSU/CIS 54124Richardson Extrapolation Now,we can formally define Richardsons extrapolation operator as:Memorize me!1,(,1),11,141mD n mD n mD n mD nmAugust 17,2023OSU/CIS 54125Richardson Extrapolation Theorem These terms approach f

19、(x)very quickly.21,2knk mhD n mLA k mOrder starts much higher!August 17,2023OSU/CIS 54126Richardson Extrapolation Since m n,this leads to a two-dimensional triangular array of values as follows:We must pick an initial value of h and a max iteration value N.0,01,01,12,02,12,2,0,1,2,DDDDDDD ND ND ND N

20、 NAugust 17,2023OSU/CIS 54127Example523cos(100()11.3,1280,016.6963861,040.5833932,0109.3225283,0135.0317474,0142.0686155,0143.866937xf xxxhDDDDDD10.002444096h August 17,2023OSU/CIS 54128Example0,016.6963861,040.5833931,148.5833932,0109.3225282,1132.2355743,0135.0317473,1143.6014874,0142.0686154,1144

21、.4142385,0143.8669375,1144.466377DDDDDDDDDDD13extrapolateAugust 17,2023OSU/CIS 54129Example0,016.6963861,040.5833931,148.5833932,0109.3225282,1132.2355742,2137.8148973,0135.0317473,1143.6014873,2144.3592144,0142.0686154,1144.4142384,2144.4684215,0143.8669375,1144DDDDDDDDDDDDDD.4663775,2144.469853D11

22、5extrapolateAugust 17,2023OSU/CIS 54130Example Which converges up to eight decimal places.Is it accurate?16.69638640.58339348.583393109.322528132.235574137.814897135.031747143.601487144.359214144.463092142.068615144.414238144.468421144.470154144.470182143.866937144.466377144.469853144.469876144.4698

23、755,D5144.46987511023extrapolate1255extrapolate163extrapolate115extrapolate13extrapolateAugust 17,2023OSU/CIS 54131Example We can look at the(theoretical)error term on this example.Taking the derivative:255 1122575,5,5211.3(6,5),540962kkkkhDLA khfAA k 2-144(1.3)144.469874253f Round-off errorAugust 1

24、7,2023OSU/CIS 54132Second Derivatives What if we need the second derivative?Any guesses?234545234545()()()()()()()23!4!5!()()()()()()()23!4!5!hhhhf xhf xfx hfxfxfxfxhhhhf xhf xfx hfxffxfxAugust 17,2023OSU/CIS 54133Second Derivatives Lets cancel out the odd derivatives and double up the even ones:Imp

25、lies adding the terms together.244()()2()2()2()24!hhf xhf xhf xfxfxAugust 17,2023OSU/CIS 54134Second Derivatives Isolating the second derivative term yields:With an error term of:2()2()()()f xhf xf xhfxh 42112Eh f August 17,2023OSU/CIS 54135Partial Derivatives Remember:Nothing special about partial derivatives:,2,2f xh yf xh yfx yxhf x yhf x yhfx yyhAugust 17,2023OSU/CIS 54136Calculating the Gradient For lab 2,you need to calculate the gradient.Just use central differences for each partial derivative.Remember to normalize it(divide by its length).谢谢你的阅读v知识就是财富v丰富你的人生 Thank you

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 办公、行业 > 各类PPT课件(模板)
版权提示 | 免责声明

1,本文(CIS-541-–-Numerical-Methods--Department-of-Computer-:顺541–数值方法-计算机系-资料课件.ppt)为本站会员(ziliao2023)主动上传,163文库仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。
2,用户下载本文档,所消耗的文币(积分)将全额增加到上传者的账号。
3, 若此文所含内容侵犯了您的版权或隐私,请立即通知163文库(发送邮件至3464097650@qq.com或直接QQ联系客服),我们立即给予删除!


侵权处理QQ:3464097650--上传资料QQ:3464097650

【声明】本站为“文档C2C交易模式”,即用户上传的文档直接卖给(下载)用户,本站只是网络空间服务平台,本站所有原创文档下载所得归上传人所有,如您发现上传作品侵犯了您的版权,请立刻联系我们并提供证据,我们将在3个工作日内予以改正。


163文库-Www.163Wenku.Com |网站地图|