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")
 * «.S_f_g»		(to "S_f_g")
 * «.S_f_g-tests»	(to "S_f_g-tests")
 * «.MV»		(to "MV")
 * «.MV-tests»		(to "MV-tests")
 * «.DFI»		(to "DFI")
 * «.DFI-tests»		(to "DFI-tests")
 * «.EDOVS»		(to "EDOVS")
 * «.EDOVS-tests»	(to "EDOVS-tests")
 * «.EDOLCC»		(to "EDOLCC")
 * «.EDOLCC-tests»	(to "EDOLCC-tests")
 * «.E5»		(to "E5")
 * «.E5-tests»		(to "E5-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));
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   : (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;

*/


/* «S_f_g»  (to ".S_f_g")
*/
S_gx    (gx)     := [g(x)=gx, gp(x)=diff(gx,x)];
S_gx_fu (gx,fu)  := [g(x)=gx, gp(x)=diff(gx,x),
                     f(u)=fu, fp(u)=diff(fu,u)];
S_gx_fpu(gx,fpu) := [g(x)=gx, gp(x)=diff(gx,x),
                              fp(u)=fpu];

V(viras) := transpose(matrix(viras));

/* «S_f_g-tests»  (to ".S_f_g-tests")
* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load("2025-1-s.mac");
V([a=aa,b=bb]);
[V(S_gx    (x^2)),
 V(S_gx_fu (x^2, sin(u))),
 V(S_gx_fpu(x^2, cos(u)))];

*/



/* «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)));
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));
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");
S4 : S_gx_fu (x^2, sin(u))$
S3 : S_gx_fpu(x^2,        cos(u))$
[V(S3), V(S4)];
MVI1 _s_ S3;
MVD4 _s_ S4;

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load("2025-1-s.mac");
S4 : S_gx_fu (sin(x), log(u)^4)$
S3 : S_gx_fpu(sin(x),          4*log(u)^3 / u)$
[V(S3), V(S4)];
MVI1 _s_ S3;
MVD4 _s_ S4;

*/












/* «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;

*/



/* «EDOVS»  (to ".EDOVS")
 * (find-angg "MAXIMA/2024-2-C2-EDOVS.mac")
*/
EDOVS_M : matrix(
  [         _diff(y,x), "=",       g(x) /. h(y)  ],
  [        h(y)*del(x), "=",        g(x)*del(x)  ],
  [ _integrate(h(y),y), "=", _integrate(g(x),x)  ],
  [             "||",    "",             "||"    ],
  [         H(y) +. C1, "=",         G(x) +. C2  ],
  [         H(y),       "=",         G(x) +. C3  ],
  [    Hinv(H(y)),      "=",    Hinv(G(x) +. C3) ],
  [          "||",       "",                 ""  ],
  [           y,         "",                 ""  ])$

EDOVS_edo : 'diff(y,x)   =           g(x) / h(y);
EDOVS_imp : H(y)         =           G(x) +  C3;
EDOVS_exp :   y          =      Hinv(G(x) +  C3);
EDOVS_f   :                     Hinv(G(x) +  C3);

/* «EDOVS-tests»  (to ".EDOVS-tests")
* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load("2025-1-s.mac");
linel : 110;
S4  : [g(x) = -2*x,     h(y) = 2*y,
       G(x) = -x^2,     H(y) = y^2]$
S5p : [g(x) = -2*x,     h(y) = 2*y,
       G(x) = -x^2,     H(y) = y^2,
                     Hinv(y) = sqrt(y)]$
S5n : [g(x) = -2*x,     h(y) = 2*y,
       G(x) = -x^2,     H(y) = y^2,
                     Hinv(y) = -sqrt(y)]$

[EDOVS_M,           EDOVS_M _s_ S4];
[EDOVS_M   _s_ S5p, EDOVS_M _s_ S5n];
 EDOVS_edo _s_ S5p;
 EDOVS_imp _s_ S5p;
 EDOVS_exp _s_ S5p;
 EDOVS_f   _s_ S5p;

edo   : EDOVS_edo _s_ S4;
sol0  : ode2(edo,y,x);
sols0 : solve(sol0, y);
s0    : C3 = -2*%c;
s1    : solve(s0, %c);
sols1 : subst(s1, sols0);

define(fp(x), EDOVS_f _s_ S5p);
define(fn(x), EDOVS_f _s_ S5n);

P1  : [x=3,y=4];
eq1 : subst(P1, y=fp(x));
eq2 : solve(eq1, C3);
define(fp_P1(x), subst(eq2, fp(x)));
subst(P1, y=fp_P1(x));

P2  : [x=3,y=-4];
eq1 : subst(P2, y=fn(x));
eq2 : solve(eq1, C3);
define(fn_P2(x), subst(eq2, fn(x)));
subst(P1, y=fn_P2(x));

*/



/* «EDOLCC»  (to ".EDOLCC")
*/
EDOLCC : matrix(
  [  "f''" +. (-a-b)*."f'" +. (a*b) * f, "=", 0],
  [ D^2*.f +. (-a-b)*.D*.f +. (a*b) * f, "=", 0],
  [(D^2    +. (-a-b)*.D    +. (a*b))*.f, "=", 0],
  [(D-a)*.(D-b)*.f,                      "=", 0],
  [(D-a)*.(D-b)*.exp(b*x),               "=", 0],
  [(D-a)*.(D-b)*.exp(a*x),               "=", 0]);

EDOLCC_edo : 'diff(y,x,2) + (-a-b)*'diff(y,x) + a*b*y = 0;


/* «EDOLCC-tests»  (to ".EDOLCC-tests")
* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load("2025-1-s.mac");
SR : [a=2, b=-3];
SC : [a=2+3*%i, b=2-3*%i];
       EDOLCC;
       EDOLCC _s_ SR;
expand(EDOLCC _s_ SC);

edo : EDOLCC_edo _s_ SR;
sol : ode2(edo,y,x);

edo : EDOLCC_edo _s_ SC;
sol : ode2(edo,y,x);

*/





/* «E5»  (to ".E5")
 * (find-angg "MAXIMA/2025-1-exact.mac")
 * (c2m251edosexatasp 3 "metodo-e-exemplo")
 * (c2m251edosexatasa   "metodo-e-exemplo")
*/
E5 : matrix(
  [d *. z,       "=", z_x *. dx +. z_y *. dy          , "=", 0],
  [_diff(z,x,1), "=", z_x       +. z_y *. _diff(y,x,1), "=", 0],
  [z,            "=", C                               , "", ""]);

E5_edo : z_x + z_y*'diff(y,x) = 0;
E5_imp : z = C;

/* «E5-tests»  (to ".E5-tests")
* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load("2025-1-s.mac");
S1 : [z=x^2+y^2, z_x=2*x, z_y=2*y];
E5;
       E5     _s_ S1;
edo  : E5_edo _s_ S1;
imp  : E5_imp _s_ S1;
imp2 : ode2(edo,y,x);
solve(imp, y);
solve(imp2,y);
  
*/




























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