sublis for not bind(?) variables



Maybe something similar to:

 (%i14) subtest(x,xo, expr):=sublis(map("=",x,xo),expr)$

 (%i15) subtest([x,y],[1,2], fexp);
 (%o15) 7

will work. Also

 (%i16) makelist(var=concat(var,0),var,[x,y]);
 (%o16) [x=x0,y=y0]

Your subtest function did exactly what it should have done.

Barton

-----maxima-bounces at math.utexas.edu wrote: -----


>I?woud?like?to?subt?many?variables?to?given?exp.
>To?do?this,?I?try
>
>fexp:x^2+y^2+x*y
>/*wrong*/
>subtest(x0,y0):=sublis(makelist(var=concat(var,0),var,[x,y]),fexp)
>subtest(1,2)
>/*wrong?result???x0^2??+?x0?y0?+?y0^2 */
>
>This?does?not?work.
>But?simple?use?of?sublis?works.
>
>/*work*/
>subtest1(x0,y0):=sublis([x=x0,y=y0],fexp)
>subtest1(1,2)?/*?=?7*/
>subtest1(10,2)?/*?=124*/
>
>Are?there?any?method?subst?to?many?variables?by?using?loop?like
>function?(mekelist?and?so?on)?