HP Forums
Integral Hangs - 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 (/thread-18000.html)

Integral Hangs - lrdheat - 02-05-2022 06:15 PM

Integral of (1-e^-2*x)/(1+e^-4*x) hangs on physical G2 Dec 2021 OS. TI Nspire, CASIO Classpad immediately produces answer…

RE: Integral Hangs - robmio - 02-06-2022 06:38 AM

(02-05-2022 06:15 PM)lrdheat Wrote:  Integral of (1-e^-2*x)/(1+e^-4*x) hangs on physical G2 Dec 2021 OS. TI Nspire, CASIO Classpad immediately produces answer…

My HP PRIME G2 (physical calculator) provides this answer (2021 12 02).

RE: Integral Hangs - lrdheat - 02-06-2022 04:33 PM

Further investigation…a very complicated answer is produced if CAS is in minimum or none for simplification. Attempting to simplify the resulting answers produces a hung calculator! The answers produced by the CASIO and TI are concise, and demonstrate that this can be accomplished. My 2 cents: The Prime needs to address the simplification issues. I do not understand why one has to even choose between maximum, minimum, and none in the CAS settings. If there IS a good reason, use of the simplify tab on the resulting answer should produce a much more concise result, and certainly should not hang.

RE: Integral Hangs - parisse - 02-08-2022 06:56 PM

Unfortunately there is no simplification algorithm, only heuristics.
This integral is solved on the Prime by expanding the exponentials, resulting in a rational fraction of exp(-x), with a denominator of degree 4.
It misses the fact that it can also be expressed as a rational fraction of exp(-2x) with a denominator of degree 2. If you are not satisfied with the CAS answer (whcih is perfectly correct), you can help the CAS
subst('integrate((1-exp(-2*x))/(1+exp(-4*x)),x)',x=t/2) => p; subst(p,t=2*x)
BTW, it's generally a bad idea to try to simplify blindly the result of an integral.
The CAS golden rule for an optimal human/computer cooperation is: the human is the brain and the calc does the heavy computations.

RE: Integral Hangs - lrdheat - 02-09-2022 03:34 AM

Still having surprises…in CAS, definite integral from -4 to 1 of (x^2 +2*x)/3Root(x^3 +3*x^2 +1) does not produce a symbolic result, has a problem with the undefined point at ~-3.1 and comes up with -1.57909212594

The CASIO CLASSPAD 400 comes up with a symbolic result of (-225^1/3)/2 + (25^1/3)/2 (equates to -1.579092129).

Why does the Prime have difficulty? (All this being said while recognizing the Prime as a superior platform…)

RE: Integral Hangs - lrdheat - 02-09-2022 04:42 AM

TI Nspire had a similar difficulty as the Prime, threw a warning sign and produced a numerical approximation of -1.57909

RE: Integral Hangs - parisse - 02-10-2022 07:39 AM

What kind of third root did you take?
f:=integrate((x^2 +2*x)/(x^3 +3*x^2 +1)^(1/3),x)
returns ((x^3+3*x^2+1)^(1/3))^2/2.
But at x=-4, the argument of the ^(1/3) is negative and this returns a complex number.

RE: Integral Hangs - roadrunner - 02-12-2022 03:22 PM


(02-08-2022 06:56 PM)parisse Wrote:  subst('integrate((1-exp(-2*x))/(1+exp(-4*x)),x)',x=t/2) => p; subst(p,t=2*x)

works on xcas, but on the prime i get this error message:

"p:=subst('∫((1-e^(-2*x))/(1+e^(-4*x)),x)',x = (t/2))
Error: Bad Argument Value","∫((1-e^(-2*t/2))/(1+e^(-4*t/2)),t/2)
Error: Bad Argument Value"

Is this because of:

a. Me doing something wrong;
b. A bug;
c. Some cas feature turned off in the prime for some reason;
d. Some combination of the above;
e. Something else?


RE: Integral Hangs - roadrunner - 02-12-2022 03:43 PM

This slightly modified version works on the prime:

(p:=(1/2)*∫(subst(((1-e^(-2*x))/(1+e^(-4*x))),x = (t/2)),t)),subst(p,t = (2*x))


RE: Integral Hangs - lrdheat - 02-12-2022 06:05 PM

With the understanding that the audience for the Prime is the education market first, I would think that there would be a greater effort in producing more friendly answers in cases where it has been demonstrated that it can be done. I understand that the human, ideally is the brain, that the calculator is doing the heavy work. I do think that a student should not have invest time and effort to try to figure out how to manipulate an answer, or pose the problem initially to get a friendly result when it has been demonstrated on other handheld platforms that a concise answer is possible. I also am surprised at the thought that one should not try to use simplification on such an answer from an integration…what then is the purpose of offering the simplification tab? I guess I need to say that it is clear that the Prime is an amazingly powerful device!

RE: Integral Hangs - parisse - 02-15-2022 01:40 PM

If it was easy to find an antiderivative and return the most simplified form for any integrand, every CAS would certainly implement it! But it's hard and it's not about a few inputs, you can get a more precise idea by looking here https://www.12000.org/my_notes/CAS_integration_tests/reports/summer_2021/inch1.htm#x2-30001.2 (70 000 inputs)
There is also perhaps a wrong assumption : some people believe that a "good" CAS should solve the math for them (and that's probably a consequence of the fact that some CAS are optimized to solve US textbook inputs). But it's wrong! You must learn maths and you must learn a little bit about the CAS you are using in order to run it well. I mean, you must have some understanding on what kind of problems a CAS can solve, have some idea on what algorithms are involved (e.g. for integration, know about change of variables, that rational fractions can be integrated by partial fraction decomposition assuming the denominator can be factored, etc.), have solved a few by hand (when calculations are easy to do by hand of course, like e.g. cos(x)/(sin(x)^2-4)), before you can really take advantage of a CAS to do more complex computations for you. Then you can see when and how you can help the CAS if it does not choose the best strategy.

@Bernard re: Xcas - Guenter Schink - 02-15-2022 08:38 PM

Bernard, I found a mistake in the Xcas documentation.
the sample provided in the "euler phi" function description is wrong.

euler phi
the sample says
Quote:In other words E={2,4,5,7,8,10,11,13,15,16,17,19} is the set of integers less than 21 and coprime with 21.

But "1" and "20" are missing while "7" and "15" are included wrongly.

Sorry for using this forum, but I failed to register and login at your Xcas Forum.
I hope you don't mind.

It's a fantastic documentation, I believe.


RE: Integral Hangs - parisse - 02-16-2022 04:34 PM

Thanks, this is now fixed in the latex source file.

RE: Integral Hangs - Albert Chan - 02-18-2022 02:28 PM

(02-12-2022 03:22 PM)roadrunner Wrote:  works on xcas, but on the prime i get this error message:

"p:=subst('∫((1-e^(-2*x))/(1+e^(-4*x)),x)',x = (t/2))
Error: Bad Argument Value","∫((1-e^(-2*t/2))/(1+e^(-4*t/2)),t/2)
Error: Bad Argument Value"

It work if we replace symbol ∫ with words on the emulator

CAS> p:=subst('integrate((1-e^(-2*x))/(1+e^(-4*x)),x)',x = t/2)


CAS> expand(p(t=2x))

-1/2*atan(e^(2*x)) + 1/4*ln((e^(2*x))^2+1)

Or, simpler just map e^(n*x) with (e^x)^n

CAS> integrate(texpand((1-e^(-2*x))/(1+e^(-4*x))),x)

-1/2*atan((e^x)^2) + 1/4*ln((e^x)^4+1)

RE: Integral Hangs - roadrunner - 02-18-2022 07:29 PM

Thanks Albert, that works.