Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
/* * This file: * http://anggtwu.net/MAXIMA/mysubst2.mac.html * http://anggtwu.net/MAXIMA/mysubst2.mac * (find-angg "MAXIMA/mysubst2.mac") * Author: Eduardo Ochs <eduardoochs@gmail.com> * * (defun e () (interactive) (find-angg "MAXIMA/mysubst2.mac")) * (defun o () (interactive) (find-angg "MAXIMA/mysubst.mac")) * Supersedes: (find-angg "MAXIMA/mysubst.mac") * * See: (find-es "maxima" "operator-subst") */ "_s_"(expr,subs) := sublis(subs, expr); infix("_s_",99,101); LSUBST (eqs) := map('LSUBST1,eqs); LSUBST1(eq) := if is(op(eq) = ":=") then block([fxy,f,xy,r], fxy:lhs(eq), f:op(fxy), xy:args(fxy), r:rhs(eq), buildq([fxy,f,xy,r], f=lambda(xy,r))) else eq; /* * (eepitch-maxima) * (eepitch-kill) * (eepitch-maxima) ** (find-angg "MAXIMA/mysubst2.mac") load ("mysubst2.mac"); S1 : [ a=3 ]; S2 : [ b=4 ]; S3 : [ a=3, b=4 ]; Sg : LSUBST('[ g(y):=sqrt(y)+y^3 ]); f(g(4/5)); f(g(4/5)) _s_ Sg; f(g(c/d)) _s_ Sg; AIPIM : sqrt(a^2+b^2) = a+b; AIPIM _s_ S1; AIPIM _s_ S1 _s_ S2; AIPIM _s_ S3; M1 : matrix([a, "=", b, "=", c]); M2 : matrix([a, "=", b], ["", "=", c]); M1 _s_ [a=2, b=3, c=4]; M2 _s_ [a=2, b=3, c=4]; 2=3; is(2=3); S4 : LSUBST('[ f(x):=g(x), g(x):=f(x) ]); S5 : LSUBST('[ f(x):=g(g(x)), g(x):=f(f(x)) ]); f(g(42)) _s_ S4; f(g(42)) _s_ S5; */ /* * Local Variables: * coding: utf-8-unix * End: */