HP Forums
Integral hangs the physical Prime - 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 hangs the physical Prime (/thread-20012.html)



Integral hangs the physical Prime - lrdheat - 05-26-2023 02:35 AM

In CAS, Integral from -3 to 0 of 4root(x^2 + 1) * 5root(x + 2) hangs the Prime. Works fine in home, produces . 8841+. The graph is vertical at the root found at -2. Prime version 2.1.14730


RE: Integral hangs the physical Prime - C.Ret - 05-27-2023 06:14 AM

Hi,

Are you sure your physical HP Prime isn't full or its memory corrupted ?

I try the exact same integral on my HP Prime (Software: 2.1.14730 HardWare: C) and get no issue at all. Except I observe the following curious way of rewriting the expression when in CAS's exact mode:

[Image: attachment.php?aid=12162]

\( I=\int_{-3}^{0}\: \sqrt[4]{x^2+1}\cdot\sqrt[5]{x+2}\: \mathrm{d}x \)

\( I=\int_{-3}^{0}\: (x+2)^{1/5} \cdot(x^2+1)^{1/4}\: \mathrm{d}x \)

\( I=\int_{-3}^{0}\: (x+2)^{(5-4)/5} \cdot(x^2+1)^{1/4}\: \mathrm{d}x \)

\( I=\int_{-3}^{0}\: (x+2)^{1-4/5} \cdot(x^2+1)^{1/4}\: \mathrm{d}x \)

\( I=\int_{-3}^{0}\: (x+2)^1\cdot(x+2)^{-4/5} \cdot(x^2+1)^{1/4}\: \mathrm{d}x \)

\( I=\int_{-3}^{0}\: (x+2)^{-4/5}\cdot (x+2)^1 \cdot(x^2+1)^{1/4}\: \mathrm{d}x \)

\( I=\int_{-3}^{0}\: \frac{1}{(x+2)^{4/5}}\cdot (x+2)\cdot(x^2+1)^{1/4}\: \mathrm{d}x \)

\( I=\int_{-3}^{0}\: \frac{1}{\left((x+2)^{1/5}\right)^4}\cdot(x+2)\cdot(x^2+1)^{1/4}\: \mathrm{d}x \)

Why? Why? Why?
How is a negative root or n-th root defined?
Why has the //Function Symbolic Setup/Complex/: System - ON - OFF // no effect on what is plot?
Isn't the Hp Prime the best educational tools anymore?

Competitors actually are no more so bad :
[Image: attachment.php?aid=12163] or [Image: attachment.php?aid=12164]
Depending on how you extrapolate the negative roots or not!
Nice tool, this little french non-CAS calculator.


RE: Integral hangs the physical Prime - toml_12953 - 05-27-2023 10:17 AM

(05-26-2023 02:35 AM)lrdheat Wrote:  In CAS, Integral from -3 to 0 of 4root(x^2 + 1) * 5root(x + 2) hangs the Prime. Works fine in home, produces . 8841+. The graph is vertical at the root found at -2. Prime version 2.1.14730

Mine hangs, too. On HW D, latest OS, I get two identical messages with incorrect English:

Code:
Temporary replacing surd/NTHROOT by
fractional powers

and the machine hangs until reset.


RE: Integral hangs the physical Prime - C.Ret - 05-27-2023 01:45 PM

Hi,

I also get this message and the same more complex ones. Since a few software releases, having warning messages when performing some CAS operations is a common situation.

Just wait for the "work in progress - hourglass" icon in the upper-right-corner title bar to disappear. Then pressing the ENTER key to confirm you have read the warnings and that you are aware of the situation. The result is then displayed normally but may be inaccurate as explain.

Message may differ depending on your exact CAS configuration, in particular allowed complex results in CAS Setting is really prone to a lot of literature:

[Image: attachment.php?aid=12165]

Here, I suspect that these messages are due to attempt to integrate over a domain where the n-th root function is undefined (or at lest need a few extrapolation or extra job to be possible). One of the turn-around used by the HP Prime seems to be replacing n-th root functions by reciprocal exponentiation which may help in the symbolic integration process.

How and why, I have no idea.

Replacing the n-th root functions in the initial expression returns the exact same strange rewrite expression but without any warning text message.

Give it a try: \( I'=\int_{-3}^{0}\: (x^2+1)^{1/4}\cdot(x+2)^{1/5}\: \mathrm{d}x \) didn't produce any text warning message:
[Image: attachment.php?aid=12166]


RE: Integral hangs the physical Prime - Albert Chan - 05-27-2023 02:29 PM

(05-27-2023 06:14 AM)C.Ret Wrote:  \( I=\int_{-3}^{0}\: \sqrt[4]{x^2+1}\cdot\sqrt[5]{x+2}\: \mathrm{d}x \)

...

\( I=\int_{-3}^{0}\: \frac{1}{\left((x+2)^{1/5}\right)^4}\cdot(x+2)\cdot(x^2+1)^{1/4}\: \mathrm{d}x \)

Why? Why? Why?

Final rewrite is close, but not quite right. (integrand first term turned complex if x < -2)
Let y = x+2

if y > 0, then 5√y = (+y)^(1/5) = y / (y^4)^(1/5)
if y < 0, then 5√y = -(-y)^(1/5) = y / (-y)^(4/5) = y / (y^4)^(1/5)

Note that if y<0, (y^4)^(1/5) ≠ (y^(1/5))^4

On HP Prime old emulator, 2.1.14181 (2018 10 16), we don't have this (display?) bug.

Cas> int((4 NTHROOT (x^2+1)) * (5 NTHROOT (x+2)), x, -3, 0)

\(\displaystyle \int _{-3}^{0}\frac{5\cdot (x+2) \left(\left(x+2\right)^{2}-4\cdot (x+2)+5\right)^{\frac{1}{4}}}{5} \cdot \left(5\mbox{ NTHROOT }(x+2)\right)^{-4}\, dx\)      ✔

Cas> float(Ans)

0.8841671971


RE: Integral hangs the physical Prime - parisse - 05-27-2023 03:26 PM

Giac/Xcas works with fractional powers (complex-valued), not with NTHROOT. If you try to integrate an expression containing NTHROOT, the NTHROOT is replaced with a fractional power, then the CAS tries to find an antiderivative, after that it replaces back fractional powers by NTHROOT, assuming that the antiderivative for a branch is valid for another branch choice. This is the best way I know to find antiderivatives if fractional powers are involved. With an updated CAS inside the Prime, I do not see issues on the emulator for the integral of the original post.

In addition, fractional powers x^(p/q) are rewritten as (x^(1/q))^p with 0<=p<q, in order to have generalized polynomials in x^(1/q) (simplifications in a CAS always rewrite expressions in terms of a multivariate rational fraction with the lowest possible number of generalized variables, that should be algebraically independant).

As I already commented many times, if you want an approximate value for an integral inside CAS, I recommend to enter one boundary as an approx number, that will immediatly call the adaptive quadrature algorithm, avoiding all kind of possible issues with symbolic rewriting. If you are not comfortable with approx/exact representation of numbers and numeric/CAS differences, it's probably better to stay in Home.


RE: Integral hangs the physical Prime - C.Ret - 05-28-2023 03:19 PM

Thanks parisse for this input.

This explains the mystery around the strange way to rewrite expressions and why different versions of CAS reorder expressions differently as point out by Albert Chan.

I take this opportunity to salute the work done to produce this extraordinary calculator. I still have so much fun using it. Whether it is to do a little math or to express graphical and statistical results. Pleasure all the more since the last update, I have not encountered any crashes of the calculator or disconnections of the Connectivity Kit.

That's why I wanted to respond to Irdheat, because its integration does not cause any problems on my machine.

By the way, to prepare the answers above, everything worked well and I was able to further explore this incredible machine.
And the last screen capture, obtained without a warning message, allowed me to understand what is happening and to have rigorous answers to my questions.
It is true that analysis is not my privileged domain, I am a bit out of my garden here.

Once again, thanks to the entire team that produces and maintains the HP Prime at its best level.


RE: Integral hangs the physical Prime - lrdheat - 05-28-2023 04:27 PM

The Prime is indeed, quite a device!

I have another question concerning a limit calculation:

When calculating the limit as x approaches pi/4 for (tan(x)-1)/(x-pi/4), I expect to get an answer of 2, but the CAS shows 0. Home shows 2 if I use an x very close to pi/4. Can you figure out what I might be doing incorrectly?


RE: Integral hangs the physical Prime - parisse - 05-28-2023 04:51 PM

This is indeed a bug that was fixed in Giac/Xcas a few months ago. Should be fixed in a future firmware update.