# [Maxima] Basic question on verbifying expressions

Rupert Swarbrick rswarbrick at gmail.com
Thu Apr 19 08:01:14 CDT 2012

```Stavros Macrakis <macrakis at alum.mit.edu> writes:
> 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

Ah that's a good point. I have done things like this in the past:

(%i9) f(x + 1);
(%o9)                              f(x + 1)
(%i10) subst(f=lambda([x], x^2), %o9);
2
(%o10)                             (x + 1)

but I agree that it's not necessarily any more obvious what's going on.

Rupert
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 315 bytes
Desc: not available
URL: <http://www.math.utexas.edu/pipermail/maxima/attachments/20120419/2ae51c28/attachment.pgp>
```