计算物理ComputationalPhysics计算物理 (5).pdf
《计算物理ComputationalPhysics计算物理 (5).pdf》由会员分享,可在线阅读,更多相关《计算物理ComputationalPhysics计算物理 (5).pdf(38页珍藏版)》请在得力文库 - 分享文档赚钱的网站上搜索。
1、Computational physiCsChaosOrdinary differential equations Initial-value problems The Euler methods Predictor-corrector methods The Runge-Kutta method Chaotic dynamics Boundary-value problems The shooting method Linear equations Eigenvalue problemsthe motion of a classical particle is described by Ne
2、wtons equationThe motion of a quantum particle is described by the Schrodinger equationThe dynamics and statics of bulk materials such as fluids and solids are all described by differential equations.Most problems in physics and engineering appear in the form of differential equations.22dtrdmdtvdmam
3、fVmti222For example In general,we can classify ordinary differential equations into three major categories:initial-value problemstime-dependent equations with given initial conditionsboundary-value problemsdifferential equations with specified boundary conditionseigenvalue problemssolutions for sele
4、cted parameters(eigenvalues)in the equationsInitial-value problems Typically,initial-value problems involve dynamical systems.For example,the motion of the moon,earth,and sun,the dynamics of a rocket,or the propagation of ocean waves.A dynamical system can be described by a set of first-order differ
5、ential equations:),(),(),(),(21tygtygtygtyglthe generalized velocity vectorthe generalized position vector),(tygdtyd),(21lyyyyExample A particle moving in one dimension under an elastic force Define y1=x;y2=v;Then we obtain:If the initial position y1(0)=x(0)and the initial velocity y2(0)=v(0)are giv
6、en,we can solve the problem numerically.xkdtvdmamf,1221ymkdtdyydtdyThe Euler methodThe accuracy of this algorithm is relatively low.At the end of the calculation after a total of n steps,the error accumulated in the calculation is on the order of nO(t2)O(t).iiiiiiiiiiittOgyytygttyydtdy12111)(),(We c
7、an formally rewrite the above equation as an integralwhich is the exact solution if the integral can be obtained exactly.dttygyyjiittiji),(Because we can not obtain the integral exactly in general,we have to approximate it.The accuracy in the approximation of the integral determines the accuracy of
8、the solution.If we take the simplest case of j=1 and approximate g(y,t)=gi in the integral,we recover the Euler algorithm.Code example 4.1.Euler.cpp(1.3.Intro.cpp)Predictor-corrector method Use the solution from the Euler method as the starting point.Use a numerical quadrature to carry out the integ
9、ration.For example,if we choose j=1 and use the trapezoid rule for the integral.)()(2311OggyyiiiiCode example The harmonic oscillation.Euler method:poor accuracy with t=0.02p.Predictor-corrector method:much better?/Predict the next position and velocity xi+1=xi+vi*dt;vi+1=vi-xi*dt;/Correct the new p
10、osition and velocity xi+1=xi+(vi+vi+1)*dt/2;vi+1=vi-(xi+xi+1)*dt/2;Code example 4.2.Predictor-Corrector.cpp Another way to improve an algorithm is by increasing the number of mesh points j.Thus we can apply a better quadrature to the integral.For example,take j=2 and then use the linear interpolatio
11、n scheme to approximate g(y,t)in the integral from gi and gi+1:)()(),(211Ogttgtttygiiiidttygyyjiittiji),(Now if we carry out the integration with g(y,t)given from this equation,we obtain a new algorithmwhich has an accuracy one order higher than that of the Euler algorithm.However,we need the values
12、 of the first two points in order to start this algorithm,because gi+1=g(yi+1,ti+1).)(2312Ogyyiii We can make the accuracy even higher by using a better quadrature.For example,we can take j=2 in above equation and apply the Simpson rule to the integral.Then we haveThis implicit algorithm can be used
13、 as the corrector if the previous algorithm is used as the predictor.)()4(35122OgggyyiiiiiA car jump over the yellow river 1997年,香港回归前夕,柯受良驾驶跑车成功飞越了黄河天堑壶口瀑布,长度达55米。飞越当天刮着大风,第一次飞越没有成功,但第二次成功了,其中有过很多危险的动作,但他都安全度过了,因此获得了“亚洲第一飞人”的称号。1953-2003 Let us take a simple model of a car jump over a gap as an exa
14、mple.The air resistance on a moving object is roughly given by ,where A is cross section of the moving object,r is the density of the air,and c is a coefficient that accounts for all the other factors.So the motion of the system is described by the equation setrcAfr.,ymgfmfadtvdvdtrd f is the total
15、force on the car of a total mass m.Here y is the unit vector pointing upward.Assuming that we have the first point given,that is,r0 and v0 at t=0.Code example4.3.FlyingCar.cppThe RungeKutta method Formally,we can expand y(t+)in terms of the quantities at t with the Taylor expansion:A particle moving
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 计算物理ComputationalPhysics计算物理 5 计算 物理 ComputationalPhysics
限制150内