HP Forums

Full Version: CAS and exponents issues
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
While testing latest public beta, I have noticed some strange behaviour in CAS mode. Since I have no actual calculator with CAS abilities, this may be expected, still I do not believe any person will be comfortable with...

For instance:

\(\sqrt{50}=\sqrt{2} \cdot 5\)
\(50^{1/2} = 5 \cdot \sqrt{2}\)

However:

\(2^{100} \cdot 2^{200}=203703...\), instead simply \(2^{300}\)
\(2^{21} \cdot 9^{1/5}=9^{1/5} \cdot 2097152\), instead simply \(2^{21} \cdot 3^{2/5}\)
\(2^{1/3} \cdot 3^{1/3}=2^{1/3} \cdot 3^{1/3}\), instead simply \(6^{1/3}\)
\(9^{1/5}=9^{1/5}\), instead simply \(3^{2/5}\)
\(3^{2/5}=(3^{1/5})^2\)...

And similar. I have found no CAS settings in beta Prime simulator regarding handling exponents more "naturally", regardless automatic simplicity level settings, or even using simplify() function.

The most problematic is still displaying extremely large integers (similarly with negative exponents exactly the same reciprocal), which is quite problematic with more complex expressions.
You can use ifactor to change 203703..... back to \(2^{300}\). I suppose that the calculator cannot immediately know whether you want the full representation, or the answer expressed as a power.

Incidentally, does anyone know how to get the calculator to change \(({3^{1/5}})^2\) into \(3^{2/5}\)?

Nigel (UK)
The CAS in theory should mimic human behavior in solving math problems, in this case expressions. In upper particular cases, that is not consistent.

For instance:
\(2^{100} \cdot 2^{200} + 9^{1/5}=9^{1/5} + 203703...\)
\(2^{100} \cdot 2^{200} \cdot 9^{1/5}=203703...\cdot 9^{1/5} \)

WolframApha return results in the same manners, except it handles \(9^{1/5}\) correctly, which indicates that problem is in the CAS, or missing appropriate settings.

Multiplication issue with the same exponent is specific to the Prime.
The \(3^{2/5}=(3^{1/5})^2\) is also specific to the Prime.
Etc...
(09-27-2018 11:30 AM)sasa Wrote: [ -> ]WolframApha return results in the same manners, except it handles \(9^{1/5}\) correctly, which indicates that problem is in the CAS, or missing appropriate settings.
The problem is not in the various CAS but in your expectations of what a CAS shoud do: "The CAS in theory should mimic human behavior in solving math problems". A CAS is a software that can solve some symbolic problems, but it does not necessarily handle and store objects like a human does. Integers and rationals are always stored as integers or irreducible fractions of integers in a CAS, and never as expressions.
(09-27-2018 11:53 AM)parisse Wrote: [ -> ]The problem is not in the various CAS but in your expectations of what a CAS shoud do...

Not at all. This is almost formal definition of CAS...

In any event, as someone made CAS version for HP, please explain what is exact problem with multiplication with numbers have the same exponents on the Prime.
(09-27-2018 12:04 PM)sasa Wrote: [ -> ]Not at all. This is almost formal definition of CAS...
CAS means computer algebra system. I don't understand where you see that it should store data and compute like humans.
I think one big problem is that some people who have never used a CAS expect they can use a CAS without learning a little bit how a CAS can store data and what it can compute.

Quote:In any event, as someone made CAS version for HP, please explain what is exact problem with multiplication with numbers have the same exponents on the Prime.
I don't understand your question.
If I do not mistake, you are mathematician Bernard Parisse, who have made several revisions of CAS for HP, including current for the Prime. If not, please sorry for identity confusion.

I have reported concrete expressions where Prime failed. This one aims to
\(2^{1/3} \cdot 3^{1/3}=2^{1/3} \cdot 3^{1/3}\), instead simply \(6^{1/3}\)

This is elementary example were CAS in Prime fails...

As I'm one who made lite version of CAS three decades ago from ground for my own pleasure, I'm hardly novice. Nowadays CAS used in calculators and desktop computers are quite complex that even slightly change in code, step orders and settings in general may bring such inconsistence even with elementary expressions...

And that is the whole point - I have reported noticed issues, nothing more and nothing less.
(09-28-2018 06:48 AM)sasa Wrote: [ -> ]If I do not mistake, you are mathematician Bernard Parisse, who have made several revisions of CAS for HP, including current for the Prime. If not, please sorry for identity confusion.

I have reported concrete expressions where Prime failed. This one aims to
\(2^{1/3} \cdot 3^{1/3}=2^{1/3} \cdot 3^{1/3}\), instead simply \(6^{1/3}\)

This is elementary example were CAS in Prime fails...
Why do you say it fails? The CAS is not using your prefered representation but there is nothing wrong.
Please note that simplify(2^(1/3)*3^(1/3)-6^(1/3)) returns 0, i.e. you will not accidentally divide by an expression that does not look like 0 but is 0, and that is what really matters when you run computations. If you simplify(2^(1/3)*3^(1/3)), it remains as is on the Prime because HP does not want to see rootofs, but in Xcas it will be rewritten as a rootof, i.e. as an element of an algebraic extension of Q that contains 2^(1/3) and 3^(1/3), that's the best way I know to make sure you don't miss 0 simplifications.

Quote:As I'm one who made lite version of CAS three decades ago from ground for my own pleasure, I'm hardly novice. Nowadays CAS used in calculators and desktop computers are quite complex that even slightly change in code, step orders and settings in general may bring such inconsistence even with elementary expressions...
Can we test your lite version of CAS somewhere?
It is probably not implemented with the same philosophy as Xcas. Xcas was primarily implemented to run big computations that a human would never make by hand (i.e. mostly big integers and polynomials computations).
(09-28-2018 11:13 AM)parisse Wrote: [ -> ]Please note that simplify(2^(1/3)*3^(1/3)-6^(1/3)) returns 0, i.e. you will not accidentally divide by an expression that does not look like 0 but is 0, and that is what really matters when you run computations. If you simplify(2^(1/3)*3^(1/3)), it remains as is on the Prime because HP does not want to see rootofs, but in Xcas it will be rewritten as a rootof, i.e. as an element of an algebraic extension of Q that contains 2^(1/3) and 3^(1/3), that's the best way I know to make sure you don't miss 0 simplifications.

(09-28-2018 11:13 AM)parisse Wrote: [ -> ]Xcas was primarily implemented to run big computations that a human would never make by hand (i.e. mostly big integers and polynomials computations).

Totally agree with that.

I can also add, we can't demand a CAS to give a representation of a calculation exactly we'd like. Sometimes, we have to do manually some steps.
That's why we have several functions to simplify, factor an expression or solve an equation.
(09-28-2018 11:13 AM)parisse Wrote: [ -> ]Can we test your lite version of CAS somewhere?

Eventually yes, if I manage to find old particular backup CD.

Quote:It is probably not implemented with the same philosophy as Xcas. Xcas was primarily implemented to run big computations that a human would never make by hand (i.e. mostly big integers and polynomials computations).

IIRC, the main reason I started with was to spare time calculating higher order derivatives, which required enormous time and concentration for human and maximum simplification between steps. Another was to make 3D graph with users free formula input, making maximum simplification in order to make optimal path for execution, which again IIRC, was only between 50-100% slower comparing hard coded maximally simplified formula (compiled machine code). It had several objects handled integers, fractions, exponents and rational numbers, constants, variables and functions.
(09-28-2018 11:13 AM)parisse Wrote: [ -> ]Why do you say it fails? The CAS is not using your prefered representation but there is nothing wrong.
Please note that simplify(2^(1/3)*3^(1/3)-6^(1/3)) returns 0, i.e. you will not accidentally divide by an expression that does not look like 0 but is 0, and that is what really matters when you run computations. If you simplify(2^(1/3)*3^(1/3)), it remains as is on the Prime because HP does not want to see rootofs, but in Xcas it will be rewritten as a rootof, i.e. as an element of an algebraic extension of Q that contains 2^(1/3) and 3^(1/3), that's the best way I know to make sure you don't miss 0 simplifications.

Elementary simplification fail, in this case. As well, in this case, rootofs is not needed...
However yes, I understand that approach and methodology is quite different.

For instance, let take mentioned high order derivative, as example:
diff(acos(x),x,6)

On online Xcas/Giac it returns quite long expression without simplification which may indicate that there is no simplification between steps. With simplification and factoring it gives shorter expression, which is still bit more complex than wolfram alpha offer at once, even both appears to be essentially correct.

All in all, I believe all is clear - different methodology made quite a difference in simplicity of the final result, while it essentially remain correct.
I agree that it would be nice to have some rewriting command to collect exponents 2^(1/3)*3^(1/3) as 6^(1/3) but this is not a simplification failure : as I said simplify will correctly detect that 2^(1/3)*3^(1/3)-6^(1/3) is 0 and that is what is important.

As for diff(acos(x),x,6), there is intermediate rewrite between each derivative, otherwise diff(acos(x),x,30) would run forever, but there is no factorization, I don't think it accelerates computations for generic expressions (factorization may be costly, much more than rewriting an expression as an irreductible fraction).

You are of course free to think differently, but implementing is much harder than speaking, that's why I was curious to see what your CAS was really capable to do.
It would be definitely nice touch for simplification and factorization on last step.

For instance:
diff(((1+x^2)/2)*tan(x),x)

On Prime and online Xcas/Giac, returns:
(2*x/2)*tan(x)+((1+x^2)/2)*(1+tan(x)^2)

I do not insist on any of this, simply point some issues may confuse users, especially low grade students.
(10-03-2018 08:34 AM)sasa Wrote: [ -> ]It would be definitely nice touch for simplification and factorization on last step.

Your non-simplified diff(...) result actually look pretty good to me.
It clearly shown what is done to the expression (product rule).

diff(((1+x^2)/2)*tan(x),x) => (2*x/2)*tan(x)+((1+x^2)/2)*(1+tan(x)^2)

If factorization or simplification (whatever that meant) were needed, do it in separate step.
---

About what is simplified form, it is very subjective.

Is 2^10 simpler than 1024 ? How about 2^20 vs 1048576 ?

Is 6^(1/3) really simpler than factorized 2^(1/3)*3^(1/3) ?
If true, why is 9^(1/5) not simpler than 3^(2/5) ?

Assuming 3 "simpler" than 9, 1/5 "simpler" than 2/5, who win the simpler race ?
(10-03-2018 08:34 AM)sasa Wrote: [ -> ]It would be definitely nice touch for simplification and factorization on last step.

For instance:
diff(((1+x^2)/2)*tan(x),x)

On Prime and online Xcas/Giac, returns:
(2*x/2)*tan(x)+((1+x^2)/2)*(1+tan(x)^2)

I do not insist on any of this, simply point some issues may confuse users, especially low grade students.

This is the choice made by TI, not mine. I am a teacher, I want students to learn something.
Reference URL's