Rupert -- thanks for your reply. Some quick follow-up below:
On 10/5/2011 2:02 PM, Rupert Swarbrick wrote:
> Richard Fateman's answer was correct: it doesn't make sense to
> substitute numbers for x,y into "dy/dx". Something like the following
> does work:
>
> (%i1) mat:matrix([0,s_a*m_2,s_a*m_3],[s_o,0,0],[0,s[a],s[a]]);
> [ 0 m_2 s_a m_3 s_a ]
> [ ]
> (%o1) [ s_o 0 0 ]
> [ ]
> [ 0 s s ]
> [ a a ]
> (%i2) cp:charpoly(mat,lam);
> 2
> (%o2) s m_3 s_a s_o - (s - lam) m_2 s_a s_o + (s - lam) lam
> a a a
> (%i3) depends(lam,s_a);
> (%o3) [lam(s_a)]
> (%i4) deriv:diff(cp,s_a);
> dlam 2 dlam
> (%o4) ---- m_2 s_a s_o + s m_3 s_o - (s - lam) m_2 s_o - lam ----
> ds_a a a ds_a
> dlam
> + 2 (s - lam) lam ----
> a ds_a
> (%i5) sol:solve(deriv,'diff(lam,s_a));
> (s m_3 + (lam - s ) m_2) s_o
> dlam a a
> (%o5) [---- = - -------------------------------]
> ds_a 2
> m_2 s_a s_o - 3 lam + 2 s lam
> a
> (%i6) subst([s_a=0.8,s_o=0.4,m_2=1.2,m_3=1.2,lam=1.1667],rhs(first(sol)));
> 0.4 (1.2 s + 1.2 (1.1667 - s ))
> a a
> (%o6) - --------------------------------
> 2.3334 s - 3.699566670000001
> a
> (%i7) subst(0.8, s[a], %);
> (%o7) .3055443803163305
>
>
> The last line is because you seem to have got confused about s_a and
> s[a].
Not so much confusion, as reflecting difficulty remembering that Maple
and Maxima handle subst and implicit differentiation differently if a
variable is 'subscripted' using s[a] (works in Maple, not in Maxima).
I'll have to dig into the rhs(first(sol)) part of your 'solution'. It
clearly works (based in a criterion that the result matches output from
Maple, Mathematica, Gauss, and (heaven for fend) by hand), but I'm not
really sure what it's doing.
> I don't know why I'm getting 0.3 instead of the 0.8 you report
> From Maple, but I suspect that's a typo from one of us.
Indeed. You have m_2=m_3=1.2, whereas I was using m_2=1.2, m_3=1.4.
>
> Note that "rhs(first(sol))" above says to take the first thing in the
> sol list (ie the equation) and then take its right hand side.
>
> Does this solve your problem for you?
>
>
> Rupert
>
>
>
> PS Regarding your Maple example, I logged into a University computer to
> check it out. Note that the response to your implicit diff line looks
> like
>
> > implicitdiff(cp,lambda,s_a);
> 2
> s_o (m_2 lambda + 3 s_a m_3)
> -----------------------------
> 2
> 3 lambda - s_o s_a m_2
>
> This doesn't have the left hand dlam/ds_a part, so substitution
> actually makes sense.
And this, I believe, is the key to why I was having trouble
understanding what Maxima was doing. Maple doesn't care if a function is
a derivative or not -- it is simply an entity into which you can
substitute values for things all you want. There is a way to make Maple
'aware' that something is a derivative (or anything else), but I almost
never use that, since all I generally want to do is (i) get the
derivative, and (ii) evaluate it at a particular point.