how to substitute known values




On Wed, 6 Apr 2011, Barton Willis wrote:

< -----Leo Butler <l.butler at ed.ac.uk> wrote: -----
< 
< >?I?think?the?function?you?want?is?psubst.
< >
< >?psubst([x=3,?y=4,?diff(x,t)?=?5,?diff(y,t)=7],?diff(sqrt(x^2+y^2),t));
< >
< >?should?do?what?you?want.
< 
< No, isn't the cure:
< 
<  (%i1) depends(x,t,y,t);
<  (%o1) [x(t),y(t)]
< 
<  (%i2) psubst([x=3, y=4, diff(x,t) = 5, diff(y,t)=7], diff(sqrt(x^2+y^2),t));
<  (%o2) 0
< 
<  (%i3) psubst([diff(x,t) = 5, diff(y,t)=7,x=3, y=4], diff(sqrt(x^2+y^2),t));
<  (%o3) 43/5
 
 Well, I guess this is a bug, eh?

 Here is a slightly re-worked version of the example from the
 documentation:

 (%i20) psubst ([a^2=b, b=a], sin(a^2) + cos(b));
 (%o20)                          sin(b) + cos(a)
 (%i21) psubst ([b=a, a^2=b], sin(a^2) + cos(b));
 (%o21)                          sin(b) + cos(a)


 Leo
-- 
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.