Numerical integration/Adaptive Simpson's method: Difference between revisions
Content added Content deleted
(→{{header|Modula-2}}: Simplified a bit.) |
|||
Line 1,598: | Line 1,598: | ||
whole, m, fm, depth) |
whole, m, fm, depth) |
||
END quadASR; |
END quadASR; |
||
PROCEDURE sine (x : REAL) : REAL; |
|||
BEGIN |
|||
RETURN RealMath.sin (x); |
|||
END sine; |
|||
BEGIN |
BEGIN |
||
STextIO.WriteString ('estimate of ∫ sin x dx from 0 to 1: '); |
STextIO.WriteString ('estimate of ∫ sin x dx from 0 to 1: '); |
||
SRealIO.WriteReal (quadASR ( |
SRealIO.WriteReal (quadASR (RealMath.sin, 0.0, 1.0, |
||
0.000000001, 100), |
|||
10); |
|||
STextIO.WriteLn; |
STextIO.WriteLn; |
||
END adaptive_simpson_task_Modula2. |
END adaptive_simpson_task_Modula2. |