home *** CD-ROM | disk | FTP | other *** search
- ; Demo of numerical integration
-
- ; a simple one
- a = INTEG(SIN(x),x,0,PI)
- a_true = 2
-
- ; an important improper integral
- b = INTEG(EXP(-x^2),x,0,INF)
- b_true = SQRT(PI)/2
-
- ; an integral with a nasty singularity at an endpoint
- c = INTEG(x^-.5 LN(x),x,0,1)
- c_true = -4
-
- d = INTEG(|x^2 + 2x - 2|^-.5,x,0,1)
- ; the nasty singularity is near SQRT(3)-1, so try to remove it
- sing = SQRT(3) - 1
- d1 = INTEG(|x^2 + 2x - 2|^-.5,x,0,sing) +
- INTEG(|x^2 + 2x - 2|^-.5,x,sing,1)
- d_true = PI/2 - ATAN(2^-.5) + LN(3)/2
-