HP Forums
Problems of HP prime with triple integrals? - 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: Problems of HP prime with triple integrals? (/thread-15099.html)



Problems of HP prime with triple integrals? - rawi - 05-31-2020 07:41 AM

Hi,

I tried to compute the following triple integral:
integral(integral(integral(e^(-x²+y²/2+1/z))dz)dy)dx
with the following limits: x: 0.,1.; y:0.,2.; z:1.,4.

Screenshot of the HP prime Pro software is attached.

I tried it with the HP Prime Pro PC software and with a HP prime G2. None delivered a solution within half an hour.

The TI-nspire CX II-T CAS came to the solution 17.147920 within 1 or 2 seconds. Even my old TI-89 titanium showed the same solution within 10 seconds.

Does the HP prime have problems with triple integrals or is there something I am doing wrong?

Thank you very much and best regards

Raimund Wildner


RE: Problems of HP prime with triple integrals? - Nigel (UK) - 05-31-2020 09:38 AM

Any calculator will have trouble with triple integrals that don't factorise into a product of single-variable integrals. To evaluate such an integral numerically to a high degree of precision requires of the order of \(N^3\) points, compared with \(N\) points for similar precision for a single-variable integral.

Your integral factorises, so calculators that spot this can evaluate it rapidly. The Prime doesn't appear to check for this, so it evaluates the integral the long way.

I would guess that for multiple integrals that don't factorise the Prime and TI NSpire would be comparable, with the Titanium way behind!

Having said that, I am surprised that the Prime didn't finish at all. Perhaps there is a problem.

Nigel (UK)


RE: Problems of HP prime with triple integrals? - Nigel (UK) - 05-31-2020 10:54 AM

Strange. If I change variables to \(u=1/z\), then with exact mode ticked and approximate evaluation I get the correct answer to the triple integral at once, after a couple of messages.

With exact mode not ticked I get a message about using Romberg, then the calculator carries on calculating until interrupted.

With \(1/z\) in the exponent I can't get an answer to the triple integral at all, although the equivalent single integral evaluates with no problem.

Something's not right!

Nigel (UK)


RE: Problems of HP prime with triple integrals? - Albert Chan - 05-31-2020 01:21 PM

(05-31-2020 10:54 AM)Nigel (UK) Wrote:  Strange. If I change variables to u=1/z, then with exact mode ticked and approximate evaluation I get the correct answer to the triple integral at once, after a couple of messages.

With u=1/z, integral is trivial to evaluate, with integration by parts

\(\large \int e^{1\over z}\;dz
= \int e^u\;d({1\over u})
= {e^u \over u} - \int {1 \over u}\;d(e^u)
= {e^u \over u} - Ei(u)
\)


RE: Problems of HP prime with triple integrals? - lrdheat - 05-31-2020 04:04 PM

The TI-Nspire CX 2 (non CAS) also manages to report the correct answer...
[/u]


RE: Problems of HP prime with triple integrals? - rawi - 05-31-2020 04:10 PM

(05-31-2020 09:38 AM)Nigel (UK) Wrote:  Having said that, I am surprised that the Prime didn't finish at all. Perhaps there is a problem.

Hi Nigel,

thanks a lot for your answer. HP prime really seems to have a problem here. I tried it once more and after about an hour there came a message like "A problem occured to HP Prime and it will switch off in 3 seconds". Then it switched off. If switched on again everything is normal, no message. So normally you will not see it.

So I think I have to program it step by step, e.g. using Gauss' or Romberg's method.

Best

Raimund


RE: Problems of HP prime with triple integrals? - parisse - 01-07-2021 07:23 PM

It's easier to compute the product of 3 integrals
Code:
int(exp(-x^2),x,0,1)*int(exp(y^2/2),y,0,2)*int(exp(1/z),z,1,4.0)