HP Forums
[BUG] CAS looping forever - 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: [BUG] CAS looping forever (/thread-854.html)



[BUG] CAS looping forever - Tugdual - 03-08-2014 06:13 PM

Trying to integrate using radians:
$$\int_{3}^{5}\tan (\sin \left ( x \right )+\ln \left ( \left | x \right | \right ))dx$$

Home returns 2.067...
CAS loops forever on emulator and freezes the physical device.

Edit: Epsilon was super small, like 1e-12 which is the default value. I tried to change Epsilon to 0.01 and got a message "Restoring epsilon to 1e-6 from 0.01". Loops again...


RE: [BUG] CAS looping forever - Mark Hardman - 03-08-2014 07:07 PM

(03-08-2014 06:13 PM)Tugdual Wrote:  Trying to integrate using radians:
$$\int_{3}^{5}\tan (\sin \left ( x \right )+\ln \left ( \left | x \right | \right ))dx$$
Home returns 2.067...
CAS loops forever on emulator and freezes the physical device.

Just taking the indefinite integral of \(\int \tan \left ( \sin \left ( x \right ) \right ) dx\) produces a result that is 122,286 characters long!

integrate((-5*sin(x)+6*e^(cos(x)*((cos(x))²-(sin(x))²-1)/((cos(x))²+(sin(x))²)+sin(x)*2*cos(x)*sin(x)/((cos(x))²+(sin(x))²))*sin(
...<SNIP>...
+(sin(x))²)))²-216*(cos(x))²*(sin(x))²+132*cos(x)^4+132*sin(x)^4+24*(cos(x))²-24*(sin(x))²+2),x)

Impressive if the result is correct.

Mark Hardman


RE: [BUG] CAS looping forever - parisse - 03-08-2014 07:33 PM

It does not have an antiderivative that can be expressed with elementary function therefore you must do numeric integration using approx boundaries. I probably should add a check in the autosimplification function, if you set it to none you get the unevaluated "exact" answers without problems.


RE: [BUG] CAS looping forever - Tugdual - 03-08-2014 08:21 PM

(03-08-2014 07:33 PM)parisse Wrote:  you must do numeric integration using approx boundaries.
Hi Parisse, it was indeed my intention to look for an approximation. How do you do "an integration using approx boudaries"? Do you mean Home version?


RE: [BUG] CAS looping forever - Mark Hardman - 03-08-2014 08:46 PM

(03-08-2014 08:21 PM)Tugdual Wrote:  How do you do "an integration using approx boudaries"?

He means that you should specify real values for the limits of integration:

$$\int_{3.0}^{5.0}\tan (\sin \left ( x \right )+\ln \left ( \left | x \right | \right ))dx$$

This gives the same approximation you get in Home mode (2.06725680644).

Mark Hardman


RE: [BUG] CAS looping forever - jebem - 03-08-2014 11:09 PM

I get the same results here, when using approximate (real) boundaries.
However the time to compute the same result is quite different between Home and CAS environments:
Home takes about 2 seconds, and CAS answer is instantaneous !
So the Prime gives the same apparent result, but it is using different algorithms, where one takes significant more time than the other?