|
Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
/*
* This file:
* https://anggtwu.net/MAXIMA/2026-lpp.mac.html
* https://anggtwu.net/MAXIMA/2026-lpp.mac
* (find-angg "MAXIMA/2026-lpp.mac")
* Author: Eduardo Ochs <eduardoochs@gmail.com>
*
* (defun e () (interactive) (find-angg "MAXIMA/2026-lpp.mac"))
* (defun o () (interactive) (find-angg "MAXIMA/2026-ffgg.mac"))
*
* «.gains-and-pitfalls» (to "gains-and-pitfalls")
* «.ggff» (to "ggff")
* «.edo» (to "edo")
* «.TN3» (to "TN3")
* «.partfrac» (to "partfrac")
* «.edovs-arquetipal» (to "edovs-arquetipal")
* «.subst-early» (to "subst-early")
* «.chain-rule-apex» (to "chain-rule-apex")
* «.maxima-intro» (to "maxima-intro")
* «.eq-reta» (to "eq-reta")
* «.infix» (to "infix")
* «.pretty-subst» (to "pretty-subst")
* «.tricky-subst» (to "tricky-subst")
** «.holes» (to "holes")
*/
/* ____ _ _ _ _ __ _ _
* / ___| __ _(_)_ __ ___ __ _ _ __ __| | _ __ (_) |_ / _| __ _| | |___
* | | _ / _` | | '_ \/ __| / _` | '_ \ / _` | | '_ \| | __| |_ / _` | | / __|
* | |_| | (_| | | | | \__ \ | (_| | | | | (_| | | |_) | | |_| _| (_| | | \__ \
* \____|\__,_|_|_| |_|___/ \__,_|_| |_|\__,_| | .__/|_|\__|_| \__,_|_|_|___/
* |_|
*/
** «gains-and-pitfalls» (to ".gains-and-pitfalls")
* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
** (find-angg "MAXIMA/2025-emaxima+.mac")
load ("~/MAXIMA/2025-emaxima+.mac");
linenum:0;
** display2d:true$
/* block gains and pitfalls */
lisptreemq(3*(x+5)+1);
3*(x+5)+1;
f(x) := 3*(x+5)+1;
f(0);
f(195);
/* block gains and pitfalls 2 */
f(x)=1;
solve(f(x)=1, x);
subst(x= 195, 3*(x+5)+1);
subst(x="195", 3*(x+5)+1);
* (ee-write-buffer-contents "*maxima*" "/tmp/o")
* (find-angg "LUA/Maxima3.lua" "log-to-i" 4)
/* __ __ __ __ __ __ __ __ __ __
* __ _ / / __ _ / / / _|/ / / _|/ / __ __ \ \ \ \ \ \ \ \
* / _` | | / _` | | | |_| | | |_| | \ \/ / | | | | | | | |
* | (_| | | | (_| | | | _| | | _| | > < | | | | | | | |
* \__, | | \__, | | |_| | | |_| | | /_/\_\ | | | | | | | |
* |___/ \_\ |___/ \_\ \_\ \_\ /_/ /_/ /_/ /_/
*/
** «ggff» (to ".ggff")
** Used in: (wld2026p 63 "subst-detalhes-tecnicos")
** (wld2026a "subst-detalhes-tecnicos")
* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
** (find-angg "MAXIMA/2025-emaxima+.mac")
load ("~/MAXIMA/2025-emaxima+.mac");
linenum:0;
display2d:true$
tree(o) := lisptreem(o);
sa_bigstr : "";
sa_addline("% Generated by:");
sa_addline("% (find-angg \"MAXIMA/2026-lpp.mac\" \"ggff\")");
fgt1 : f(g(t));
fgt2 : ap(f,ap(g,t));
newfx : λ(x,g(g(x)));
newfy : λ(y,g(g(y)));
newgx : λ(x,f(f(x)));
newgy : λ(y,f(f(y)));
S1 : [f(x)=g(g(x)), g(x)=f(f(x))];
S2 : [f=newfx, g=newgx];
S3 : [f=newfx, g=newgy];
S4 : [f=tree(newfx), g=tree(newgy)];
L1 : fgt1;
L2 : underbrace(L1, lisptreem(L1));
L3 : underbrace(L2, lisptreem(fgt2));
M1 : V(S1);
M2 : underbrace(M1, V(S2));
M3 : underbrace(M2, V(S3));
M4 : underbrace(M3, V(S4));
R1 : fgt1 _s_ S1;
R2 : underbrace(R1, tree(R1));
R3 : underbrace(R2, tree(fgt2 _s_ S3));
ggff_small : fgt1 _sss_ S1;
ggff_big : L3 *. M4 = R3;
sa("ggff small", ggff_small);
sa("ggff big", ggff_big);
sa_bigstr;
sa_bigstr_writeto("/tmp/o");
/* _____ ____ ___
* | ____| _ \ / _ \
* | _| | | | | | | |
* | |___| |_| | |_| |
* |_____|____/ \___/
*/
** «edo» (to ".edo")
* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
** (find-angg "MAXIMA/2025-emaxima+.mac")
load ("~/MAXIMA/2025-emaxima.mac");
linenum:0;
[topdf_a,topdf_b,topdf_c,topdf_n] : ["~/LATEX/", "2026logica-para-pessoas/", "edo", 0];
myqdrawp_to_new_pdf(); myps(s):=ps(s/5);
myqdrawp_to_screen (); myps(s):=ps(s);
display2d:true$
[xmin,ymin, xmax,ymax] : [-6,-6, 6,6];
[xmin,ymin, xmax,ymax] : [-5,-5, 5,5];
eq1 : x^2 + y^2 = 25;
solve(eq1, y);
fp(x) := sqrt(25 - x^2);
fn(x) := - sqrt(25 - x^2);
myqdrawp(xyrange(),
myex1(fp(x), lc(red)),
myex1(fn(x), lc(orange)),
pts([[3, 4]], myps(4), pc(forest_green)),
pts([[4,-3]], myps(4), pc(blue))
);
** (find-pdf-page "~/LATEX/2026logica-para-pessoas/edo_001.pdf")
** (find-includegraphics-links "~/LATEX/2026logica-para-pessoas/edo_001.pdf" "")
/* _____ _ _ _____
* |_ _| \ | |___ /
* | | | \| | |_ \
* | | | |\ |___) |
* |_| |_| \_|____/
*/
** «TN3» (to ".TN3")
** Used in: (wld2026p 63 "subst-detalhes-tecnicos")
** (wld2026a "subst-detalhes-tecnicos")
* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
** (find-angg "MAXIMA/2025-emaxima+.mac")
load ("~/MAXIMA/2025-emaxima+.mac");
linenum:0;
display2d:true$
texput(eps,"\\epsilon ");
sa_bigstr : "";
sa_addline("% Generated by:");
sa_addline("% (find-angg \"MAXIMA/2026-lpp.mac\" \"TN3\")");
S : [f(x)=x^.10, a=1];
o1 : DefDeriv;
o2 : DefDeriv _s_ S;
sa("TN3 defderiv geral", o1);
sa("TN3 defderiv x^10", o2);
o3 : ddx(f(sen(x^4) + ln(x)));
o4 : lisptreem(o3);
sa("TN2 tree", o4);
sa_bigstr;
sa_bigstr_writeto("/tmp/o");
/* _ __
* _ __ __ _ _ __| |_ / _|_ __ __ _ ___
* | '_ \ / _` | '__| __| |_| '__/ _` |/ __|
* | |_) | (_| | | | |_| _| | | (_| | (__
* | .__/ \__,_|_| \__|_| |_| \__,_|\___|
* |_|
*/
** «partfrac» (to ".partfrac")
** (wld2026p 50 "mangas")
** (wld2026a "mangas")
* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
** (find-angg "MAXIMA/2025-emaxima+.mac")
load ("~/MAXIMA/2025-emaxima.mac");
linenum:0;
display2d:true$
/* block partfrac */
L : (2*x+3) / ((x-4)*(x+5));
R : A/(x-4) + B/(x+5);
eq1 : L = R;
eq2 : eq1 * (x-4)*(x+5);
eq3 : ratsimp(eq2);
eq4 : subst(x=0, eq3);
eq5 : subst(x=1, eq3);
AB : solve([eq4,eq5], [A,B]);
subst(AB, eq1);
* (ee-write-buffer-contents "*maxima*" "/tmp/o")
* (find-angg "LUA/Maxima3.lua" "log-to-i" 4)
/* _ _ _ _
* ___ __| | _____ _____ __ _ _ __ __ _ _ _ ___| |_(_)_ __ __ _| |
* / _ \/ _` |/ _ \ \ / / __| / _` | '__/ _` | | | |/ _ \ __| | '_ \ / _` | |
* | __/ (_| | (_) \ V /\__ \ | (_| | | | (_| | |_| | __/ |_| | |_) | (_| | |
* \___|\__,_|\___/ \_/ |___/ \__,_|_| \__, |\__,_|\___|\__|_| .__/ \__,_|_|
* |_| |_|
*/
** «edovs-arquetipal» (to ".edovs-arquetipal")
** Based on: (find-angg "MAXIMA/2025-1-s.mac" "EDOVS-tests")
** (find-angg "MAXIMA/2025-example-6.mac")
** Used in: (wld2026p 39 "edovs-arquetipal")
** (wld2026a "edovs-arquetipal")
* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
** (find-angg "MAXIMA/2025-emaxima+.mac")
load ("~/MAXIMA/2025-emaxima.mac");
linenum:0;
linel : 110;
[topdf_a,topdf_b,topdf_c,topdf_n] : ["~/LATEX/", "2026logica-para-pessoas/", "edovs", 0];
myqdrawp_to_new_pdf(); myps(s):=ps(s/5);
myqdrawp_to_screen (); myps(s):=ps(s);
display2d:true$
sa_bigstr : "";
sa_addline("% Generated by:");
sa_addline("% (find-angg \"MAXIMA/2026-lpp.mac\" \"edovs-arquetipal\")");
texput('C1, "C_1 ");
texput('C2, "C_2 ");
texput('C3, "C_3 ");
texput('dx, "\\textit{dx}");
texput('dy, "\\textit{dy}");
texput('Hinv, "H^{-1}");
M_ga : ga("[M]");
A_ga : ga("[A]");
S5_ga : ga("[S5]");
S5 : [g(x) = -2*x, h(y) = 2*y,
G(x) = -x^2, H(y) = y^2,
Hinv(y) = sqrt(y)]$
om : EDOVS_M;
oa : EDOVS_M _s_ S5;
dpart(oa, 7,1);
os : _sqrt(y^2);
oa : substpart(os, oa, 7,1);
def_M : M_ga = om;
def_A : A_ga = oa;
def_S5 : S5_ga = V(S5);
sa("EDOVS def [M]", def_M);
sa("EDOVS def [A]", def_A);
sa("EDOVS def [S5]", def_S5);
sa_bigstr;
sa_bigstr_writeto("/tmp/o");
** (find-myqdraw "myqdraw3.mac" "myex")
** (find-myqdraw "myqdraw3.mac" "myimp")
** (find-myqdraw "myqdraw3.mac" "directionfield")
directionfield_xs : seq(-3,3)$
directionfield_ys : seq(-3,3)$
tracinhos : directionfield(-y,x, lc(red))$
[xmin,xmax]:[-1,1]$ semicirc1:myex1(sqrt(1-x^2),lc(red));
[xmin,xmax]:[-2,2]$ semicirc2:myex1(sqrt(4-x^2),lc(orange));
[xmin,xmax]:[-3,3]$ semicirc3:myex1(sqrt(9-x^2),lc(forest_green));
F : x^2 + y^2;
[xmin,ymin, xmax,ymax] : [-4,-4, 4,4];
myqdrawp(xyrange(), tracinhos);
myqdrawp(xyrange(), myimp1(F=1, lc(red)),
myimp1(F=4, lc(orange)),
myimp1(F=9, lc(forest_green)));
myqdrawp(xyrange(), semicirc1, semicirc2, semicirc3);
/* __ __ _
* | _| _ _____ |_ | ___ __ _ _ __| |_ _
* | | (_)_____| | | / _ \/ _` | '__| | | | |
* | | _|_____| | | | __/ (_| | | | | |_| |
* | | (_) | | \___|\__,_|_| |_|\__, |
* |__| |__| |___/
*/
** «subst-early» (to ".subst-early")
** Based on: (find-angg "MAXIMA/2025-1-s.mac" "RC-tests")
** Used in: (bafp 7 "subst-early")
** (bafa "subst-early")
* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
** (find-angg "MAXIMA/2025-emaxima+.mac")
load ("~/MAXIMA/2025-emaxima.mac");
linenum:0;
linel : 110;
display2d:true$
sa_bigstr : "";
sa_addline("% Generated by:");
sa_addline("% (find-angg \"MAXIMA/2026-lpp.mac\" \"subst-early\")");
texput('fp, "f'");
texput('gp, "g'");
Sf : [f(u)=sin(u), fp(u)=cos(u)];
Sg : [g(x)=42*x, gp(x)=42];
RCV _sss_ Sf;
RCV _sss_ Sg;
sa("subst early", %);
sa_bigstr;
sa_bigstr_writeto("/tmp/o");
/* ____ _ _ _ _
* / ___| |__ __ _(_)_ __ _ __ _ _| | ___ / \ _ __ _____ __
* | | | '_ \ / _` | | '_ \ | '__| | | | |/ _ \ / _ \ | '_ \ / _ \ \/ /
* | |___| | | | (_| | | | | | | | | |_| | | __/ / ___ \| |_) | __/> <
* \____|_| |_|\__,_|_|_| |_| |_| \__,_|_|\___| /_/ \_\ .__/ \___/_/\_\
* |_|
*/
** «chain-rule-apex» (to ".chain-rule-apex")
** Used in: (bafp 9 "subst-early")
** (bafa "subst-early")
* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
** (find-angg "MAXIMA/2025-emaxima+.mac")
load ("~/MAXIMA/2025-emaxima.mac");
display2d:true$
[topdf_a,topdf_b,topdf_c,topdf_n] : ["~/LATEX/", "2026logica-para-pessoas/", "chainruleapex", 0];
myqdrawp_to_new_pdf(); myps(s):=ps(s/5);
myqdrawp_to_screen (); myps(s):=ps(s);
[xmin,ymin, xmax,ymax] : [-4,-4, 4,4];
f(x) := x^2;
g(x) := 1-x;
diff(f(g(x)),x);
myqdrawp(xyrange(), myex1(f(g(x)), lc(red)));
myqdrawp(xyrange(), myex1(diff(f(g(x)), x), lc(red)));
** (find-pdf-page "~/LATEX/2026logica-para-pessoas/chainruleapex_001.pdf")
** (find-pdf-page "~/LATEX/2026logica-para-pessoas/chainruleapex_002.pdf")
/* __ __ _ _ _
* | \/ | __ ___ _(_)_ __ ___ __ _ (_)_ __ | |_ _ __ ___
* | |\/| |/ _` \ \/ / | '_ ` _ \ / _` | | | '_ \| __| '__/ _ \
* | | | | (_| |> <| | | | | | | (_| | | | | | | |_| | | (_) |
* |_| |_|\__,_/_/\_\_|_| |_| |_|\__,_| |_|_| |_|\__|_| \___/
*/
** «maxima-intro» (to ".maxima-intro")
** Used in: (bafp 9 "subst-early")
** (bafa "subst-early")
** Based on: (find-angg "MAXIMA/2025-ex-subst.mac" "matrixes")
* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
** (find-angg "MAXIMA/2025-emaxima+.mac")
load ("~/MAXIMA/2025-emaxima+.mac");
linenum:0;
** display2d:true$
/* block mintro matrixes 1 */
matrix([10,20],[30,40]);
bmatrix([10,20],[30,40]);
barematrix([10,20],[30,40]);
verbatimmatrix(["a"], ["bcd"]);
lisptreem(f(a,b));
lisptree2(f(a,b));
/* block mintro matrixes 2 */
lisptree2( matrix([10,20],[30,40]));
lisptree2( bmatrix([10,20],[30,40]));
lisptree2(barematrix([10,20],[30,40]));
lisptree2(verbatimmatrix(["a"], ["bcd"]));
lisptree2(matrix([a,"=",b],["","=",c]));
* (ee-write-buffer-contents "*maxima*" "/tmp/o")
* (find-angg "LUA/Maxima3.lua" "log-to-i" 4)
/* _____ _
* | ____|__ _ _ __ ___| |_ __ _
* | _| / _` | | '__/ _ \ __/ _` |
* | |__| (_| | | | | __/ || (_| |
* |_____\__, | |_| \___|\__\__,_|
* |_|
*/
** «eq-reta» (to ".eq-reta")
** Used in: (bafp 11 "maxima-eq-reta")
** (bafa "maxima-eq-reta")
** Based on: (wld2026p 27 "testes-de-nivelamento-m")
** (wld2026a "testes-de-nivelamento-m")
* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
** (find-angg "MAXIMA/2025-emaxima+.mac")
load ("~/MAXIMA/2025-emaxima.mac");
linenum:0;
** display2d:true$
/* block de-a-equacao-da-reta */
P : [1,2]$
Q : [3,-4]$
f(x) := a*x + b$
eq1 : f(P[1]) = P[2];
eq2 : f(Q[1]) = Q[2];
ab : solve([eq1,eq2], [a,b]);
/* block de-a-equacao-da-reta 2 */
subst(ab, f(x));
define(g(x), %);
g(1);
g(3);
/* block de-a-equacao-da-reta 3 */
subst([a=-3,b=5], a*x+b);
* (ee-write-buffer-contents "*maxima*" "/tmp/o")
* (find-angg "LUA/Maxima3.lua" "log-to-i" 4)
/* ___ __ _
* |_ _|_ __ / _(_)_ __
* | || '_ \| |_| \ \/ /
* | || | | | _| |> <
* |___|_| |_|_| |_/_/\_\
*/
** «infix» (to ".infix")
* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
** (find-angg "MAXIMA/2025-emaxima+.mac")
load ("~/MAXIMA/2025-emaxima.mac");
linenum:0;
display2d:true$
/* block infix 1 */
"_s_"(expr,substs) := subst(substs,expr)$
infix("_s_")$
(a+b) _s_ [a=42];
linenum:0;
/* block infix 2 */
diff(x^2, x);
'diff(x^2, x);
linenum:0;
/* block infix 3 */
a+b=b+a;
a+.b=b+.a;
(a+.b=b+.a) _s_ [a=2,b=3];
* (ee-write-buffer-contents "*maxima*" "/tmp/o")
* (find-angg "LUA/Maxima3.lua" "log-to-i" 4)
/* ____ _ _ _ _
* | _ \ _ __ ___| |_| |_ _ _ ___ _ _| |__ ___| |_
* | |_) | '__/ _ \ __| __| | | | / __| | | | '_ \/ __| __|
* | __/| | | __/ |_| |_| |_| | \__ \ |_| | |_) \__ \ |_
* |_| |_| \___|\__|\__|\__, | |___/\__,_|_.__/|___/\__|
* |___/
*/
** «pretty-subst» (to ".pretty-subst")
** Used in: (bafp 13 "subst-pretty")
** (bafa "subst-pretty")
* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
** (find-angg "MAXIMA/2025-emaxima+.mac")
load ("~/MAXIMA/2025-emaxima+.mac");
linenum:0;
** display2d:true$
/* block pretty subst */
o : a+.b=b+.a$
S : [a=2,b=3]$
V(S);
lisptreem(V(S));
o _ss_ S;
o _sss_ S;
o _ssu_ S;
* (ee-write-buffer-contents "*maxima*" "/tmp/o")
* (find-angg "LUA/Maxima3.lua" "log-to-i" 4)
/* _____ _ _ _ _
* |_ _| __(_) ___| | ___ _ ___ _ _| |__ ___| |_
* | || '__| |/ __| |/ / | | | / __| | | | '_ \/ __| __|
* | || | | | (__| <| |_| | \__ \ |_| | |_) \__ \ |_
* |_||_| |_|\___|_|\_\\__, | |___/\__,_|_.__/|___/\__|
* |___/
*/
** «tricky-subst» (to ".tricky-subst")
* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
** (find-angg "MAXIMA/2025-emaxima+.mac")
load ("~/MAXIMA/2025-emaxima.mac");
linenum:0;
display2d:true$
/* block tricky subst */
o : f(g(x))$
S1 : [f(x)=g(g(x)),
g(x)=f(f(x))]$
S2 : [f=lambda([x],g(g(x))),
g=lambda([x],f(f(x)))]$
subst(S1,o); /* wrong: */
psubst(S1,o); /* wrong: */
psubst(S2,o); /* ok: */
o _sss_ S2; /* ok: */
o _sss_ S1; /* ok: */
* (ee-write-buffer-contents "*maxima*" "/tmp/o")
* (find-angg "LUA/Maxima3.lua" "log-to-i" 4)
/* _ _ _
* | | | | ___ | | ___ ___
* | |_| |/ _ \| |/ _ \/ __|
* | _ | (_) | | __/\__ \
* |_| |_|\___/|_|\___||___/
*/
** «holes» (to ".holes")
* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
** (find-angg "MAXIMA/2025-emaxima+.mac")
load ("~/MAXIMA/2025-emaxima+.mac");
linel : 110;
**display2d:true$
texput('fp, "f'");
texput('gp, "g'");
mkhole(o,path) := apply('substpart, append(["?",o], path))$
mkholes(o,[paths]) := ((for path in paths do o:mkhole(o,path)),o)$
mkholes(f(g(a,b),h(c,d)),[1,1],[2,2]);
linenum:0;
/* block holes 1 */
o : 2 +. 3 +. 4 = 2 +. 7;
lisptree2(o);
lisptree2(dpart(o,2,1));
lisptree2(substpart("?",o,2,1));
/* block holes 2 */
S : [f (x)=x^3,
fp(x)=3*x^2,
g (x)=log(x)+x^2,
gp(x)=1/x+2*x]$
o : RCV _ssu_ S;
mkholes(o, /* [1,2,1,1,2], */
[1,2,2,1,2],
[1,2,3,1,2],
[1,2,4,1,2],
[2,2,2]);
* (ee-write-buffer-contents "*maxima*" "/tmp/o")
* (find-angg "LUA/Maxima3.lua" "log-to-i" 4)
/*
* Local Variables:
* coding: utf-8-unix
* End:
*/