HP Forums

Full Version: Strange behaviour of "expand" in CAS view (Xcas problem?)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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)
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.
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).
(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.
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).
Reference URL's