Post Reply 
Strange behaviour of "expand" in CAS view (Xcas problem?)
10-16-2014, 02:29 PM
Post: #1
Strange behaviour of "expand" in CAS view (Xcas problem?)
Typing
Code:
expand(x*2.9+6.3)
gives
Code:
2.9*x+6.3
(correct).

Typing
Code:
expand(x*2.9e-13+6.3e-13)
gives
Code:
(1+x)*6.3e-13
(not correct).

This happens when both powers of ten are -13 or smaller.

This also happens in Xcas on my PC (in the latest stable and unstable versions).

Nigel (UK)
Find all posts by this user
Quote this message in a reply
10-16-2014, 05:13 PM
Post: #2
RE: Strange behaviour of "expand" in CAS view (Xcas problem?)
Probably has to do with how you set up the CAS to interpret small numbers. If those are floating point numbers, your settings may have forced the CAS to assume them to be 0.

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
10-16-2014, 08:06 PM
Post: #3
RE: Strange behaviour of "expand" in CAS view (Xcas problem?)
I can't reproduce on Xcas
0>> expand(x*2.9e-13+6.3e-13)
2.9e-13*x+6.3e-13
The latest stable version is 1.1.2-10 (version() on windows and mac, dpkg -l giac on linux to check your version).
Find all posts by this user
Quote this message in a reply
10-19-2014, 07:14 PM
Post: #4
RE: Strange behaviour of "expand" in CAS view (Xcas problem?)
(10-16-2014 08:06 PM)parisse Wrote:  I can't reproduce on Xcas
0>> expand(x*2.9e-13+6.3e-13)
2.9e-13*x+6.3e-13
The latest stable version is 1.1.2-10 (version() on windows and mac, dpkg -l giac on linux to check your version).

Sorry about the delay in my reply - real life intervened!

I have re-installed Xcas - version() now returns
Code:
"giac 1.1.2-10, (c) B. Parisse and R. De Graeve, Institut Fourier, Universite de Grenoble I"
My config settings are
Code:
exact real DEG 10 xcas
and epsilon is 10^(-10).

I still have the error described above.

It may be to do with the way in which Xcas treats small numbers, as Han suggests. However in this case Xcas isn't replacing one small number by zero; rather, it is replacing one small number by the other small number in the problem. This is unexpected.
Find all posts by this user
Quote this message in a reply
10-20-2014, 07:18 AM
Post: #5
RE: Strange behaviour of "expand" in CAS view (Xcas problem?)
Ok, I see. I was testing with the commandline version (giac) not with Xcas, because the commandline version is more suited to debugging.
I will modify expand not to collect if the coefficients are not exactly the same (currently it is comparing the difference to 0, and epsilon is used for doubles, but it's the null context epsilon, not updated by modifying epsilon in the settings).
Find all posts by this user
Quote this message in a reply
Post Reply 




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