Testing xCAS version 1.2.3-9 (2017)
01-17-2017, 01:50 PM (This post was last modified: 01-19-2017 03:33 PM by compsystems.)
Post: #1
 compsystems Senior Member Posts: 1,328 Joined: Dec 2013
Testing xCAS version 1.2.3-9 (2017)
News: xCAS version 1.2.3-9. (2017)

https://www-fourier.ujf-grenoble.fr/~parisse/giac.html

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?
(xCAS)
a + (b + c) == (a + b) + c ->
false

SIMPLIFY NONE & EXACT ON

Thanks
01-17-2017, 06:49 PM
Post: #2
 parisse Senior Member Posts: 1,178 Joined: Dec 2013
RE: Testing xCAS version 1.2.3-9 (2017)
There is denesting of sums without parenthesis (or with left parenthesis since it's the same) but not with right parenthesis.
d1:=a+(b+c);
size(d1);
d2:=(a+b)+c;
size(d2);
== checks that the internal representation of the symbolic objects are the same. Therefore d1==d2 returns false
01-18-2017, 01:55 AM (This post was last modified: 01-19-2017 01:53 PM by compsystems.)
Post: #3
 compsystems Senior Member Posts: 1,328 Joined: Dec 2013
RE: Testing xCAS version 1.2.3-9 (2017)
Why the XCAS engine over GeoGebra give another output (the GG authors) are modifying the xCAS?
01-18-2017, 06:39 AM
Post: #4
 parisse Senior Member Posts: 1,178 Joined: Dec 2013
RE: Testing xCAS version 1.2.3-9 (2017)
no, but they call their own parser before calling the giac parser.
01-18-2017, 11:20 AM
Post: #5
 DrD Senior Member Posts: 1,132 Joined: Feb 2014
RE: Testing xCAS version 1.2.3-9 (2017)
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.)

Code:
 a:="2x+y=10"; solve(subst(EXPR(a),x = 60),y);  ==> {-110} on HC and [[]] on EMU
01-18-2017, 12:15 PM
Post: #6
 parisse Senior Member Posts: 1,178 Joined: Dec 2013
RE: Testing xCAS version 1.2.3-9 (2017)
I get {-110} on the emulator with expr (lowercase).
01-18-2017, 02:19 PM (This post was last modified: 01-18-2017 02:30 PM by DrD.)
Post: #7
 DrD Senior Member Posts: 1,132 Joined: Feb 2014
RE: Testing xCAS version 1.2.3-9 (2017)
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.
01-18-2017, 02:53 PM (This post was last modified: 01-18-2017 02:53 PM by Han.)
Post: #8
 Han Senior Member Posts: 1,878 Joined: Dec 2013
RE: Testing xCAS version 1.2.3-9 (2017)
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"

Graph 3D | QPI | SolveSys
01-18-2017, 04:12 PM
Post: #9
 DrD Senior Member Posts: 1,132 Joined: Feb 2014
RE: Testing xCAS version 1.2.3-9 (2017)
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.
01-19-2017, 02:01 PM (This post was last modified: 01-19-2017 03:48 PM by compsystems.)
Post: #10
 compsystems Senior Member Posts: 1,328 Joined: Dec 2013
RE: Testing xCAS version 1.2.3-9 (2017)
I would like with the help of you all, create a similar tutorial to CAS sympy for Python
TUTORIAL
http://docs.sympy.org/latest/tutorial/gotchas.html

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
False
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
False
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)
0
>>> c = x**2 - 2*x + 1
>>> simplify(a - c)
4*x
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)
True
01-19-2017, 04:00 PM
Post: #11
 Han Senior Member Posts: 1,878 Joined: Dec 2013
RE: Testing xCAS version 1.2.3-9 (2017)
(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
TUTORIAL
http://docs.sympy.org/latest/tutorial/gotchas.html

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.

Graph 3D | QPI | SolveSys
01-19-2017, 04:37 PM
Post: #12
 compsystems Senior Member Posts: 1,328 Joined: Dec 2013
RE: Testing xCAS version 1.2.3-9 (2017)
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.
01-19-2017, 06:44 PM
Post: #13
 parisse Senior Member Posts: 1,178 Joined: Dec 2013
RE: Testing xCAS version 1.2.3-9 (2017)
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).
 « Next Oldest | Next Newest »

User(s) browsing this thread: 1 Guest(s)