Numerical integration: Difference between revisions
Content added Content deleted
SqrtNegInf (talk | contribs) (Added Perl example) |
m (→{{header|REXX}}: elided an extra blank line.) |
||
Line 4,170: | Line 4,170: | ||
$=f(a+h/2) |
$=f(a+h/2) |
||
@=0; do x=1 for n-1; $=$+f(a+h*x+h*.5); @=@+f(a+x*h); end /*x*/ |
@=0; do x=1 for n-1; $=$+f(a+h*x+h*.5); @=@+f(a+x*h); end /*x*/ |
||
return h*(f(a) + f(b) + 4*$ + 2*@) / 6 |
return h*(f(a) + f(b) + 4*$ + 2*@) / 6 |
||
/*──────────────────────────────────────────────────────────────────────────────────────*/ |
/*──────────────────────────────────────────────────────────────────────────────────────*/ |