Basic question on verbifying expressions



On Thu, Apr 19, 2012 at 07:07, Rupert Swarbrick <rswarbrick at gmail.com>wrote:

> ...The easiest way to do this sort of thing is syntactically: instead of
> saying to Maxima "please resimplify the expression, knowing also that
> x(t)=1", just say "replace all occurrences of x(t) with 1 in here".
>

Well, that works if it's literally x(t) in the expression; but what if it's
x(t-1) or x(t^2)?

For *local* substitution of f, you can also do

         expr: f(t-1)

then

         block(local(f), f(x):=x^3, ev(expr) )
or
         ev( expr , f(x):=x^3 )

            -s


> (%i5) subst(x(t)=1, lap_ex1);
>                                      !
> (%o5)                (laplace(1, t, s)!         ) (s + 3)
>                                      !s = s + 3
>
> This has the added benefit of not clobbering x(t) for future work: maybe
> you want to look at the laplace transform for other functions too (eg
> using the Laplace transform's linearity and expanding a periodic
> function as a sum of trig functions or whatever)
>
> Of course, you need to tell the laplace code to get run again (what
> looks like a function call in %o5 is actually a noun form, as I guess
> you've realised, given the title of the thread).
>
> (%i6) %, nouns;
> (%o6)                                  1
>
> Tada! If you want to read more about this, have a look at the
> documentation for the ev function. The line "expr, nouns" is just a
> shorthand for "ev(expr, nouns)".
>
> Rupert
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>
>