Warning: this is an htmlized version!
The original is here, and
the conversion rules are here.
/*
 * This file:
 *   http://anggtwu.net/MAXIMA/2025-1-s.mac.html
 *   http://anggtwu.net/MAXIMA/2025-1-s.mac
 *          (find-angg "MAXIMA/2025-1-s.mac")
 * Author: Eduardo Ochs <eduardoochs@gmail.com>
 *
 * This file defines the infix substitution operator "_s_".
 * See: (c2m242introp 6 "manga")
 *      (c2m242introa   "manga")
 *      http://anggtwu.net/LATEX/2024-2-C2-intro.pdf#page=6
 *
 * (find-es "maxima" "operator-subst")
 * (find-lisptree "lisptree.mac" "lisptree0")
 * (find-maximanode "psubst")
 * (find-maximanode "sublis")
 * (find-telegachat  "-1002074960141#3276" "eu acabei de melhorar")
 * (find-telegachatm "-1002074960141#3276" "eu acabei de melhorar")
 *
 * «.load»		(to "load")
 * «.core»		(to "core")
 * «.TFC2»		(to "TFC2")
 * «.TFC2-tests»	(to "TFC2-tests")
 * «.MV»		(to "MV")
 * «.MV-tests»		(to "MV-tests")
 * «.DFI»		(to "DFI")
 * «.DFI-tests»		(to "DFI-tests")
*/

/* «load»  (to ".load")
 * Based on: (find-myqdraw "myqdraw3.mac" "load")
 * See: (find-fline "~/MAXIMA/lazynouns.lisp")
 *      (find-fline "~/MAXIMA/dim-antideriv.lisp")
*/
_s_dir : pathname_directory(load_pathname);
load(concat(_s_dir, "lazynouns.lisp"));
load(concat(_s_dir, "dim-antideriv.lisp"));


/* «core»  (to ".core")
*/
"_s_"  (o,oes) := psubst(_s_s(oes), o);
_s_s   (oes)   := map('_s_1, oes);
_s_1   (oe)    := if atom(lhs(oe)) then _s_ae(oe) else _s_fxye(oe);
_s_ae  (ae)    := (lhs(ae) = rhs(ae));
_s_fxye(fxye)  := block(
  [fxy,e,f,xy],
  fxy : lhs (fxye),
  e   : rhs (fxye),
  f   : op  (fxy),
  xy  : args(fxy),
  buildq([f,xy,e], f=lambda(xy,e)));

infix("_s_",99,101);

RC     : ('diff(f(g(x)),x) = fp(g(x)) *. gp(x));
II     : ('integrate(Fp(x), x)       = F(x));
Aipim  : (sqrt(a^2 + b^2) = a + b);
Aipim2 : (sqrt(a^2 - b^2) = a - b);

DefAt     : 'at(f(x),x=a) = f(a);
DefDeriv  : 'at('diff(f(x),x),x=a) = 'limit((f(a+eps)-f(a))/eps,eps,0);
DefDeriv2 : 'at('diff(f(x),x),x=a) = 'limit((f(x)-f(a))/(x-a),x,a);

/*
* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load("2025-1-s.mac");

S1 : '[f (x):=sin(x),
       fp(x):=cos(x),
       g (x):=42*x,
       gp(x):=42];

RC _s_ S1;
RC _s_ S1 _s_ '[x:=t];

_s_1 (g(a,b)=a/b);   "becomes a lambda"$
_s_1 (c     =a/b);   "stays unchanged"$

"_s_"(a/b,    [a=c+d]);
"_s_"(a/b,    [a=b,b=a]);
"_s_"(a/f(b), '[a:=b,b:=a,f(x):=x^2+x^3]);

(a/f(b)) _s_  '[a:=b, b:=a, f(x):=x^2+x^3];

*/


/* «TFC2»  (to ".TFC2")
 * See: (find-fline "~/MAXIMA/antideriv.lisp")
 * 2jT68: (c2m242exsubstp 9 "uma-integral")
 *        (c2m242exsubsta   "uma-integral")
*/
at2(fx,xa,xb) := matrix(["", "|", xb],
                        [fx, "|", ""],
                        ["", "|", xa]);
at2(fx,xa,xb) := block([x:lhs(xa), a:rhs(xa), b:rhs(xb)],
                       antideriv(fx, x, a, b));

DefDif : (at2(F(x),x=a,x=b) = F(b)-F(a));
TFC2   : ('integrate(Fp(x), x, x=a, x=b) = at2(F(x),x=a,x=b));

/* «TFC2-tests»  (to ".TFC2-tests")
* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load("2025-1-s.mac");
DefDif;
TFC2;

*/



/* «MV»  (to ".MV")
 * 2jT87: (c2m242dip 7 "MVDs-e-MVIs-color")
 *        (c2m242dia   "MVDs-e-MVIs-color")
*/
MVD1 : ('integrate(fp(g(x)) *. gp(x), x,x=a,x=b) = 'integrate(fp(u), u,u=g(a),u=g(b)));
MVI1 : ('integrate(fp(g(x)) *. gp(x), x)         = 'integrate(fp(u), u));

MVD4 : align_eqs(['integrate(fp(g(x)) *. gp(x), x,x=a,x=b),
                  at2(f(g(x)),x=a,x=b),
                  f(g(b)) - f(g(a)),
                  at2(f(u),u=g(a),u=g(b)),
                  'integrate(fp(u), u,u=g(a),u=g(b))]);

MVI3 : align_eqs(['integrate(fp(g(x)) *. gp(x), x),
                  f(g(x)),
                  f(u),
                  'integrate(fp(u), u)]);

MVs : matrix([MVI1, MVD1],
             [MVI3, MVD4]);

/* «MV-tests»  (to ".MV-tests")
* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load("2025-1-s.mac");
defdif;

Sg : '[g(x):=x^2,    gp(x):=2*x];
Sf : '[f(x):=sin(x), fp(x):=cos(x)];
MVD1;
MVD4;
MVD4 _s_ Sg;
MVD4 _s_ Sg _s_ Sf;
MVD1 _s_ Sg _s_ Sf;
MVI1 _s_ Sg _s_ Sf;
MVI3 _s_ Sg _s_ Sf;

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load("2025-1-s.mac");
linel : 120;
Sg : '[g(x):=x^2,    gp(x):=2*x];
Sf : '[f(x):=sin(x), fp(x):=cos(x)];
MVs;
MVs _s_ Sg _s_ Sf;

*/










/* «DFI»  (to ".DFI")
 * 2jT97: (c2m242fpp 4 "1-sobre-x")
 *        (c2m242fpa   "1-sobre-x")
 * 2jT117: (c2m242dfip 3 "introducao")
 *         (c2m242dfia   "introducao")
*/
DFI6 : align_eqss([[f(g(x)), x],
                   [diff_(f(g(x)),x), diff_(x,x), 1],
                   [diff_(f(g(x)),x), fp(g(x)) *. gp(x)],
                   [fp(g(x)) *. gp(x), 1],
                   [gp(x), 1/fp(g(x))]]);

DFI2 : align_eqss([[f(g(x)), x],
                   [gp(x), 1/fp(g(x))]]);

/* «DFI-tests»  (to ".DFI-tests")
* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load("2025-1-s.mac");

Sg : '[g(x):=Log(x), gp(x):=Logp(x)];
Sf : '[f(x):=Exp(x), fp(x):=Expp(x)];

DFI6;
DFI6 _s_ Sg;
DFI6 _s_ Sg _s_ Sf;
DFI2;
DFI2 _s_ Sg _s_ Sf;

*/

































/*
 * Local Variables:
 * coding:  utf-8-unix
 * End:
*/