File: simpsn.mac

package info (click to toggle)
maxima 5.9.1-9
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 32,272 kB
  • ctags: 14,123
  • sloc: lisp: 145,126; fortran: 14,031; tcl: 10,052; sh: 3,313; perl: 1,766; makefile: 1,748; ansic: 471; awk: 7
file content (9 lines) | stat: -rw-r--r-- 270 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9

TRAPRULE(F,A,B,N):=
   (B-A)/N * ((apply(F,[B])+apply(F,[A]))/2 +
   SUM(apply(F,[A+(B-A)/N*I]),I,1,N-1))$

SIMPSON(F,A,B,N):=
   (B-A)/N/3 * (apply(F,[A])+apply(F,[B]) +
   4*SUM(apply(F,[A+(B-A)/N*(2*I-1)]),I,1,N/2)
 + 2*SUM(apply(F,[A+(B-A)/N*(2*I)]),I,1,(N-2)/2))$