Post Reply 
error in subst function
11-16-2018, 10:33 AM
Post: #1
error in subst function
Hi all

In CAS mode, with (non-CAS) variable T initialized to 100:

subst('S + 10', 'S=T') yields T+ 10 (desired result)
subst('S + 0.1', 'S=T') yields 100.1 (which is not correct)

Using CAS variables s and t leads to same strange behaviour.

ANyone, any explanation for this ? Seems like an error to me ...

Thanks for your help.
Find all posts by this user
Quote this message in a reply
11-16-2018, 10:42 AM
Post: #2
RE: error in subst function
I'd guess that CAS is able to provide a symbolic answer when integers are in play.

When you used 0.1 instead of 10, approximate values are used instead and the expression is evaluated.
Find all posts by this user
Quote this message in a reply
11-16-2018, 10:49 AM
Post: #3
RE: error in subst function
Thanks for your reply, but I don't see why this would be the case.

Is this behaviour documented somewhere ?
Find all posts by this user
Quote this message in a reply
11-16-2018, 02:33 PM
Post: #4
RE: error in subst function
(11-16-2018 10:49 AM)hata Wrote:  Is this behaviour documented somewhere ?

I don't know if this is documented somewhere, but it was mentioned many times here on the forums.

So, you must use integers. If you want for example 0.1 then you must rewrite it as 1/10.

This works:
subst('S+(1/10)','S = T')

Prime G2, 15C CE
Find all posts by this user
Quote this message in a reply
11-16-2018, 02:48 PM
Post: #5
RE: error in subst function
OK thanks
Find all posts by this user
Quote this message in a reply
Post Reply 




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