南开大学计算物理讲义5.ppt

南开大学计算物理讲义5精要

Using three function evaluations: symmetry suggests for the interval x0- ? x to x0+?x the points should be evaluated at x0 and x0±?. The Taylor Series expansion of the integral 三点高斯-勒让德公式为 积分区间为无限的积分 变量代换法 x= -ln(t) dx= -dt/t 6.8 Example of numerical integration C Trapezium rule nx = 1 DO i=1,20 Value = TrapeziumRule(x0,x1,nx) WRITE(6,*)nx,Value,Value - Exact nx = 2*nx ENDDO REAL*8 FUNCTION TrapeziumRule(x0,x1,nx) C=====parameters INTEGER*4 nx REAL*8 x0,x1 C=====functions REAL*8 f C=====local variables INTEGER*4 i REAL*8 dx,xa,xb,fa,fb,Sum dx = (x1 - x0)/DFLOAT(nx) Sum = 0.0 DO i=0,nx-1 x

文档评论(0)

1亿VIP精品文档

相关文档