27 lines
1.8 KiB
Chapel
27 lines
1.8 KiB
Chapel
f(x) = x**3 with 100 steps from 0 to 1
|
|
leftRectangleIntegration: calculated = 0.245025; exact = 0.25; difference = 0.004975
|
|
rightRectangleIntegration: calculated = 0.255025; exact = 0.25; difference = 0.005025
|
|
midpointRectangleIntegration: calculated = 0.249988; exact = 0.25; difference = 1.25e-05
|
|
trapezoidIntegration: calculated = 0.250025; exact = 0.25; difference = 2.5e-05
|
|
simpsonsIntegration: calculated = 0.25; exact = 0.25; difference = 5.55112e-17
|
|
|
|
f(x) = 1/x with 1000 steps from 1 to 100
|
|
leftRectangleIntegration: calculated = 4.65499; exact = 4.60517; difference = 0.0498211
|
|
rightRectangleIntegration: calculated = 4.55698; exact = 4.60517; difference = 0.0481889
|
|
midpointRectangleIntegration: calculated = 4.60476; exact = 4.60517; difference = 0.000407451
|
|
trapezoidIntegration: calculated = 4.60599; exact = 4.60517; difference = 0.000816058
|
|
simpsonsIntegration: calculated = 4.60517; exact = 4.60517; difference = 3.31627e-06
|
|
|
|
f(x) = x with 5000000 steps from 0 to 5000
|
|
leftRectangleIntegration: calculated = 1.25e+07; exact = 1.25e+07; difference = 2.5
|
|
rightRectangleIntegration: calculated = 1.25e+07; exact = 1.25e+07; difference = 2.5
|
|
midpointRectangleIntegration: calculated = 1.25e+07; exact = 1.25e+07; difference = 0.0
|
|
trapezoidIntegration: calculated = 1.25e+07; exact = 1.25e+07; difference = 1.86265e-09
|
|
simpsonsIntegration: calculated = 1.25e+07; exact = 1.25e+07; difference = 3.72529e-09
|
|
|
|
f(x) = x with 6000000 steps from 0 to 6000
|
|
leftRectangleIntegration: calculated = 1.8e+07; exact = 1.8e+07; difference = 3.0
|
|
rightRectangleIntegration: calculated = 1.8e+07; exact = 1.8e+07; difference = 3.0
|
|
midpointRectangleIntegration: calculated = 1.8e+07; exact = 1.8e+07; difference = 7.45058e-09
|
|
trapezoidIntegration: calculated = 1.8e+07; exact = 1.8e+07; difference = 3.72529e-09
|
|
simpsonsIntegration: calculated = 1.8e+07; exact = 1.8e+07; difference = 0.0
|