|
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")
*
* «.test-1» (to "test-1")
* «.test-2» (to "test-2")
*/
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));
/*
** «test-1» (to ".test-1")
* (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(%);
** «test-2» (to ".test-2")
* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load("2025-mysqrt.mac");
eq1 : (x+3)^2 + (y+4)^2 = 5;
sols : solve(eq1, y);
dpart(eq1, 1,2);
eq2 : eq1 - part(eq1, 1,2);
eq3 : sqrt_p(eq2);
dpart(eq3, 1,2);
eq4 : eq3 - part(eq3, 1,2);
eq5 : expand(eq4);
sols[1];
eq2;
eq6 : - sqrt_n(eq2);
dpart(eq6, 1,2);
eq7 : eq6 - part(eq6, 1,2);
eq8 : expand(eq7);
sols[1];
** (c2m251edovsp 12 "4-inversas")
** (c2m251edovsa "4-inversas")
*/