Jump to content

Numerical integration: Difference between revisions

Exact results offered. And, sorry, two more; the [1,5000] case may not necessarily force float precision problems with 32-bit floats. The [1,6000] case results above 2^24, and so it should.
(→‎{{header|ALGOL 68}}: fixed mid rect, which was still wrong, sigh)
(Exact results offered. And, sorry, two more; the [1,5000] case may not necessarily force float precision problems with 32-bit floats. The [1,6000] case results above 2^24, and so it should.)
Line 16:
 
Demonstrate your function by showing the results for:
* f(x) = x^3, where x is [0,1], with 100 approximations. The exact result is 1/4, or 0.25.
* f(x) = 1/x, where x is [1,100], with 1,000 approximations. The exact result is the natural log of 100, or about 4.605
* f(x) = x, where x is [1,5000], with 5,000,000 approximations. The exact result is 12,500,000.
* f(x) = x, where x is [1,6000], with 6,000,000 approximations. The exact result is 18,000,000.
 
 
Cookies help us deliver our services. By using our services, you agree to our use of cookies.