|
Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
/*
* This file:
* http://anggtwu.net/MAXIMA/2025-1-C3-P1-Q1.mac.html
* http://anggtwu.net/MAXIMA/2025-1-C3-P1-Q1.mac
* (find-angg "MAXIMA/2025-1-C3-P1-Q1.mac")
* Author: Eduardo Ochs <eduardoochs@gmail.com>
* See: (find-angg "GNUPLOT/2025-1-C3-P1.dem")
* (c3m251p1p 1 "title")
* (c3m251p1a "title")
*
* «.item-a» (to "item-a")
* «.item-b» (to "item-b")
* «.item-c» (to "item-c")
* «.item-e» (to "item-e")
* «.item-f» (to "item-f")
* «.item-g» (to "item-g")
* «.gab» (to "gab")
*
* (defun e () (interactive) (find-angg "MAXIMA/2025-1-C3-P1-Q1.mac"))
* (find-myqdraw "myqdraw3.mac")
* (find-angg "MAXIMA/2025-cases.mac")
*/
load_myqdraw();
load("~/myqdraw/mydraw3d.mac");
load("~/MAXIMA/2025-cases.mac");
[topdf_a,topdf_b,topdf_c,topdf_n] : ["~/LATEX/", "2025-1-C3/", "P1-Q1", 0];
[xmin,ymin, xmax,ymax] : [0,0, 10,6];
z_NW:2*x-4; z_NE:x;
z_SW:x-2; z_SE:2*x-8;
z_W:0; z_C:x+y-4; z_E:8;
z_M : max(min(z_NW,z_NE,z_C),z_SW,z_SE);
z_all : max(z_W,min(z_M,z_E));
define(F_NW(x,y), z_NW);
define(F_NE(x,y), z_NE);
define(F_SW(x,y), z_SW);
define(F_SE(x,y), z_SE);
define(F_W (x,y), z_W);
define(F_E (x,y), z_E);
define(F_C (x,y), z_C);
define(F (x,y), z_all);
mydraw3d_z(x,y) := F(x,y);
item_a() := mydraw3d(mydraw3d_squares(), noaxes(), prop(), view=[63,287]);
/* «item-a» (to ".item-a")
** (c3m251p1p 3 "questao-1a")
** (c3m251p1a "questao-1a")
* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load("2025-1-C3-P1-Q1.mac");
linel : 110;
numerozinhos([x,y]);
numerozinhos(F(x,y));
item_a()$
*/
M_b : matrix(['F_NW(x,y), "=", F_NW(x,y)],
['F_NE(x,y), "=", F_NE(x,y)],
['F_SW(x,y), "=", F_SW(x,y)],
['F_SE(x,y), "=", F_SE(x,y)],
['F_W (x,y), "=", F_W (x,y)],
['F_E (x,y), "=", F_E (x,y)],
['F_C (x,y), "=", F_C (x,y)]);
item_b : M_b;
/* «item-b» (to ".item-b")
** (c3m251p1p 3 "questao-1b")
** (c3m251p1a "questao-1b")
* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load("2025-1-C3-P1-Q1.mac");
item_b;
*/
eqs : [z=F_C(x,y), z=F_NW(x,y), z=2*t];
eqs2 : solve(eqs, [x,y,z])[1];
subst(eqs2, [x,y,z]);
define(P(t), subst(eqs2, [x,y,z]));
item_c : apply('matrix, makelist([t,P(t)], t,-2,4));
item_d : P(t);
/* «item-c» (to ".item-c")
* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load("2025-1-C3-P1-Q1.mac");
item_c;
item_d;
[P(0), diff(P(t),t)];
P(0) + t * diff(P(t),t);
*/
/* «item-e» (to ".item-e")
* (find-es "maxima" "2024.2-C3-P1-Q1" "gradz(x,y) :=")
*/
define(z(x,y), F(x,y));
eps : 1/4;
z_xr (x,y) := (z(x+eps,y)-z(x,y))/ eps;
z_xl (x,y) := (z(x-eps,y)-z(x,y))/-eps;
z_yu (x,y) := (z(x,y+eps)-z(x,y))/ eps;
z_yd (x,y) := (z(x,y-eps)-z(x,y))/-eps;
gradz(x,y) := if (z_xr(x,y) = z_xl(x,y)) and
(z_yu(x,y) = z_yd(x,y))
then [z_xr(x,y), z_yu(x,y)]
else "X";
item_e : numerozinhos(gradz(x,y));
/*
* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load("2025-1-C3-P1-Q1.mac");
linel : 110;
numerozinhos(gradz(x,y));
*/
Q_L(t) := [1,5] + t*[1,-2];
Q_R(t) := [5,2] + (t-3)*[2,1];
Q(t) := if t < 3 then Q_L(t) else Q_R(t);
x(t) := Q(t)[1];
y(t) := Q(t)[2];
h(t) := F(x(t),y(t));
/* «item-f» (to ".item-f")
** (c3m251p1p 3 "questao-1f")
** (c3m251p1a "questao-1f")
* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load("2025-1-C3-P1-Q1.mac");
[xmin,ymin, xmax,ymax] : [0,0, 6,8];
ts : seqby(0,6, 1/16);
ts : seqby(0,6, 1/32);
ts : seqby(1,2, 1/32);
ts : seqby(0,3, 1/16);
ptss : makelist([t,h(t)], t,ts);
myqdraw(pts(ptss));
myqdraw(xyrange0(), pts(ptss));
myqdraw(xyrange(), pts(ptss));
*/
hg(t) := a*t + b;
gethn(t1,t2) := block([eqs,sol],
eqs : [hg(t1)=h(t1), hg(t2)=h(t2)],
sol : solve(eqs, [a,b]),
subst(sol, hg(t)));
intersect(f1,f2) := rhs(solve(f1(t)=f2(t),t)[1]);
eps : 1/100;
define(h1(t), gethn(1/2, 1/2 +eps));
define(h2(t), gethn(1, 1 +eps));
define(h3(t), gethn(14/10, 14/10-eps));
define(h4(t), gethn(2, 2 +eps));
define(h5(t), gethn(3, 3 +eps));
define(h6(t), gethn(4, 4 +eps));
define(h7(t), gethn(5, 5 +eps));
h12 : intersect(h1, h2);
h23 : intersect(h2, h3);
h34 : intersect(h3, h4);
h45 : 3;
h56 : intersect(h5, h6);
h67 : intersect(h6, h7);
myc : Cases([t<h12, t<h23, t<h34, t<h45, t<h56, t<h67, true],
[h1(t), h2(t), h3(t), h4(t), h5(t), h6(t), h7(t)])$
mycx : Cases([x<h12, x<h23, x<h34, x<h45, x<h56, x<h67, true],
[h1(x), h2(x), h3(x), h4(x), h5(x), h6(x), h7(x)])$
item_f() := ([xmin,ymin, xmax,ymax] : [0,0, 6,8],
myqdraw(xyrange(), mycx@@myex(lc(orange)), mycx@@pts(pc(red))));
item_g : myc@@matrix();
/* like h(t), but defined by cases */
define(hc(t), myc@@makeif());
/* «item-g» (to ".item-g")
** (c3m251p1p 3 "questao-1g")
** (c3m251p1a "questao-1g")
* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load("2025-1-C3-P1-Q1.mac");
myc @@pairs();
myc @@matrix();
myc @@makeif();
mycx@@matrix();
item_f();
item_g;
foo(i) := [mycx@@bi(i), mycx@@fLi(i), mycx@@fRi(i)];
mycx@@n();
apply('matrix, makelist(foo(i), i,1,6));
[xmin,ymin, xmax,ymax] : [0,0, 6,8];
ts : seqby(0,6, 1/16);
ts : seqby(0,6, 1/32);
ts : seqby(1,2, 1/32);
ts : seqby(0,3, 1/16);
pts_h : makelist([t,h(t)], t,ts);
pts_hc : makelist([t,hc(t)+1/10], t,ts);
pts_all : [pts(pts_h), pts(pts_hc, pc(orange))];
myqdraw(pts_all);
myqdraw(xyrange0(), pts_all);
myqdraw(xyrange(), pts_all);
*/
/* «gab» (to ".gab")
** (c3m251p1p 6 "gab-1")
** (c3m251p1a "gab-1")
** (find-Maxima2-links "P1-Q1")
* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load("~/MAXIMA/2025-1-C3-P1-Q1.mac");
linel : 110;
item_a()$
item_b;
item_c;
item_d;
item_e;
item_f();
item_g;
*/