Substituting a value for a differential function



I really shouldn't have used C both ways.  Though it causes no problems in
this particular case, it is bound to be problematic in longer or more
complicated calculations.

There is no endless loop because expressions are only evaluated once.  This
is consistent with almost every other programming language (including Lisp).
 I understand that some systems have "infinite evaluation" semantics, but
Maxima doesn't.  Example:

(a: b, b: c, c: d)$
[a,b,c] => [b,c,d]

When a variable is not assigned a value, it evaluates to itself.

The *order* of the assignments is critical:

(q:s, r:q, p:r)$
[p,q,r] => [s,s,s]

You can force infinite evaluation, though:

[a,b,c], infeval => [d,d,d]

                -s

On Wed, Mar 28, 2012 at 03:00, Jaime Villate <villate at fe.up.pt> wrote:

>  On 03/27/2012 07:35 PM, Stavros Macrakis wrote:
>
> In general, in Maxima it is easier and more natural to work with
> expressions (which you can assign to variables) than with explicitly
> defined functions.  Thus:
>
>  C: A*t^2+B*t+C;
> dC: diff(C,t);
>
> Hi Stavros,
> while we're at it, perhaps you could explain to us why Maxima does not get
> into an endless loop with that
> derivative calculation? I'm puzzled to see that dC does not go into an
> endless loop:
>    2*A*t + B + 2*A*t + B + 2*A*t + B + ...
> Apparently diff knows that there are two different C's, the expression
> that depends on t, and the constant
> that enters in the definition of that expression.
>
> Cheers,
> Jaime
>
>