Let's assume we want to calculate the following definite integral:
\[ \int_{0}^{1}x^{-x}dx \]
We'd use a calculator with an \( \int_{x}^{y} \) button and write a short program:
01 LBL 0
02 CHS
03 \(y^x\)
04 RTN
The result is something like: 1.291285997
Now what if for some reason this button doesn't work or we don't have a calculator that supports numerical integration?
How can we still calculate this definite integral?
Cheers
Thomas
Addendum:
How can I guide you into the right direction without spoiling the quiz?
Of course you can just use another calculator where the button isn't broken.
But that's not the point of this quiz.
Well... It depends on what machine we have. Even plain TI-55 can calculate this, using primitive rectangle method. But I prefer Simpson's if it can fit in program memory, of course
For the built-in integral to work! your answer is correct!
Now to answer your question. I would use an open Newton-Cote numerical integration method since this class of methods do not evaluate the integral at the end points, just in case my machine barks at evaluating 1/0^0.
(12-31-2013 04:24 AM)Namir Wrote: [ -> ]I do believe the program should be:
Code:
01 LBL 0
02 ENTER
03 CHS
04 yx
05 RTN
For the built-in integral to work!
The HP-15C conveniently fills the stack with \(x\) when calling your function.
Quote:I would use an open Newton-Cote numerical integration method since this class of methods do not evaluate the integral at the end points, just in case my machine barks at evaluating 1/0^0.
Good point. The function is continuous even at 0: \(\lim_{x\to0}x^{-x}=1\)
But the first derivative is singular at 0: \(\lim_{x\to0}\frac{\partial x^{-x}}{\partial x}=\infty\)
HP's modified Romberg method avoids the end-points of the interval as well.
(12-30-2013 11:44 PM)W_Max Wrote: [ -> ]Well... It depends on what machine we have. Even plain TI-55 can calculate this, using primitive rectangle method. But I prefer Simpson's if it can fit in program memory, of course
I've tried Valentin's Gaussian integration for the HP-11C for various values of N:
10: 1.291303564
20: 1.291290482
50: 1.291286729
100: 1.291286183
200: 1.291286042
500: 1.291286006
1000: 1.291285997
He doesn't seem to be fond of Simpson's rule:
Quote:Simpson's method is to numerical integration what bubble sort is to sorting, i.e., vastly inefficient.
Interesting is the suggestion that a Gaussian method would have been used in the 34C if there were ROM space. I originally used such a method in the 34S and almost everyone wanted it changed to an adaptive one instead (Romberg).
If I use fix 4 on the hp 15c (the very old version no LE) I get in some seconds a correct result (like N=20, some posts above), that shows the algorithem functions well.
Maybe the problems by fix 9 are caused by calculating the integrand: instead of \[ x^{-x} \] as \[ \exp(-x\cdot\ln(x)) \]. That have a great alteration rate near zero. The hp 15c algorithem don't calculate at the limits the value of the integrand, but for getting a higher precision it runs into a great number of calculations.
Sincerely
peaceglue
P.S. I have to correct myself, even with 0.01 or 0.1 it doesn't come to an end.
It takes 2'27" to calculate this integral on a DM-15CC with FIX 9.
It takes 28" to do it with the RPN-15C emulator on my iPhone.
On a real HP-15C it takes probably much longer.
Can you do it much faster?
Plot the function, print out the plot and use your trusty planimeter to calculate the area. If you are unlucky enough to not own a planimeter, hatchet planimeters are easy to construct.