Numerical integration: Difference between revisions

Content added Content deleted
(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.)
(A little more precision on the ln(100). P.S. Do we need the other two tests?)
Line 17: Line 17:
Demonstrate your function by showing the results for:
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) = 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) = 1/x, where x is [1,100], with 1,000 approximations. The exact result is the natural log of 100, or about 4.605170
* 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,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.
* f(x) = x, where x is [1,6000], with 6,000,000 approximations. The exact result is 18,000,000.