# [Maxima] SUBST problem

Richard Fateman fateman
Thu Oct 12 11:22:50 CDT 2006

```Try f_n(x):=subst(''%,f(x))  on line %i3.

Otherwise %  is always the previous line.  So on line %i4,   % is %o3,
which is an illegal substitution.

''%  appears to be what you want.  That is  '  '   % .

RJF

> -----Original Message-----
> From: maxima-bounces at math.utexas.edu [mailto:maxima-
> bounces at math.utexas.edu] On Behalf Of Dominique MICOLLET
> Sent: Thursday, October 12, 2006 8:01 AM
> To: maxima at math.utexas.edu
> Subject: [Maxima] SUBST problem
>
> Hello,
>
> I am discovering Maxima but experienced some problems to use it.
> One of them : what is wrong in :
>
> (%i1) f(x):=a*x+b;
> (%o1) 			        f(x) := a x + b
> (%i2) linsolve([f(0)=1,f(1)=3],[a,b]);
> (%o2) 			        [a = 2, b = 1]
> (%i3) f_n(x):=subst(%,f(x));
> (%o3) 			   f_n(x) := SUBST(%, f(x))
> (%i4) f_n(2);
> Improper argument to SUBST:
> f_n(x) := SUBST(%, f(x))
> #0: f_n(x=2)
>  -- an error.  Quitting.  To debug this try DEBUGMODE(TRUE);
>
> Substituting :
> (%i3) f_n(x):=subst(%o2,f(x));
> works correctly.
>
> --
>       Cordialement
>
> Dominique MICOLLET       Email   : Dominique.Micollet at u-bourgogne.fr
> Universite de Bourgogne
> 9, Avenue Alain SAVARY  BP 47870      Tel     : +33/(0)3-80-39-59-27
> 21078 DIJON CEDEX       FRANCE        Tfx     : +33/(0)3-80-39-68-69
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima

```