# HP Forums

Full Version: WP 34S integration accuracy
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I integrated e^(3x) * sin(4x) in fix 4 mode and got an instant result accurate to 3 significant digits. This surprised me as I expected at least 4 digit accuracy. Then I had the vague recollection that for some problems where the area under the curve is quite small, the use of scientific notation would provide greater accuracy. Sure enough, in SCI 4, I get 9 significant digit accuracy.

I'm wondering...is there a rule of thumb to go by as to how to choose the best entry mode for an integration?

Is there a nice overlap between the 2 entry modes where one can depend on high accuracy, or is there a gray area where neither entry method would yield outstanding (subjective, of course) accuracy? (It's clear to me that if such a gray area exists, the achievable accuracy would still be accurate to more digits than then the displayed result)
I was integrating from -5pi/4 to -pi.
(04-01-2015 05:55 PM)lrdheat Wrote: [ -> ]I'm wondering...is there a rule of thumb to go by as to how to choose the best entry mode for an integration?

Looks like there's none.

d:-)
(04-01-2015 05:55 PM)lrdheat Wrote: [ -> ]I integrated e^(3x) * sin(4x) in fix 4 mode and got an instant result accurate to 3 significant digits. This surprised me as I expected at least 4 digit accuracy.

Indeed you get "4 digit accuracy" here. But not 4 significant digits. See below.

(04-01-2015 05:55 PM)lrdheat Wrote: [ -> ]Then I had the vague recollection that for some problems where the area under the curve is quite small, the use of scientific notation would provide greater accuracy. Sure enough, in SCI 4, I get 9 significant digit accuracy.

Sure – this time you get five significant digits.

(04-01-2015 05:55 PM)lrdheat Wrote: [ -> ]I'm wondering...is there a rule of thumb to go by as to how to choose the best entry mode for an integration?

There is a very simple rule: the iteration exits and the result is displayed as soon as the last two approximations agree when rounded to display precision.

This means that FIX 4 will yield a result that has four valid digits after the decimal point/comma. In your example the exact result is –0,0000141357... Already the first approximation yields –0,000014166. This agrees with the true result in even more than the first four digits: in FIX 4 both results would round to 0,0000 (!). Thus the iteration is considered converged, Integrate finishes and displays the result.

Now you said you want four significant (!) digits. This is what is displayed in SCI 3 mode. So set the 34s to SCI 3, try again and watch the iteration converge:
–1,417 E–5 ... –1,409 E–5 ... –1,414 E–5 ... and finally ∫=–1,414 E–5. Voilà.

Dieter
I saw a video comparing integration speed of two Casio calculators - an fx-991DE X "CLASSWIZ" (German version of the fx-991EX) and an old fx-991ES (similar to an fx-115ES, and older than the "PLUS" models).

The integral used was an "improper" definite integral between -5 and 99 of "ln(x²).dx". It contains a singularity at x=0. The fx-991DE X completed it in about 36 seconds and gave a pretty accurate numeric result. (The exact answer according to my HP 50g is "99*LN(9801)+10*LN(5)-208", which is 717.9281095 to 10 significant figures, and this is the answer shown by the fx-991DE X.)

Of course, I wanted to see how the WP 34s compared, so I entered the function:
Code:
001 LBL'I' 002 x² 003 LN 004 RTN
and integrated it between -5 and 99 with the display in 'ALL' mode. The integration ran for about 31 minutes and produced the final answer 717.934270433, which is accurate to about 5 digits. The PC emulator is a lot faster but produced the same answer.

For comparison, a HP 50g with the CAS mode set to 'Approx' took 26 minutes and produced the answer 717.928325369. A HP 35s could only perform the integral if the display was set to 5 digits or less and took 59 seconds to produce the answer 7.18002e2 (in 'SCI 5' mode). A TI 36X Pro took about a minute and produced the answer 717.9281268 which is accurate to about 7 digits.

I'm guessing it's the improper nature of the definite integral which is throwing things out of whack. Still, an interesting comparison, I think.
The CASIO 9860gii does it in 8 seconds with same accuracy as the classwiz.
The Prime, of course, is nearly instantaneous with an exact answer in CAS, and nearly instantaneous with a decimal answer to 2 more decimals than Classwiz and 9860gii in HOME.
On the 50G Gauss-Kronrod programme

http://www.hpcalc.org/hp49/math/numeric/gk-int.zip

for -5 and 99 of "ln(x²).dx" & tol = 1E-12 returns 717.928109462 in 21.65 sec.
(09-02-2015 04:22 PM)ijabbott Wrote: [ -> ]The exact answer according to my HP 50g is "99*LN(9801)+10*LN(5)-208"
That's strange. Why aren't both limits handled the same way which results in:

198*LN(99)+10*LN(5)-208

Quote:I'm guessing it's the improper nature of the definite integral which is throwing things out of whack.
You could split the integral into 3 parts: [-5, -1], [-1, 1] and [1, 99] and use that $$\int_{-1}^{1}\log(x^2)dx=-4$$.
Or then split it into: [-5, -e], [-e, e] and [e, 99] and use that $$\int_{-e}^{e}\log(x^2)dx=0$$.
The remaining integrals should be calculated fast then.

Cheers
Thomas
Reference URL's
• HP Forums: http://www.hpmuseum.org/forum/index.php
• :