Talk:Numerical integration: Difference between revisions

Content added Content deleted
(→‎f(x) = x cases.: Linear function, and other ranges.)
Line 20: Line 20:


:I needed several hours of computation to complete the answers to the last two tests in Python (but that's what sleep is for, right). Unfortunately Python uses double-precision FP by default so had no problem with precision. I would have thought that a more 'squiggly' function would be the best to show differences in approximation methods as several are probably exact when approximating a straight line. Maybe 2**24*sin(x) for 1<=x<=1 using 1000 steps might do the trick (without taking the chill off my study early in the morning). --[[User:Paddy3118|Paddy3118]] 08:41, 12 September 2010 (UTC)
:I needed several hours of computation to complete the answers to the last two tests in Python (but that's what sleep is for, right). Unfortunately Python uses double-precision FP by default so had no problem with precision. I would have thought that a more 'squiggly' function would be the best to show differences in approximation methods as several are probably exact when approximating a straight line. Maybe 2**24*sin(x) for 1<=x<=1 using 1000 steps might do the trick (without taking the chill off my study early in the morning). --[[User:Paddy3118|Paddy3118]] 08:41, 12 September 2010 (UTC)
:: Well, a linear function should also wind up exact, in the case of the trapezoidal function. (The integration from 0 to x for y = mx + b where b = 0 boils down to finding the area of a triangle.) I suppose using 32 steps each for [0,4096], [0,8092], [0,x = 67108864] and [0,268435456] would accomplish the same thing; the values correspond to:
::* For exploring 32-bit float precision, where the boundary is at 2^24
::** [0,4096] -- 2^23
::** [0,8092] -- 2^25
::* For exploring 64-bit float precision, where the boundary is at 2^53. I chose +/- 2 in the exact value's exponent because +/- 1's seed value value must be represented as a factor of sqrt(2).
::** [0,67108864] -- 2^51.
::** [0,268435456] -- 2^55.
::At only 32 steps each, these should take minimal time to compute, while poking the boundaries of 32-bit and 64-bit precision. (You could possibly reduce it to 2 or 4 steps, or even 1 step if you don't care a great deal about the precision of the other methods. (I could be way off here. I haven't actively applied calculus since I took Calc 2 in college about eight years ago. --[[User:Short Circuit|Michael Mol]] 15:31, 12 September 2010 (UTC)