HP Forums
Triple Integral - 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: Triple Integral (/thread-14896.html)



Triple Integral - lrdheat - 04-26-2020 06:53 PM

Integral from -2 to 2 (integral from x^2 to 4 (integral from -sqrt (y-x^2) to sqrt (y-x^2) of sqrt (x^2 + z^2))) dz dy dx

Stewart Calculus Book Alternative Edition 7E (soft cover) page 1020 gives this example with an answer of 128*pi/15

The Prime G2 gives a number of warnings, produced 176*pi/15 in CAS

In home, it gave an error of infinite result.

My TI Nspire CX II produces the decimal equivalent of 128*pi/15 (~26.8083)

My TI Nspire CAS emulator does not come up with the exact result, but does produce the correct decimal equivalent.

Prime has difficulty with this example...


RE: Triple Integral - Aries - 04-28-2020 01:43 PM

Hey lrdheat,
in the Nspire you can divide the result by pi and then use approxFraction (with an approximation of 0.001).

[Image: tripint.jpg]

Best,
Aries Wink


RE: Triple Integral - Albert Chan - 04-28-2020 08:27 PM

\(\large \int _2^2 \int _{x^2}^4 \int _{-\sqrt{y-x^2}}^{+\sqrt{y-x^2}} \sqrt{x^2+z^2}\;dz\;dy\;dx\)

I isolated the problem ...

XCas> w := sqrt(y - x^2)
XCas> expand(int(sqrt(x^2+z^2), z = -w .. w))

x^2*ln(sqrt(y)+sqrt(-x^2+y))/2 - x^2*ln(sqrt(y)-(sqrt(-x^2+y)))/2 + sqrt(y)*sqrt(-x^2+y)

XCas were evaluating the first term wrong. Converting to 2nd term, we have:

XCas> expand([sqrt(y)+w , 1] .* (sqrt(y)-w))
→ [x^2 , sqrt(y)-(sqrt(-x^2+y))]

These 2 integrals should gives the same answer (Wolfram Alpha returns 8.06581 for both)

XCas> f1 := simplify(int(int(x^2*log(sqrt(y)+w), y = x^2 .. 4), x = -2 .. 2))
→ (1920*ln(2)+1920*pi-1024)/225

XCas> f2 := simplify(int(int(x^2*ln(x^2) - x^2*ln(sqrt(y)-w), y=x^2 .. 4), x=-2 .. 2))
→ (1920*ln(2)+480*pi-1024)/225

XCas> float([f1, f2]) // f2 gives correct result
→ [28.1720021403 , 8.06580915733]

With the bug, result have excess of (f1-f2)/2. Remove it, we have area:

XCas> simplify(176*pi/15 - (f1-f2)/2)
→ 128*pi/15


RE: Triple Integral - parisse - 04-29-2020 06:15 AM

You can rewrite the initial integral using parity in z and get the right answer:
Code:
2*int(int(int(sqrt(x^2+z^2), z = 0 .. sqrt(y - x^2)),y,x^2,4),x,-2,2)
If you add parity in x, you will have to simplify the answer.
Code:
4*int(int(int(sqrt(x^2+z^2), z = 0 .. sqrt(y - x^2)),y,x^2,4),x,0,2)
Multiple definite integrals are (too?) hard to integrate symbolically because the inner integrals have parameters and that prevent checking antiderivative discontinuities checks.


RE: Triple Integral - Albert Chan - 04-29-2020 12:47 PM

I think it is a real bug.

XCas> f := x^2*log(sqrt(y) + sqrt(y-x^2))
XCas> g := int(f, y = x^2 .. 4)         // keep running this single integral, we get
XCas> subst(g, x=1.5)                     // either 3.76506896552 or 13.7445470629

XCas 1.4.9-57 (Win32) gives 2 different answer from the same integral, g = t1 ± t2 Huh
XCas> t1 := 4*x^2*ln(sqrt(-x^2+4)+2) - x^4*ln(abs(x))
XCas> t2 := -x^2*sqrt(-x^2+4) - x^4*ln(x^2)/4 + x^4*ln(abs(x^2+4*sqrt(-x^2+4)-8))/4

XCas> int(t1+t2, x=-2..2) * 1.     // 8.06580915733 ok
XCas> int(t1+t2, x= 0..2) * 2.     // 8.06580915733 ok
XCas> int(t1+t2, x=-2..0) * 2.     // 8.06580915733 ok
XCas> int(t1-t2, x=-2..2) * 1.     // 28.1720021403 bad
XCas> int(t1-t2, x= 0..2) * 2.     // 28.1720021403 bad
XCas> int(t1-t2, x=-2..0) * 2.     // 28.1720021403 bad

Edit: numerical confirmation from EMU71

>10 P=.000001
>20 DEF FNF(X,Y)=X^2*LN(SQRT(Y)+SQRT(Y-X*X))
>30 DEF FNG(X)=INTEGRAL(X*X,4,P,FNF(X,IVAR))
>40 DEF FNH(A,B)=INTEGRAL(A,B,P,FNG(IVAR))
>RUN
>FIX 6
>FNH(-2,2), FNH(-2,0)*2, FNH(0,2)*2
  8.065809           8.065809           8.065809


RE: Triple Integral - parisse - 04-29-2020 01:57 PM

I don't think so:
Code:

t1 := 4*x^2*ln(sqrt(-x^2+4)+2) - x^4*ln(abs(x));
t2 := -x^2*sqrt(-x^2+4) - x^4*ln(x^2)/4 + x^4*ln(abs(x^2+4*sqrt(-x^2+4)-8))/4;
int(t1-t2, x=-2.0..2.0) ;
int(t1-t2,x=-2..2)*1.0;
If you plot(t1-t2,x=-2..2) the value of about 28 is credible.
BTW, 1.4.9 is relatively old, if you want to report bugs in Xcas, please check with the latest version :-)

I have improved embedded assumptions checking for some simplifications, now the initial triple integral returns the correct exact value.


RE: Triple Integral - lrdheat - 04-29-2020 02:59 PM

Thanks!

I was a little more surprised at this problem’s failure in “home”. Does your adjustment produce a good result there?

Thanks for your fantastic work and interest in these areas.


RE: Triple Integral - tom234 - 05-10-2020 09:06 PM

Can it do (A+B)^3 factorials?
Like:

https://www.youtube.com/watch?v=dVs26SSUJSA

Thank you


RE: Triple Integral - Aries - 05-11-2020 07:07 AM

(05-10-2020 09:06 PM)tom234 Wrote:  Can it do (A+B)^3 factorials?
Like:

https://www.youtube.com/watch?v=dVs26SSUJSA

Thank you

Yep, sure Wink


RE: Triple Integral - tom234 - 05-11-2020 10:35 AM

(05-11-2020 07:07 AM)Aries Wrote:  
(05-10-2020 09:06 PM)tom234 Wrote:  Can it do (A+B)^3 factorials?
Like:

https://www.youtube.com/watch?v=dVs26SSUJSA

Thank you

Yep, sure Wink

So your saying HP Prime Solve in the math menu can solve xy^2?


RE: Triple Integral - tom234 - 05-11-2020 02:18 PM

(04-26-2020 06:53 PM)lrdheat Wrote:  Integral from -2 to 2 (integral from x^2 to 4 (integral from -sqrt (y-x^2) to sqrt (y-x^2) of sqrt (x^2 + z^2))) dz dy dx

Stewart Calculus Book Alternative Edition 7E (soft cover) page 1020 gives this example with an answer of 128*pi/15

The Prime G2 gives a number of warnings, produced 176*pi/15 in CAS

In home, it gave an error of infinite result.

My TI Nspire CX II produces the decimal equivalent of 128*pi/15 (~26.8083)

My TI Nspire CAS emulator does not come up with the exact result, but does produce the correct decimal equivalent.

Prime has difficulty with this example...