HP Forums
error in subst function - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: error in subst function (/thread-11810.html)



error in subst function - hata - 11-16-2018 10:33 AM

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.


RE: error in subst function - grsbanks - 11-16-2018 10:42 AM

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.


RE: error in subst function - hata - 11-16-2018 10:49 AM

Thanks for your reply, but I don't see why this would be the case.

Is this behaviour documented somewhere ?


RE: error in subst function - chromos - 11-16-2018 02:33 PM

(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')


RE: error in subst function - hata - 11-16-2018 02:48 PM

OK thanks