HP Forums

Full Version: Testing xCAS version 1.2.3-9 (2017)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
News: xCAS version 1.2.3-9. (2017)


Thank Mr. Bernard Parisse for his great development of an expert system in computational algebra.

My native language is not English, I use a translator, maybe that's why the conversations sound a bit harsh or wrong.

I notice some differences with GeoGebra (CAS view), of course this is also the version of hp-prime (the latter as it is not synchronized with the latest versions of XCAS) =(

Bernard his great work is present in GeoGebra that is one of the most used software in the world and its growth is exponential. Thousands of downloads per day, thousands of math teachers using the CAS view. =)

I Find a small difference xCAS-GeoGebra, Why does it happen?
a + (b + c) == (a + b) + c ->

[Image: testXCAS_image00.png]

There is denesting of sums without parenthesis (or with left parenthesis since it's the same) but not with right parenthesis.
== checks that the internal representation of the symbolic objects are the same. Therefore d1==d2 returns false
Why the XCAS engine over GeoGebra give another output (the GG authors) are modifying the xCAS?
no, but they call their own parser before calling the giac parser.
I was doing something somewhat related to this topic, in CAS, which resulted in the warning message below. Is this perhaps related?

Warning: the test a==b is performed by checking that the internal representation of regroup(a-b) is not 0. Therefore a==b may return false even if a and b are mathematically equal, if they have different internal representations.
You can explicitly call a simplification function like simplify(a-b)==0 to avoid this.
Warning, argument is not an equation, solving 0=0

This warning only pops up the first time my statement was processed, afterwards only the "Warning, argument is not an equation, solving 0=0" shows up.

In my case, it was this snippet, which produces different results when used on the EMU and HC:
(interesting: regroup(a,b) is a working, but uncatalogued, (internal), prime CAS command.)


solve(subst(EXPR(a),x = 60),y);  ==> {-110} on HC and [[]] on EMU
I get {-110} on the emulator with expr (lowercase).
I wonder why I don't seem to get that. I have tried both upper and lower case expr().
(Lower case expr() gets changed to upper case EXPR() in the CAS history).

*[Weird (update)]*
I just used [shift] [esc] to clear the CAS history, and now, I'm also getting:

solve(subst(expr(a),x = 60),y) ==> {-110} on the emulator.

Prior to that, for the several times I tried it, the response was [[]]. I wonder what that was all about? (Why or did) clearing the history have anything to do with it?

Yesterday, I was doing a lot of work with various commands, and the prime began returning error messages for things I know worked earlier. I finally thought to do a calculator 'reset', and everything since then began working properly, once again. Today, I was using the above example, many times, and only getting the empty matrix back. The same entry on the physical prime consistently returned {-110}.

Incidentally, a companion problem ALWAYS worked on the emulator before and after clearing the CAS history:

solve(subst(expr(a),y = 23),x) ==> {-13/2}

I'm wondering now, if the x or y variables may have had some previous content (before I cleared the CAS history), and my example might have failed due to that.

It's probably just a problem related to the emulator on my end. I'm sorry about that.
Are 'x' and 'y' purged in the CAS view? Are there existing exported or app variables named 'x' and 'y'? Without clearing the history, using restart will do the job of "starting fresh"
I can't be sure that there wasn't something in the CAS variables x or y. (I don't think there was). Also, I don't think x or y (lower case vars) are legal in the apps. I had to reset the emulator yesterday, due to other unrelated issues, which kind of helps confirm that vars x and y were symbolic.

Since it was the var y being solved for in the troublesome statement, maybe that one was the issue. It's working now, so I may never find out definitively.
I would like with the help of you all, create a similar tutorial to CAS sympy for Python

There are many undocumented commands and functions, for example

regroup(x+3*x+(5*4/x)) -> 4*x+20/x =)

Quote:Equals signs
Another very important consequence of the fact that CAS SymPy does not extend Python syntax is that = does not represent equality in SymPy. Rather it is Python variable assignment. This is hard-coded into the Python language, and SymPy makes no attempts to change that.

You may think, however, that ==, which is used for equality testing in Python, is used for SymPy as equality. This is not quite correct either. Let us see what happens when we use ==.

Run code block in SymPy Live
>>> x + 1 == 4
Instead of treating x + 1 == 4 symbolically, we just got False. In SymPy, == represents exact structural equality testing. This means that a == b means that we are asking if a=ba=b. We always get a bool as the result of ==. There is a separate object, called Eq, which can be used to create symbolic equalities

Run code block in SymPy Live
>>> Eq(x + 1, 4)
Eq(x + 1, 4)
There is one additional caveat about == as well. Suppose we want to know if (x+1)2=x2+2x+1(x+1)2=x2+2x+1. We might try something like this:

Run code block in SymPy Live
>>> (x + 1)**2 == x**2 + 2*x + 1
We got False again. However, (x+1)2(x+1)2 does equal x2+2x+1x2+2x+1. What is going on here? Did we find a bug in SymPy, or is it just not powerful enough to recognize this basic algebraic fact?

Recall from above that == represents exact structural equality testing. “Exact” here means that two expressions will compare equal with == only if they are exactly equal structurally. Here, (x+1)2(x+1)2 and x2+2x+1x2+2x+1 are not the same symbolically. One is the power of an addition of two terms, and the other is the addition of three terms.

It turns out that when using SymPy as a library, having == test for exact symbolic equality is far more useful than having it represent symbolic equality, or having it test for mathematical equality. However, as a new user, you will probably care more about the latter two. We have already seen an alternative to representing equalities symbolically, Eq. To test if two things are equal, it is best to recall the basic fact that if a=ba=b, then a−b=0a−b=0. Thus, the best way to check if a=ba=b is to take a−ba−b and simplify it, and see if it goes to 0. We will learn later that the function to do this is called simplify. This method is not infallible—in fact, it can be theoretically proven that it is impossible to determine if two symbolic expressions are identically equal in general—but for most common expressions, it works quite well.

Run code block in SymPy Live
>>> a = (x + 1)**2
>>> b = x**2 + 2*x + 1
>>> simplify(a - b)
>>> c = x**2 - 2*x + 1
>>> simplify(a - c)
There is also a method called equals that tests if two expressions are equal by evaluating them numerically at random points.

Run code block in SymPy Live
>>> a = cos(x)**2 - sin(x)**2
>>> b = cos(2*x)
>>> a.equals(b)
(01-19-2017 02:01 PM)compsystems Wrote: [ -> ]I would like with the help of you all, create a similar tutorial to CAS sympy for Python

There are many undocumented commands and functions, for example

regroup(x+3*x+(5*4/x)) -> 4*x+20/x =)

Maybe I'm not understanding your post, but a request for a tutorial for Sympy might be better answered on a Sympy forum.
An online XCAS tutorial on hp-prime, with good examples like those shown in or inspired by http://docs.sympy.org/latest/tutorial/, since most of the hp-prime HELP examples are numeric incomplete docs of cmds, etc.
If you want to do that, I recommend to proceed in HTML5 with the javascript file giac.js as computing kernel. If you know latex, you can write a latex source file including giac.tex (see documentation in test.tex) and convert it to HTML5 with hevea. giac.tex and test.tex are in the doc directory of Xcas (/c/cygdrive/xcas/doc/ or /c/cygdrive/xcas64/doc on windows or /Applications/usr/share/giac/doc on mac or /usr/share/giac/doc on linux).
Reference URL's