how to substitute known values



-----maxima-bounces at math.utexas.edu wrote: -----

>depends(x,t);
>depends(y,t);
>c(t):=sqrt(x^2+y^2);
>diff(c(t),t);
>
>...?I?want?to?substitute?specific?values?of?x,?y,?dx/dt,?and?dy/dt?into
>the?resulting?expression?for?dc/dt. What?is?the?simplest?way?to?do?that?

The function subst can do this, but it's tricky:

OK:
  (%i21) subst([diff(x,t) = 5, diff(y,t)=7, x = 3, y = 4], diff(sqrt(x^2+y^2),t));
  (%o21) 43/5

Not OK:

 (%i16) subst([x=3, y=4, diff(x,t) = 5, diff(y,t)=7], diff(sqrt(x^2+y^2),t));
 (%o16) 0

In the last calculation, the substitution x = 3, causes diff(x,t) --> diff(3,t) --> 0.
The user documentation for 'subst' does say that the substitutions are made from left
to right.

There might be another way to do this using atvalue and at, but maybe this will work
for you.

--bw