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") */ 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)]; /* * (eepitch-maxima) * (eepitch-kill) * (eepitch-maxima) load("2025-mysqrt.mac"); o : (a+b)^2 = c+d; sqrt (o); sqrtp(o); sqrtn(o); xx; xx : 23; block([xx], isx2_(lhs(o))); xx : 23; ** (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 : sqrtp(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 : sqrtn(o); o : - o; part(o,1,2); o : o - part(o,1,2); define(g2(y), rhs(o)); */