HP Forums
Integration Problem - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: Integration Problem (/thread-18856.html)



Integration Problem - mgberry - 09-21-2022 05:13 PM

I was hoping someone could point me into the right direction here. I should be getting 0.882 as the result which is what I get with Symbolab as well. Im guessing it is parsing incorrectly, but Ive tried lots of combinations.

See attached thumbnail for the equation

Matt

[attachment=11128]


RE: Integration Problem - roadrunner - 09-22-2022 12:06 AM

If you do it in exact mode by replacing -10.4 with -104/10 and -9.5 with -95/10

then:

∫((1/10^(-95/10))*e^(-x/10^(-95/10)),x,10^(-104/10),∞)

returns:

e^(-sqrt(10)*1/10/(10^(1/5))^2)

which is approximately:

0.881709589165

It's not that it's parsing it incorrectly. In approx mode the round off error results in zero after zero being summed up to result in zero.

-road


RE: Integration Problem - mgberry - 09-22-2022 12:18 AM

That pretty interesting. I suppose I could use the exact() function in front of the values as a work around.

Thanks for the help.

Matt


RE: Integration Problem - rawi - 09-22-2022 07:53 PM

I think this is because of the function extremely located next to zero.
If you put in x=10^(-10.4) you get 2.8*10^9
x=10^(-10) --> f(x) = 2.3*10^9
x=10^(-9) --> f(x) = 1.3*10^8
x=10^(-8) --> f(x) = 0.000058
x=10^(-7) --> f(x) = 1.5*10^(-128)

So if you put in infinity as the upper limit you get zero because there is no value x evaluated in the very narrow area where x has numeric results > 0.

But if you put in 1 as the upper limit of the integral you get 0.88170959, which is the correct result for the upper limit of infinity. And if you put in 1000, 0.1, or 0.01 as the upper limit you get exactly same result.

This reminds me of the Handbook for the HP 34 C from 1979 where it was explained (p. 257ff) that for the integral of x*e^(-x) from zero to infinity with infinity replaced by 1*10^99 the integration routine of the HP 34C delivers the result 0, which is wrong (the correct value is 1). This function as well has only in a very narrow area of x near to zero values that are numerically different from zero.


RE: Integration Problem - Albert Chan - 09-22-2022 10:08 PM

CAS> eval('int(1/10^-9.5*exp(-x/10^-9.5), x, 10^-10.4, inf)' (x=1/t

0.881709589165

x=1/t turned above integral limits to finite, and transformed curve to bell-shaped.
see Numerical integration over infinte intervals


RE: Integration Problem - jte - 09-23-2022 01:45 AM

(09-22-2022 07:53 PM)rawi Wrote:  
This reminds me of the Handbook for the HP 34 C from 1979 where it was explained (p. 257ff) that for the integral of x*e^(-x) from zero to infinity with infinity replaced by 1*10^99 the integration routine of the HP 34C delivers the result 0, which is wrong (the correct value is 1). This function as well has only in a very narrow area values near to zero values that are numerically different from zero.

Nice example.

This thread has reminded me of a recent change (my memory isn’t quite as long!) to the Prime code base — revision 14623 for ticket 51 in the bug tracker — to improve Fcn / Intersection…’s (in Function’s Plot view) handling of F1(X)=166/75^X and F2(X)=180/97^X. Here, again, functions are tapering towards zero. (What struck me while making the change is how blithely one routinely goes from F1(X)=F2(X) to F1(X)-F2(X)=0 without considering the magnitudes of F1(X) and F2(X).)


RE: Integration Problem - Albert Chan - 09-23-2022 03:57 PM

How does HP Prime handle integral infinite limit?
If I use 1e308 for inf, it get the right answer.

CAS> int(1/10^−9.5*e^((-x)/10^−9.5),x, 10^−10.4, 1e308)

0.881709589165


RE: Integration Problem - lrdheat - 09-23-2022 06:00 PM

Integral reaches the quoted answer for range from 10^-10.4 to 10^10^-8. It begins to reach an answer less than the number quoted when a range of 10^-10.4 to 10^-9 is used (.839380369542)


RE: Integration Problem - Wes Loewer - 09-25-2022 09:22 AM

(09-23-2022 03:57 PM)Albert Chan Wrote:  How does HP Prime handle integral infinite limit?

For numerical integration, the Prime uses the substitution u=atan(x) which maps ±∞ to ±pi/2.

(The 50g used the same substitution.)