HP Forums
Integral NA in home, CAS - 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: Integral NA in home, CAS (/thread-5787.html)



Integral NA in home, CAS - lrdheat - 02-28-2016 10:06 PM

I can't get int (sqrt (1+x^(-2/3)) from -1 to 1 in CAS, and surpringly, home, no matter how I enter the function. In home, I get invalid input. In CAS, I get a complex number result. It's magnitude does not agree with the true answer of 2(2*sqrt(2) - 1) in the case of nSpire, ~3.657 on Classpad 400.

Is this doable on the Prime?


RE: Integral NA in home, CAS - cyrille de brébisson - 02-29-2016 06:07 AM

Hello,

It probably has something to do with the fact that sqrt(1+x^(-2/3)) is not defined from -1 to 0 in R (it is in C)...

Home definitely can not calculate integrals with complex numbers. I do not know about the CAS.

Cyrille


RE: Integral NA in home, CAS - lrdheat - 02-29-2016 06:37 AM

The only way to do it in home is the way I do on non CAS machines...I calculate from -1 to -1 EE-12 + from 1 EE -12 to 1.

The exact nSpire result is correct as far as I can tell, confirmed by the above, and by decimal Classpad result...


RE: Integral NA in home, CAS - parisse - 02-29-2016 06:39 AM

int (sqrt (1+x^(-2/3)),x,0,1) is 2*sqrt(2)-1, but I don't see why int (sqrt (1+x^(-2/3)),x,-1,0) should be the same. The nspire might be wrong, why should the Prime automatically be wrong if both calc disagree?


RE: Integral NA in home, CAS - compsystems - 02-29-2016 12:46 PM

https://www.wolframalpha.com/input/?i=int+(sqrt+(1%2Bx%5E(-2%2F3)),x,-1,1)

= 2*sqrt(2)-1*i ~= 2.82842712475-i

https://www.wolframalpha.com/input/?i=int+(sqrt+(1%2Bx%5E(-2%2F3)),x,0,1)

= 2*sqrt(2)-1 ~= 1.8284


RE: Integral NA in home, CAS - parisse - 02-29-2016 01:23 PM

For the part in -1..0, the correct answer is 1-i, with the complex definition of the fractionnal power. If you add the 0..1 part, you get 2*sqrt(2)-i as stated by compsystem.
If you take the nthroot instead of the complex fractional power on -1..0, then x "power" -2/3 is negative and smaller than -1, adding 1 will return a negative number, taking the square root a pure imaginary, and the integral is
int (sqrt (1-(-x)^(-2/3)),x,-1,0)=i
Therefore the values reported by lrdheat on the nspire and classpad are wrong, either there is a bug on these calcs, or lrdheat made an input error.
Just curious: where does this integral come from? If it's from a textbook, I really wonder what the author wanted to check...


RE: Integral NA in home, CAS - akmon - 02-29-2016 02:09 PM

When I type this integral from -1 to 1 in my calculator, the result is 1,01143+0,31698*i. ¿¿¿???


RE: Integral NA in home, CAS - parisse - 02-29-2016 02:16 PM

The "exact" answer from the Prime is not correct in the negative x direction, it's just too complicated to track the algebraic branches from fractional powers and sqrt correctly during symbolic integration. The numeric answer can be obtained by splitting in 2 parts
int (sqrt (1+x^(-2/3)),x,-1.0,0)+int (sqrt (1+x^(-2/3)),x,0,1.0)
If I keep it in one integral, I get undef, probably because of the singularity at x=0. This is really a hard integral, that's why I wondered where it comes from.


RE: Integral NA in home, CAS - Tim Wessman - 02-29-2016 03:38 PM

(02-29-2016 01:23 PM)parisse Wrote:  and the integral is
int (sqrt (1-(-x)^(-2/3)),x,-1,0)=i
Therefore the values reported by lrdheat on the nspire and classpad are wrong, either there is a bug on these calcs, or lrdheat made an input error.

If you assume real only and no complex range, is it correct? Those seem to silently ignore any complex range and force real by default.


RE: Integral NA in home, CAS - parisse - 02-29-2016 04:25 PM

You can't stay in the real domain, because the argument of the sqrt is negative. For example if x=-0.5, (-x)^(-2/3) is 2^(2/3)>1 hence 1-(-x)^(-2/3) is negative.


RE: Integral NA in home, CAS - Han - 02-29-2016 04:30 PM

(02-29-2016 01:23 PM)parisse Wrote:  For the part in -1..0, the correct answer is 1-i, with the complex definition of the fractionnal power. If you add the 0..1 part, you get 2*sqrt(2)-i as stated by compsystem.
If you take the nthroot instead of the complex fractional power on -1..0, then x "power" -2/3 is negative and smaller than -1, adding 1 will return a negative number, taking the square root a pure imaginary, and the integral is
int (sqrt (1-(-x)^(-2/3)),x,-1,0)=i
Therefore the values reported by lrdheat on the nspire and classpad are wrong, either there is a bug on these calcs, or lrdheat made an input error.
Just curious: where does this integral come from? If it's from a textbook, I really wonder what the author wanted to check...

Perhaps I am misreading your post, but for \( x \in [-1,0] \), \( x^{-2/3} \) would be positive due to the 2 in the exponent (if not using the complex fractional power). These other calculators are computing the integral as follows:

https://www.wolframalpha.com/input/?i=int+(sqrt+(1%2B1%2F(cuberoot(x)%5E2)),x,-1,1)

Their algorithms may possibly be using the even-ness of the integrand since the integral is an improper integral.


RE: Integral NA in home, CAS - parisse - 02-29-2016 05:56 PM

Indeed, I see your point. Then as you said, it's fairly easy to use the fact that the function is even and get the real value.
For a more general function, it is a good idea to split the interval at the point where the fractional power is singular.
int(sqrt (1+(x^2)^(-1/3)),x,-1,0)+int(sqrt (1+(x^2)^(-1/3)),x,0,1)


RE: Integral NA in home, CAS - lrdheat - 02-29-2016 06:41 PM

I was thinking same thing as Han ("2" exponent)...indeed, Prime plots function as symmetrical around y axis, but comes up with NAN for area under curve from -1 to 1. The question is whether the integral is undefined or not due to f(X) at X=0.

I believe the problem came from my old calculus book from college circa ~1970. The book is at work...I'll check it later today, but I think it came up with an approximate decimal answer.

I find that the textbooks offer a range of problems for testing CAS's. I'm amazed at their capabilities!


RE: Integral NA in home, CAS - parisse - 02-29-2016 07:00 PM

I'm adding code to automatically split the interval so that
int(sqrt (1+(x^2)^(-1/3)),x,-1,1)
returns the expected answer.
You can check at http://www-fourier.ujf-grenoble.fr/~parisse/xcasen.html. (If you have already visited this page, make sure to empty your browser offline download cache)


RE: Integral NA in home, CAS - lrdheat - 03-01-2016 12:00 AM

Thanks parisse

The book is College Calculus With Analytic Geometry by Protter/Morrey published by Addison-Wesley in 1970. It indeed was a in the problem set in the chapter dealing with improper integrals. This is an integral that is found to be convergent when split into 2 integrals evaluated from -1 to 0 and from 0 to 1.

The answer was supplied in exact form, 2*((2*sqrt 2)-1).