Warning: this is an htmlized version!
The original is here, and
the conversion rules are here.
/*
 * This file:
 *   http://anggtwu.net/MAXIMA/2025-mysqrt.mac.html
 *   http://anggtwu.net/MAXIMA/2025-mysqrt.mac
 *          (find-angg "MAXIMA/2025-mysqrt.mac")
 * Author: Eduardo Ochs <eduardoochs@gmail.com>
 *
 * (defun e () (interactive) (find-angg "MAXIMA/2025-mysqrt.mac"))
 *
 * See:
 * (find-es "maxima" "defmatch")
 * (find-es "maxima" "defmatch-bug")
 * (find-maximamsg "59208932 202507 20" "Edrx: (x-2)^2 becomes (x-4)^2")
 * (find-maximamsg "59208944 202507 20" "RFateman: it also binds x globally")
 * (find-maximamsg "59208957 202507 20" "Edrx: inside a `block([x],...)'")
 * (find-maximamsg "59209026 202507 20" "RDodier: E.g. aa, bb, cc, xx, yy, zz")
 * (find-maximamsg "59209042 202507 20" "Edrx: I have lots of students")
 * (find-maximamsg "59209318 202507 21" "Stavros: names like _foo for hidden")
*/

/* Old:
matchdeclare(xx, all);
defmatch(isx2_, xx^2);
isx2     (o) := not atom(isx2_(o));
isx2_body(o) := if isx2(o) then part(isx2_(o),1,2);
sqrtp_   (o) := if isx2(o) then  isx2_body(o) else sqrt(o);
sqrtn_   (o) := if isx2(o) then -isx2_body(o) else sqrt(o);
sqrtp    (o) := map('sqrtp_,o);
sqrtn    (o) := map('sqrtn_,o);

sqrtpn   (o) := [map('sqrtp,o), map('sqrtn,o)];
*/

/* matchdeclare  (_body,all, _a,all, _b,all); */
matchdeclare  ([_body,_a,_b],all);
tellsimpafter (sqrt_ap(_body^2),  _body);
tellsimpafter (sqrt_an(_body^2), -_body);
tellsimpafter (sqrt_ap(_a=_b), sqrt_ap(_a)=sqrt_ap(_b));
tellsimpafter (sqrt_an(_a=_b), sqrt_an(_a)=sqrt_an(_b));

sqrt_simp(o) := subst([sqrt_ap=sqrt, sqrt_an=sqrt], o);
sqrt_p(o)    := sqrt_simp(sqrt_ap(o));
sqrt_n(o)    := sqrt_simp(sqrt_an(o));


/*
* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load("2025-mysqrt.mac");
eq0 : x^2 + y^2 = 1;
eq1 : eq0 - x^2;
eq2 :  sqrt_p(eq1);
eq3 : -sqrt_n(eq1);

 sqrt_ap(eq1);
 sqrt_an(eq1);
-sqrt_an(eq1);
 sqrt_simp(%);

** (c2m251edovsp 12 "4-inversas")
** (c2m251edovsa    "4-inversas")
* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load("2025-mysqrt.mac");
display2d : false;

o0 : (x-2)^2+(y+3)^2=4;
          part(o0,1,1);
o  : o0 - part(o0,1,1);
o  : sqrt_ap(o);
         part(o,1,2);
o  : o - part(o,1,2);
define(g1(y), rhs(o));

o0 : (x-2)^2+(y+3)^2=4;
          part(o0,1,1);
o  : o0 - part(o0,1,1);
o  : sqrt_an(o);
o  : - o;
         part(o,1,2);
o  : o - part(o,1,2);
define(g2(y), rhs(o));

*/