Triple Integral
04-26-2020, 06:53 PM
Post: #1
 lrdheat Senior Member Posts: 645 Joined: Feb 2014
Triple Integral
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...
04-28-2020, 01:43 PM
Post: #2
 Aries Member Posts: 157 Joined: Oct 2014
RE: Triple Integral
Hey lrdheat,
in the Nspire you can divide the result by pi and then use approxFraction (with an approximation of 0.001). Best,
Aries 04-28-2020, 08:27 PM
Post: #3
 Albert Chan Senior Member Posts: 1,589 Joined: Jul 2018
RE: Triple Integral
$$\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
04-29-2020, 06:15 AM
Post: #4
 parisse Senior Member Posts: 1,178 Joined: Dec 2013
RE: Triple Integral
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.
04-29-2020, 12:47 PM (This post was last modified: 04-29-2020 01:43 PM by Albert Chan.)
Post: #5
 Albert Chan Senior Member Posts: 1,589 Joined: Jul 2018
RE: Triple Integral
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 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
04-29-2020, 01:57 PM
Post: #6
 parisse Senior Member Posts: 1,178 Joined: Dec 2013
RE: Triple Integral
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.
04-29-2020, 02:59 PM
Post: #7
 lrdheat Senior Member Posts: 645 Joined: Feb 2014
RE: Triple Integral
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.
05-10-2020, 09:06 PM
Post: #8
 tom234 Member Posts: 92 Joined: Aug 2016
RE: Triple Integral
Can it do (A+B)^3 factorials?
Like:

Thank you
05-11-2020, 07:07 AM
Post: #9
 Aries Member Posts: 157 Joined: Oct 2014
RE: Triple Integral
(05-10-2020 09:06 PM)tom234 Wrote:  Can it do (A+B)^3 factorials?
Like:

Thank you

Yep, sure 05-11-2020, 10:35 AM
Post: #10
 tom234 Member Posts: 92 Joined: Aug 2016
RE: Triple Integral
(05-11-2020 07:07 AM)Aries Wrote:
(05-10-2020 09:06 PM)tom234 Wrote:  Can it do (A+B)^3 factorials?
Like:

Thank you

Yep, sure So your saying HP Prime Solve in the math menu can solve xy^2?
05-11-2020, 02:18 PM
Post: #11
 tom234 Member Posts: 92 Joined: Aug 2016
RE: Triple Integral
(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...
 « Next Oldest | Next Newest »

User(s) browsing this thread: 1 Guest(s)