Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
####### # # E-scripts on Qdraw (for Maxima, by Ted Woollett) # # Note 1: use the eev command (defined in eev.el) and the # ee alias (in my .zshrc) to execute parts of this file. # Executing this file as a whole makes no sense. # An introduction to eev can be found here: # # (find-eev-quick-intro) # http://anggtwu.net/eev-intros/find-eev-quick-intro.html # # Note 2: be VERY careful and make sure you understand what # you're doing. # # Note 3: If you use a shell other than zsh things like |& # and the for loops may not work. # # Note 4: I always run as root. # # Note 5: some parts are too old and don't work anymore. Some # never worked. # # Note 6: the definitions for the find-xxxfile commands are on my # .emacs. # # Note 7: if you see a strange command check my .zshrc -- it may # be defined there as a function or an alias. # # Note 8: the sections without dates are always older than the # sections with dates. # # This file is at <http://anggtwu.net/e/qdraw.e> # or at <http://anggtwu.net/e/qdraw.e.html>. # See also <http://anggtwu.net/emacs.html>, # <http://anggtwu.net/.emacs[.html]>, # <http://anggtwu.net/.zshrc[.html]>, # <http://anggtwu.net/escripts.html>, # and <http://anggtwu.net/>. # ####### (find-es "maxima" "qdraw-pts") (find-es "maxima" "2024.1-C3-intro") # «.animations» (to "animations") # «.colors» (to "colors") # «.cut» (to "cut") # «.defaults» (to "defaults") # «.ex» (to "ex") # «.ex1» (to "ex1") # «.imp» (to "imp") # «.imp1» (to "imp1") # «.key» (to "key") # «.label» (to "label") # «.line» (to "line") # «.loaded» (to "loaded") # «.more» (to "more") # «.para» (to "para") # «.para-bug» (to "para-bug") # «.point-types» (to "point-types") # «.poly» (to "poly") # «.polyline» (to "polyline") # «.pts» (to "pts") # «.repeated-options» (to "repeated-options") # «.show_colors» (to "show_colors") # «.terminal» (to "terminal") # «.vector» (to "vector") # «.xr-and-yr» (to "xr-and-yr") # # «.bezier-msg-1» (to "bezier-msg-1") # «.2024.2-C3-traj-11» (to "2024.2-C3-traj-11") # «.intro-core» (to "intro-core") # «.some-conics» (to "some-conics") # «.some-conics-bug» (to "some-conics-bug") # «.mkanim1-low-level» (to "mkanim1-low-level") # # «.qdraw» (to "qdraw") # «.qdraw-pts» (to "qdraw-pts") # «.qdraw-to-pdf» (to "qdraw-to-pdf") # «.terminal-pdf» (to "terminal-pdf") # «.qdraw-poly» (to "qdraw-poly") # «.parabola-boxes» (to "parabola-boxes") # «.parabolas-2024.1» (to "parabolas-2024.1") # «.myqdraw-flatten» (to "myqdraw-flatten") # «.qdraw-taylor» (to "qdraw-taylor") # «.qdraw-imp» (to "qdraw-imp") # «.qdraw-orbita» (to "qdraw-orbita") # «.qdraw-lissajous» (to "qdraw-lissajous") # «.C3-lissajous» (to "C3-lissajous") # «.qdraw-linearize» (to "qdraw-linearize") # «.qdraw-proportional» (to "qdraw-proportional") # «.qdraw-colors» (to "qdraw-colors") # «.qdraw-ex-and-ex1» (to "qdraw-ex-and-ex1") # «.qdraw-3Daxes» (to "qdraw-3Daxes") # (find-angggrep "grep --color=auto -nH --null -e case MAXIMA/qdraw.mac") ##### # # animations # 2024oct22 # ##### # «animations» (to ".animations") # (find-angg "MAXIMA/topdf1.mac" "quick-demo") # (find-angg "MAXIMA/bezier2.mac") # (find-es "maxima" "animations") ##### # # colors # 2024oct07 # ##### # «colors» (to ".colors") # (find-mbe-links 13 10 "3.1 Default colors and available colors") # (find-mbe13page 10 "3.1 Default colors and available colors") # (find-mbe13text 10 "3.1 Default colors and available colors") # (find-maximanode "") # (find-maximanode "set_plot_option") # (find-maximanode "color") # (find-maximanode "Function and Variable Index" "color <1>") # (find-maximanode "proportional_axes") # (find-maximanode "Functions and Variables for draw" "#23ab0f") /* Missing: light_magenta, light_turquoise, dark_pink, dark_yellow */ * (eepitch-maxima) * (eepitch-kill) * (eepitch-maxima) load_qdraw(); show_colors([white, black, gray0, grey0, gray10, grey10, gray20, grey20, gray30, grey30, gray40, grey40, gray50, grey50, gray60, grey60, gray70, grey70, gray80, grey80, gray90, grey90, gray100, grey100, gray, grey, light_gray, light_grey, dark_gray, dark_grey], 20); show_colors([red, light_red, dark_red, yellow, light_yellow], 12); show_colors([green, light_green, dark_green, spring_green, forest_green, sea_green], 12); show_colors([blue, light_blue, dark_blue, midnight_blue, navy, medium_blue, royalblue, skyblue], 12); show_colors([cyan, light_cyan, dark_cyan, magenta, dark_magenta, turquoise, dark_turquoise, pink, light_pink], 12); show_colors([coral, light_coral, orange_red, salmon, light_salmon, dark_salmon, orange, dark_orange, aquamarine, khaki, light_goldenrod, dark_khaki, goldenrod, dark_goldenrod, brown, gold, beige, violet, dark_violet, plum, purple], 12); * (eepitch-maxima) * (eepitch-kill) * (eepitch-maxima) load_qdraw(); show_colors([red, orange, yellow], 10); show_colors([red, orange, yellow], 5); ##### # # cut # 2024oct02 # ##### # «cut» (to ".cut") # (find-mbe13page 5 "no more than one yr(..), one cut(..)") # (find-mbe13text 5 "no more than one yr(..), one cut(..)") # (find-fline "~/MAXIMA/qdraw.mac" "case cut") # (find-angggrep "grep --color=auto -nH --null -e 'cut(' MAXIMA/qdraw.mac") * (eepitch-maxima) * (eepitch-kill) * (eepitch-maxima) load_qdraw(); mypara : para(cos(t), sin(t), t,0,2*%pi); qdraw1v (mypara); qdraw1v (mypara, cut(all)); qdraw (mypara); qdraw (mypara, cut(all)); qdraw (mypara, cut(edge)); qdraw (mypara, cut(grid)); qdraw (mypara, cut(grid,key)); qdraw (mypara, cut(key)); qdraw (mypara, cut(xyaxes)); ##### # # defaults # 2024oct06 # ##### # «defaults» (to ".defaults") # (find-fline "~/MAXIMA/qdraw.mac" "drlist : cons(ip_grid_in =") # (find-fline "~/MAXIMA/qdraw.mac" "if nargs = 3") # (find-fline "~/MAXIMA/qdraw.mac" "case more") # (find-fline "~/MAXIMA/qdraw.mac" "qdraw1([qda]) :=") # # ip_grid_in = [10, 10], (find-maximanode "ip_grid_in") # grid = true, (find-maximanode "grid") # nticks = 100, (find-maximanode "nticks") # key = "", (find-maximanode "key") # line_width = 3, (find-maximanode "line_width") # transparent = true, (find-maximanode "transparent") # point_size = 3, (find-maximanode "point_size") # point_type = 7, (find-maximanode "point_type") # label_alignment = left, (find-maximanode "label_alignment") # head_type = nofilled, (find-maximanode "head_type") # head_angle = 30, (find-maximanode "head_angle") # head_length = 0.5, (find-maximanode "head_length") # parametric(cos(t), sin(2 t), t, 0, 2 %pi), (find-maximanode "parametric(cos(t),") # xaxis = true, (find-maximanode "xaxis") # xaxis_width = 2, (find-maximanode "xaxis_width") # yaxis = true, (find-maximanode "yaxis") # yaxis_width = 2 (find-maximanode "yaxis_width") ##### # # ex # 2024oct04 # ##### # «ex» (to ".ex") # «ex1» (to ".ex1") # (find-mbe13page 6 "3 Quick Plots for Explicit Functions: ex(...) and ex1(...)") # (find-mbe13text 6 "3 Quick Plots for Explicit Functions: ex(...) and ex1(...)") # (find-fline "~/MAXIMA/qdraw.mac" "case ex ") # (find-fline "~/MAXIMA/qdraw.mac" "case ex1 ") # (find-qdraw-links "x,x^2,x^3,x^4" "-2,2" "-2,2") * (eepitch-maxima) * (eepitch-kill) * (eepitch-maxima) load_qdraw(); qdraw(xr(-2,2),yr(-2,2), ex([x,x^2,x^3], x,-2,2)); /* ugly */ qdraw(xr(-2,2),yr(-2,2), ex1(x, x,-2,2, lc(red), lk(x)), ex1(x^2, x,-2,2, lc(orange), lk(x^2)), ex1(x^3, x,-2,2, lc(forest_green), lk(x^3)) ); ##### # # imp and imp1 # 2024oct03 # ##### # «imp» (to ".imp") # «imp1» (to ".imp1") # (find-mbe13page 20 "6 Implicit plots with imp(...) and imp1(...)") # (find-mbe13text 20 "6 Implicit plots with imp(...) and imp1(...)") # (find-fline "~/MAXIMA/qdraw.mac" "For quick plots, use ex(...) and imp(...)") # (find-fline "~/MAXIMA/qdraw.mac" "case imp ") # (find-fline "~/MAXIMA/qdraw.mac" "case imp1 ") # (find-fline "~/MAXIMA/qdraw.mac" "imp(eqnlist,x,xx1,xx2,y,yy1,yy2)") # (find-fline "~/MAXIMA/qdraw.mac" "imp1(eqn,x,x1,x2,y,y1,y2,lc(c),lw(n),lk(string) )") # (find-fline "~/MAXIMA/qdraw.mac" "clist : makelist(color=cc[ qval(kk) ],kk,1,lendr )") # (find-fline "~/MAXIMA/qdraw.mac" "default color selection list for ex(..) and imp(...)") # (find-myqdraw "myqdraw3.mac" "myimp") * (eepitch-maxima) * (eepitch-kill) * (eepitch-maxima) load_myqdraw(); C : x^2+y^2; qdraw1v (imp([C=1,C=2,C=3,C=4], x,-2,2, y,-2,2)); qdraw1v (imp1(C=1, x,-2,2, y,-2,2, lc(red)), imp1(C=2, x,-2,2, y,-2,2, lc(orange)), imp1(C=3, x,-2,2, y,-2,2, lc(forest_green))); qdraw (imp([C=1,C=2,C=3,C=4], x,-2,2, y,-2,2)); qdraw (imp1(C=1, x,-2,2, y,-2,2, lc(red)), imp1(C=2, x,-2,2, y,-2,2, lc(orange)), imp1(C=3, x,-2,2, y,-2,2, lc(forest_green))); * (eepitch-maxima) * (eepitch-kill) * (eepitch-maxima) load_myqdraw(); C : x^2+y^2; [xmin,ymin, xmax,ymax] : [-2,-2, 2,2]; myqdraw( myimp([C=1,C=2,C=3,C=4])); myqdraw(xyrange(), myimp([C=1,C=2,C=3,C=4])); myqdraw(xyrange(), myimp1(C=1, lc(red)), myimp1(C=2, lc(orange)), myimp1(C=3, lc(forest_green))); ##### # # key # 2024oct04 # ##### # «key» (to ".key") # (find-mbe13page 5 "key(bottom)") # (find-mbe13text 5 "key(bottom)") # (find-fline "~/MAXIMA/qdraw.mac" "case key") * (eepitch-maxima) * (eepitch-kill) * (eepitch-maxima) load_qdraw(); qdraw1v (ex1(x^2, x,-2,2, lc(orange), lk("x^2"))); qdraw1v (ex1(x^2, x,-2,2, lc(orange), lk("x^2")), key(bottom)); qdraw (ex1(x^2, x,-2,2, lc(orange), lk("x^2"))); qdraw (ex1(x^2, x,-2,2, lc(orange), lk("x^2")), key(bottom)); ##### # # label # 2024oct07 # ##### # «label» (to ".label") # (find-mbe13page 50 "The qdraw.mac function label") # (find-mbe13text 50 "The qdraw.mac function label") # (find-mbe13page 52 "/Helvetica=18") # (find-mbe13text 52 "/Helvetica=18") # (find-mbe13page 52 "label_align(c)") # (find-mbe13text 52 "label_align(c)") # (find-maximanode "label") # (find-maximanode "label_alignment") # (find-maximanode "Functions and Variables for draw" "Graphic object: label") # (find-fline "~/MAXIMA/qdraw.mac" "case label") # (find-es "maxima" "qdraw-label") * (eepitch-maxima) * (eepitch-kill) * (eepitch-maxima) load_qdraw(); qdraw(xr(0,3), yr(0,3), label(["a",1,1]), label(["b",2,1]) )$ ##### # # line # 2024oct06 # ##### # «line» (to ".line") # (find-mbe13page 5 "line(x1,y1,x2,y2,lc(c),lw(n),lk(string) )") # (find-mbe13text 5 "line(x1,y1,x2,y2,lc(c),lw(n),lk(string) )") # (find-mbe13page 39 "11.1 line(...)") # (find-mbe13text 39 "11.1 line(...)") # (find-fline "~/MAXIMA/qdraw.mac" "case line") * (eepitch-maxima) * (eepitch-kill) * (eepitch-maxima) load_qdraw(); qdraw(xr(0,3), yr(0,3), line(1,2, 1.1,2.2, lc(red))); qdraw(xr(0,3), yr(0,3), line(1,2, 1.1,2.2, lc(red), lc(orange))); qdraw(xr(0,3), yr(0,3), line(1,2, 1.1,2.2, lc(orange), lc(red))); ##### # # Check if qdraw has been loaded # 2024nov01 # ##### # «loaded» (to ".loaded") # (find-fline "~/MAXIMA/qdraw.mac" "fll") # (find-fline "~/MAXIMA/qdraw.mac" "fll(x) :=") * (eepitch-maxima) * (eepitch-kill) * (eepitch-maxima) myqdraw_qdraw_loaded() := is(fll([42])=[42,42,1]); myqdraw_qdraw_loaded(); if not myqdraw_qdraw_loaded() then load_qdraw(); myqdraw_qdraw_loaded(); if not myqdraw_qdraw_loaded() then load_qdraw(); ##### # # more # 2024oct06 # ##### # «more» (to ".more") # (find-mbe13page 56 "the qdraw function more(...)") # (find-mbe13text 56 "the qdraw function more(...)") # (find-fline "~/MAXIMA/qdraw.mac" "case more") # (find-maximanode "proportional_axes") * (eepitch-maxima) * (eepitch-kill) * (eepitch-maxima) load_qdraw(); qdraw1v (ex1(x^3, x,-2,2, lc(orange))); qdraw1v (ex1(x^3, x,-2,2, lc(orange)), more(proportional_axes=xy)); qdraw (ex1(x^3, x,-2,2, lc(orange))); qdraw (ex1(x^3, x,-2,2, lc(orange)), more(proportional_axes=xy)); ##### # # para # 2024oct02 # ##### # «para» (to ".para") # (find-mbe-links 13 18 "4 Parametric plots with para(...)") # (find-mbe13page 18 "4 Parametric plots with para(...)") # (find-mbe13text 18 "4 Parametric plots with para(...)") # (find-fline "~/MAXIMA/qdraw.mac" "para( xofu,yofu,u,u1,u2,lc(c),lw(n),lk(string) )") # (find-fline "~/MAXIMA/qdraw.mac" "para(...)") # (find-fline "~/MAXIMA/qdraw.mac" "case para") # (find-maximanode "plot2d") # (find-maximanode "plot2d" "parametric") # (find-maximanode "plot2d" "3. Parametric function") # (find-angg "MAXIMA/myqdraw2.mac" "mypara") * (eepitch-maxima) * (eepitch-kill) * (eepitch-maxima) load_qdraw(); qdraw1v ([qda]) := mapconcat('string, apply('qdraw1, qda), newline); P(t) := [cos(t), sin(2*t)]; qdraw1 (para(P(t)[1], P(t)[2], t,0,2*%pi)); qdraw1v (para(P(t)[1], P(t)[2], t,0,2*%pi)); qdraw (para(P(t)[1], P(t)[2], t,0,2*%pi)); ##### # # para-bug # 2024oct09 # ##### # «para-bug» (to ".para-bug") # (find-es "maxima" "draw2d-parametric-bug") # (find-maximamsg "58826903 202410 10" "Edrx: /* redefine as */") # (to "2024.2-C3-traj-11") * (eepitch-maxima) * (eepitch-kill) * (eepitch-maxima) ** (find-myqdraw "myqdraw3.mac") load_myqdraw(); P(t) := if t <= 6 then [t,4] else [6,10-t]; /* redefine as: */ P(t) := [if t <= 6 then t else 6, /* x */ if t <= 6 then 4 else 10-t]; /* y */ myqdraw(xr(-1,8),yr(-1,8), para(P(t)[1],P(t)[2], t,0,10)); mypara(xy,[rest]) := myapply('para,xy[1],xy[2],rest); myqdraw(xr(-1,8),yr(-1,8), mypara(P(t), t,0,10)); ##### # # point-types # 2024oct21 # ##### # «point-types» (to ".point-types") # (find-mbe13page 16 "The optional argument pt(ntype)") # (find-mbe13text 16 "The optional argument pt(ntype)") # (find-fline "~/MAXIMA/qdraw.mac" "point_types() produces") # (find-angg "MAXIMA/myqdraw3.mac" "pts_open") # (find-maximanode "points_joined") * (eepitch-maxima) * (eepitch-kill) * (eepitch-maxima) load_qdraw(); qdraw(point_types()); [pt_open,pt_closed] : [pt(6),pt(7)]; qdraw(xr(-1,4),yr(-1,3), para(x,1, x,1,3), pts([[1,1]], pt_closed, pc(white)), pts([[1,1]], pt_open), pts([[2,1]], pt_open), pts([[3,1]], pt_closed)); ##### # # poly # 2024oct03 # ##### # «poly» (to ".poly") # (find-mbe-links 13 5 "poly(") # (find-mbe13page 5 "poly(") # (find-mbe13text 5 "poly(") # (find-fline "~/MAXIMA/qdraw.mac" "poly([ [x1,y1],[x2,y2],.,[xN,yN] ], lc(c),lw(n),fill(cc) )") # (find-fline "~/MAXIMA/qdraw.mac" "case poly") # (find-maximanode "polygon") * (eepitch-maxima) * (eepitch-kill) * (eepitch-maxima) load_qdraw(); to_rad(deg) := deg/180*%pi; P_rad(t_rad) := [cos(t_rad), sin(t_rad)]; P(t_deg) := P_rad(to_rad(t_deg)); mypoly : [P(0), P(30), P(90), P(180)]; qdraw1v (poly(mypoly)); qdraw1v (poly(mypoly, lc(red), fill(yellow))); qdraw (poly(mypoly)); qdraw (poly(mypoly, lc(red), fill(yellow))); ##### # # polyline # 2024oct30 # ##### # «polyline» (to ".polyline") # (find-es "pict2e" "manual") # (find-pict2epage 9 "\\polyline( X1,Y1 )( X2,Y2 ). . . ( Xn,Yn )") # (find-pict2etext 9 "\\polyline( X1,Y1 )( X2,Y2 ). . . ( Xn,Yn )") # (find-maximanode "Function and Variable Index" "* line_type:") # (to "pts") * (eepitch-maxima) * (eepitch-kill) * (eepitch-maxima) ** (find-myqdraw "myqdraw3.mac") load_myqdraw(); polyline(Pts,[opts]) := myapply_fl('pts, Pts, pt(0), opts); myqdraw(xyrange(), line(1,1,2,2)); myqdraw(xyrange(), polyline([[1,1],[2,2],[3,2]], pc(red), pj(2))); myqdraw(xyrange(), polyline([[1,1],[2,2],[3,2]], pc(orange), pj(4))); ##### # # pts # 2024oct03 # ##### # «pts» (to ".pts") # (find-mbe13page 9 "We can use pts(...)") # (find-mbe13text 9 "We can use pts(...)") # (find-mbe13page 10 "Repeated use of pts(..) does not cycle") # (find-mbe13text 10 "Repeated use of pts(..) does not cycle") # (find-mbe13page 16 "3.3 Placing discrete points: the syntax of pts(...)") # (find-mbe13text 16 "3.3 Placing discrete points: the syntax of pts(...)") # (find-mbe13page 16 "pj(nwidth), (points joined)") # (find-mbe13text 16 "pj(nwidth), (points joined)") # (find-mbe13page 36 "The most basic plot of this data uses the pts(...) function defaults:") # (find-mbe13text 36 "The most basic plot of this data uses the pts(...) function defaults:") # (find-fline "~/MAXIMA/qdraw.mac" "pts( [ [x1,y1],[x2,y2],.,[xN,yN] ],") # (find-fline "~/MAXIMA/qdraw.mac" "case pts") * (eepitch-maxima) * (eepitch-kill) * (eepitch-maxima) load_qdraw(); degs : %pi/180; P(t) := [cos(t*degs), sin(t*degs)]; mypts : [P(0), P(30), P(90), P(180)]; qdraw(pts(mypts)); qdraw(pts(mypts, pc(red), pj(1))); qdraw(pts(mypts, pc(red), pj(1), pt(0))); qdraw(pts(mypts, pc(red), pj(2), pt(0))); ##### # # repeated-options # 2024oct06 # ##### # «repeated-options» (to ".repeated-options") * (eepitch-maxima) * (eepitch-kill) * (eepitch-maxima) load_qdraw(); qdraw(xr(0,3), yr(0,3), line(1,2, 1.1,2.2, lc(red))); qdraw(xr(0,3), yr(0,3), line(1,2, 1.1,2.2, lc(red), lc(orange))); /* -> red */ qdraw(xr(0,3), yr(0,3), line(1,2, 1.1,2.2, lc(orange), lc(red))); /* -> orange */ ##### # # show_colors # 2024oct03 # ##### # «show_colors» (to ".show_colors") # (find-fline "~/MAXIMA/qdraw.mac" "show_colors(color_list, nlw) :=") * (eepitch-maxima) * (eepitch-kill) * (eepitch-maxima) load_qdraw(); show_colors([red, green, blue], 4); ##### # # terminal # 2024oct04 # ##### # «terminal» (to ".terminal") # (find-angg "MAXIMA/myqdraw1.mac" "myQdraw-pdf") # (find-es "maxima" "terminal-tikz") # (find-es "maxima" "qdraw-to-pdf") # (find-es "maxima" "terminal-pdf") # (find-es "maxima" "log-constants-anim") # (find-qdraw-links "x,x^2,x^3,x^4" "-2,2" "-2,2") * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) # (find-fline "/tmp/qdraw/") rm -Rfv /tmp/qdraw/ mkdir /tmp/qdraw/ cd /tmp/qdraw/ * (eepitch-maxima) * (eepitch-kill) * (eepitch-maxima) load_qdraw(); mycolors : [red, orange, forest_green]; myqdraw1([dra]) := flatten([dra])$ myqdraw ([dra]) := apply('qdraw, flatten([dra]))$ mypreamble() := [xr(-2,2),yr(-2,2)]$ mycurve(k) := ex1(x^k, x,-2,2, lc(mycolors[k]))$ mydrawing(k) := [mypreamble(), makelist(mycurve(k),k,1,k)]; topdf(n) := more(terminal=pdf, file_name=concat("/tmp/qdraw/test", n))$ myqdraw1(mydrawing(1)); myqdraw1(mydrawing(2)); myqdraw1(mydrawing(1), topdf(1)); myqdraw1(mydrawing(2), topdf(2)); myqdraw (mydrawing(1)); /* draw */ myqdraw (mydrawing(2)); /* draw */ myqdraw (mydrawing(1), topdf(1)); /* save */ myqdraw (mydrawing(2), topdf(2)); /* save */ myqdraw (mydrawing(3), topdf(3)); /* save */ ** (find-pdf-page "/tmp/qdraw/test1.pdf") ** (find-pdf-page "/tmp/qdraw/test2.pdf") ** (find-pdf-page "/tmp/qdraw/test3.pdf") ##### # # vector # 2024oct04 # ##### # «vector» (to ".vector") # (find-mbe13page 47 "11.5 vector(...)") # (find-mbe13text 47 "11.5 vector(...)") # (find-fline "~/MAXIMA/qdraw.mac" "vector( [x,y],[dx,dy],lw(n),lc(c),lk(string),") # (find-fline "~/MAXIMA/qdraw.mac" "ha(deg),hb(v),hl(v),ht(t) )") # (find-fline "~/MAXIMA/qdraw.mac" "case vector") # (find-fline "~/MAXIMA/qdraw.mac" "case vector" "head length") # (find-fline "~/MAXIMA/qdraw.mac" "case vector" "head type" "ht(f) for" "filled") # (find-fline "~/MAXIMA/qdraw.mac" "case arrowhead") * (eepitch-maxima) * (eepitch-kill) * (eepitch-maxima) load_qdraw(); P(t) := [cos(t),sin(t)]; define(vel(t), diff(P(t), x)); drawing : [xr(0,4),yr(0,4), pts ([[3,2]]), vector([3,2], [0,1], hl(0.2), ht(f))]; apply(qdraw1v, drawing); apply(qdraw, drawing); * (eepitch-maxima) * (eepitch-kill) * (eepitch-maxima) ** (find-angg "MAXIMA/myqdraw2.mac") load ("~/MAXIMA/myqdraw2.mac"); P(t) := [cos(t),sin(t)]; define(vel(t), diff(P(t), x)); myPvec(P,v,Popts,[vopts]) := [myapply_fl('pts, [P], Popts), myapply_fl('vector, P,v, vopts)]; drawing : [xr(0,4),yr(0,4), myPvec([3,2], [0,1], [pc(red)], hl(0.2), ht(f), lc(orange))]; myqdraw (drawing); drawing : [xr(0,4),yr(0,4), pts ([[3,2]]), vector([3,2], [0,1], hl(0.2), ht(f))]; drawing : [xr(0,4),yr(0,4), pts ([[3,2]]), vector([3,2], [0,1], hl(0.2), ht(f))]; myqdraw1v(drawing); myqdraw (drawing); ##### # # xr-and-yr # 2024oct10 # ##### # «xr-and-yr» (to ".xr-and-yr") # (find-fline "~/MAXIMA/qdraw.mac" "case xr") # (find-fline "~/MAXIMA/qdraw.mac" "case yr") # (to "vector") ##### # # bezier-msg-1 # 2024oct11 # ##### # «bezier-msg-1» (to ".bezier-msg-1") ##### # # 2024.2-C3-traj-11 # 2024oct22 # ##### # «2024.2-C3-traj-11» (to ".2024.2-C3-traj-11") # (find-angg "MAXIMA/myqdraw3.mac" "pts_open") # http://anggtwu.net/2024.2-C3/C3-quadros.pdf#page=16 # http://anggtwu.net/LATEX/2024-1-C3-trajetorias.pdf#page=22 # (c3m241trajp 22 "bico-e-teleporte") # (c3m241traja "bico-e-teleporte") # (to "para-bug") * (eepitch-maxima) * (eepitch-kill) * (eepitch-maxima) ** (find-myqdraw "myqdraw3.mac") load_myqdraw(); [xmin,ymin, xmax,ymax] : [0,0, 8,7]; R(t) := if t <= 6 then [t,4] else [5,11-t]; /* redefine as: */ R(t) := [if t <= 6 then t else 5, /* x */ if t <= 6 then 4 else 11-t]; /* y */ color_traco : orange; color_pts : blue; /* Ruim: */ traco : [mypara(R(t), t,0,11, lc(color_traco))]$ myqdraw(xyrange(), traco); /* Bom: */ traco : [mypara(R(t), t,0,5.999, lc(color_traco)), mypara(R(t), t,6.001,11, lc(color_traco)), pts ([R(5.999)], ps(2),pc(color_traco)), pts_open([R(6.001)], ps(2),pc(color_traco))]$ myqdraw(xyrange(), traco); Rsec (t0,epsilon) := myPPe_c(R(t0),R(t0+epsilon),epsilon,color_pts); Rsecs(t0,epsilons) := makelist(Rsec(t0,epsilon), epsilon, epsilons); myqdraw(xyrange(), traco, Rsecs(1, [1/2, 1/4])); myqdraw(xyrange(), traco, Rsecs(6, [5, 4, 3, 2.5, 2.0, 1.5, 1, 0.75, 0.5, 0.25])); ##### # # intro-core # 2024nov02 # ##### # «intro-core» (to ".intro-core") # (to "C3-lissajous") * (eepitch-maxima) * (eepitch-kill) * (eepitch-maxima) load_qdraw(); P : [cos(t), sin(2*t)]; ts : [0, %pi/4, %pi/2]; define(P(t), P); define(Pt(t), diff(P,t)); define(Ptt(t), diff(P,t,2)); qdraw(xr(-4,4),yr(-4,4), para(P[1],P[2], t,0,2*%pi, lc(orange)), vector(P(0), Pt(0), hl(0.1),lc(red)), vector(P(%pi/4),Pt(%pi/4), hl(0.1),lc(red)), vector(P(0), Ptt(0), hl(0.1),lc(forest_green)), vector(P(%pi/4),Ptt(%pi/4), hl(0.1),lc(forest_green)) ); myqdraw([drargs]) := apply('qdraw, flatten([drargs])); myqdraw(xr(-4,4),yr(-4,4), para(P[1],P[2], t,0,2*%pi, lc(orange)), makelist(vector(P(t),Pt (t), hl(0.1),lc(red)), t, ts), makelist(vector(P(t),Ptt(t), hl(0.1),lc(forest_green)), t, ts) ); ##### # # some-conics # 2024nov03 # ##### # «some-conics» (to ".some-conics") # http://anggtwu.net/myqdraw/some_conics.gif # http://anggtwu.net/myqdraw/some_conics.pdf # (find-es "maxima" "stringdisp") * (setq last-kbd-macro (kbd "C-a %M SPC C-a <down>")) * (find-sh0 "rm -fv /tmp/some_conics*") * (find-sh0 "rm -fv ~/LATEX/2024-2-C3/test*") * (eepitch-maxima) * (eepitch-kill) * (eepitch-maxima) load("/usr/share/emacs/site-lisp/maxima/emaxima.lisp")$ :lisp (setf (get '$display2d 'assign) nil) /* load("~/MAXIMA/barematrix1.mac")$ */ load_myqdraw(); display2d:'emaxima$ stringdisp : false; topdf_opts : "height=2cm"$ [topdf_a,topdf_b,topdf_c,topdf_n] : ["/tmp/", "", "conic", 0]$ [topdf_a,topdf_b,topdf_c,topdf_n] : ["/tmp/", "", "some_conics", 0]$ [topdf_a,topdf_b,topdf_c,topdf_n] : ["~/LATEX/", "2024-2-C3/", "test", 0]$ myqdrawp_to_screen(); myqdrawp_to_new_pdf(); linenum:0; [xmin,ymin, xmax,ymax] : [-2,-2, 2,2]$ [color[-2], color[-1], color[0], color[1], color[2]] : [blue, forest_green, gold, orange, red]$ arrayinfo(color); conic (a,b) := (x^2 + a*y + b*y^2 = 1)$ draw_abck(a,b,c) := myimp1(conic(a,b), lc(color[c]), lk(conic(a,b)))$ draw_abc (a,b,c) := myimp1(conic(a,b), lc(color[c]))$ draw_abk (a,b) := draw_abck(a,b,b)$ draw_ab (a,b) := draw_abc (a,b,b)$ draw_a (a) := makelist(draw_ab(a,b), b, [2,1,0,-1,-2])$ makeM1() := matrix([ "", "", f(0,1), "", ""], [ "", f(-1,0), f(0,0), f(1,0), ""], [f(-2,-1), "", "", "", f(2,-1)])$ makeM2() := matrix([g(-2), g(-1), g(0), g(1), g(2) ])$ f(a,b) := myqdrawp(xyrange(), draw_abk(a,b))$ g(a) := myqdrawp(xyrange(), draw_a(a))$ M1 : makeM1()$ M2 : makeM2()$ stringdisp : false; M1; M2; myqdrawp(xyrange(), draw_abk( 0, 1)); /* circle */ myqdrawp(xyrange(), draw_abk( 0, 0)); /* degenerated parabola */ myqdrawp(xyrange(), draw_abk(-1, 0)); /* parabola */ myqdrawp(xyrange(), draw_abk( 1, 0)); /* parabola */ myqdrawp(xyrange(), draw_abk( 2,-1)); /* degenerated hyperbole */ myqdrawp(xyrange(), draw_abk(-2,-1)); /* degenerated hyperbole */ ##### # # some-conics-bug # 2024nov03 # ##### # «some-conics-bug» (to ".some-conics-bug") * (setq last-kbd-macro (kbd "C-a %M SPC C-a <down>")) * (find-sh0 "rm -fv /tmp/some_conics*") * (find-sh0 "rm -fv ~/LATEX/2024-2-C3/test*") * (eepitch-maxima) * (eepitch-kill) * (eepitch-maxima) load("/usr/share/emacs/site-lisp/maxima/emaxima.lisp")$ :lisp (setf (get '$display2d 'assign) nil) load("~/MAXIMA/barematrix1.mac")$ load_myqdraw(); display2d:'emaxima$ stringdisp : false; linenum:0; [xmin,ymin, xmax,ymax] : [-2,-2, 2,2]$ [color[-2], color[-1], color[0], color[1], color[2]] : [blue, forest_green, gold, orange, red]$ topdf_opts : "height=1cm"$ [topdf_a,topdf_b,topdf_c,topdf_n] : ["~/LATEX/", "2024-2-C3/", "test", 0]$ myqdrawp_to_new_pdf(); conic (a,b) := (x^2 + a*y + b*y^2 = 1)$ draw_abck(a,b,c) := myimp1(conic(a,b), lc(color[c]), lk(conic(a,b)))$ draw_abk (a,b) := draw_abck(a,b,b)$ stringdisp : false; makeM1() := matrix([ "", "", f(0,1), "", ""], [ "", f(-1,0), f(0,0), f(1,0), ""], [f(-2,-1), "", "", "", f(2,-1)]); f(a,b) := myqdrawp(xyrange(), draw_abk(a,b))$ stringdisp; stringdisp : false; M1 : makeM1(); stringdisp : false; M1; M1[1]; M1[1][1]; stringdisp : false; M1[1][1]; stringp(M1[1][1]); M1; f(a,b) := includegraphics("foo","bar"); draw_abc (a,b,c) := myimp1(conic(a,b), lc(color[c]))$ draw_ab (a,b) := draw_abc (a,b,b)$ draw_a (a) := makelist(draw_ab(a,b), b, [2,1,0,-1,-2])$ myqdrawp(xyrange(), draw_abk( 0, 1)); /* circle */ myqdrawp(xyrange(), draw_abk( 0, 0)); /* degenerated parabola */ myqdrawp(xyrange(), draw_abk(-1, 0)); /* parabola */ myqdrawp(xyrange(), draw_abk( 1, 0)); /* parabola */ myqdrawp(xyrange(), draw_abk( 2,-1)); /* degenerated hyperbole */ myqdrawp(xyrange(), draw_abk(-2,-1)); /* degenerated hyperbole */ makeM2() := matrix([g(-2), g(-1), g(0), g(1), g(2) ]); g(a) := myqdrawp(xyrange(), draw_a(a))$ M2 : makeM2(); [topdf_a,topdf_b,topdf_c,topdf_n] : ["/tmp/", "", "conic", 0]; [topdf_a,topdf_b,topdf_c,topdf_n] : ["~/LATEX/", "2024-2-C3/", "test", 0]; myqdrawp_to_new_pdf(); myqdraw(xyrange(), draw_a(0)); myqdraw(xyrange(), draw_a(-1)); myqdraw(xyrange(), draw_a(2)); myqdraw(xyrange(), draw_a(-2)); conic(0,0); conic(1,0); conic(-1,0); myqdraw(xyrange(), draw_a(0)); myqdraw(xyrange(), draw_a(1)); myqdraw(xyrange(), draw_a(2)); draw_abc(0,0,0); myqdrawp(xyrange(), makelist(drawab(a,b), a, [2,1,0,-1,-2])); draw_b(b) := makelist(drawab(a,b), a, [2,1,0,-1,-2]) * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) ls -lAF /tmp/some_conics* ~/myqdraw/mkanim1.sh \ DENSITY=50 DELAY=25 \ makeboth /tmp/some_conics.gif /tmp/some_conics.pdf /tmp/some_conics_* ls -lAF /tmp/some_conics* # (brg "file:///tmp/some_conics.gif") # (find-pdf-page "/tmp/some_conics.pdf") ##### # # mkanim1-low-level # 2024nov05 # ##### # «mkanim1-low-level» (to ".mkanim1-low-level") # https://github.com/qpdf/qpdf/issues/11#issuecomment-18768487 do echo $i 1-z # https://apple.stackexchange.com/questions/86177/imagemagick-convert-multipage-pdf-to-animated-gif * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) cd /tmp/ ls -lAF frame* add_1zs () { for i in $*; do echo $i 1-z; done; } add_1zs frame_*.pdf qpdf --empty --pages $(add_1zs frame_*.pdf) -- frames.pdf ls -lAF frame* ** ** Inspect frames.pdf with: ** (find-fline "/tmp/" "frames.pdf") ** (find-pdf-page "/tmp/frames.pdf") convert -alpha deactivate -verbose -delay 50 -loop 0 -density 150 \ /tmp/frames.pdf /tmp/frames.gif ls -lAF frame* ** ** See: file:///tmp/frames.gif ** (brg "/tmp/frames.gif") ##### # # qdraw # 2023jul09 # ##### # «qdraw» (to ".qdraw") # «qdraw-pts» (to ".qdraw-pts") # (find-es "qdraw") # (find-angg ".maxima/maxima-init.mac" "load_qdraw") # (find-mbefile "" "mbe13qdraw.pdf") # (find-mbe13page) # (find-mbe13text) # (find-mbefile "" "qdraw.mac") # (find-mbefile "qdraw.mac") # (find-mbefile "qdrawcode.txt") # (find-mbe-links 13 1 "") # (find-mbe-links 13 8 "") # (find-mbe-links 13 39 "11.1 line(...)") # (find-mbe-links 13 18 "4 Parametric plots with para(...)") # (find-mbe13page 18 "4 Parametric plots with para(...)") # (find-mbe13text 18 "4 Parametric plots with para(...)") # (find-mbe13page 47 "11.5 vector(...)") # (find-mbe13text 47 "11.5 vector(...)") # (find-mbe13page 56 "13 Even More with more(...)") # (find-mbe13text 56 "13 Even More with more(...)") # (find-mbe13page 9 "pts ( [ [-1,-1], [0,0],[1,1] ], ps(2), pc(magenta))") # (find-mbe13text 9 "pts ( [ [-1,-1], [0,0],[1,1] ], ps(2), pc(magenta))") * (eepitch-maxima) * (eepitch-kill) * (eepitch-maxima) load_qdraw(); qdraw( ex ( [x,x^2,x^3],x,-3,3), line ( -3,0,3,0, lc(brown), lw(1)), more (xlabel = "X", title = "Using ex(..) for three functions") )$ qdraw(xr(-1.5,2),yr(-2,2), para(sin(t),sin(2*t),t,0,2*%pi ), pts( [ [0,0] ],ps(1),pc(brown),pk("t = 0")), pts( [ [sin(%pi/8),sin(%pi/4)] ],ps(1),pc(red),pk("t = pi/8")), pts( [ [1,0] ],ps(1),pc(green),pk("t = pi/2")), more (title = "parametric plot", xlabel = "sin(t)", ylabel = "sin(2*t)"))$ ##### # # qdraw-to-pdf # 2024jul20 # ##### # «qdraw-to-pdf» (to ".qdraw-to-pdf") # «terminal-pdf» (to ".terminal-pdf") # (to "terminal-tikz") # (find-maximanode "Plotting Options" "Plot option: pdf_file") # (find-maximanode "Gnuplot Options" "gnuplot_term [gnuplot_term, <terminal_name>]") # (find-angg ".maxima/maxima-init.mac" "load_qdraw") # (find-myqdraw "myqdraw3.mac" "myterminalpdf") * (eepitch-maxima) * (eepitch-kill) * (eepitch-maxima) ** (find-angg "MAXIMA/zpts1.mac") load ("~/MAXIMA/zpts1.mac")$ myqdraw( xr(0,2*%pi), yr(-2,2), more(proportional_axes=xy), ex([sin(x), cos(x)], x,0,2*%pi) ); myqdraw0( more(terminal=pdf, file_name="/tmp/test"), more(terminal=pdf, file_name="/tmp/test"), myqdraw_body ); myqdraw0( more(terminal=pdf), more(file_name="/tmp/test"), myqdraw_body ); ** (find-fline "/tmp/" "test.pdf") ** (find-pdf-page "/tmp/test.pdf") * (eepitch-maxima) * (eepitch-kill) * (eepitch-maxima) ** (find-myqdraw "myqdraw3.mac") load_myqdraw(); myqdraw( more(terminal=tikz, file_name="/tmp/test"), xr(0,2*%pi), yr(-2,2), more(proportional_axes=xy), ex([sin(x), cos(x)], x,0,2*%pi) ); ##### # # Draw boxes on the 5 "simplest" points of a parabola using qdraw # 2023sep25 # ##### # «qdraw-poly» (to ".qdraw-poly") # «parabola-boxes» (to ".parabola-boxes") # (find-mbe-links 13 5 "poly(") # (find-mbe13page 5 "poly(") # (find-mbe13text 5 "poly(") # (find-TH "eev-maxima" "maxima-by-example") * (eepitch-maxima) * (eepitch-kill) * (eepitch-maxima) load_qdraw(); myqdraw([lists]) := apply('qdraw, apply('append, lists)); P : [cos(t), sin(t)]; Pt : diff(P, t); Ptt : diff(P, t, 2); define(P(t), P); define(Pt(t), Pt); define(Ptt(t), Ptt); t0 : %pi/4; t0 : 0; [A,uu,vv] : [P(t0), Pt(t0), Ptt(t0)]; B(u,v) := A + u*uu + v*vv/2; B(0,0); Q : P(t0) + t*Pt(t0) + t^2*Ptt(t0)/2; define(Q(t), Q); qdraw( xr(-4.5,4.5), yr(-4,4), poly([B(0,0), B( 1,0), B( 1,1), B(0,1)], lc(brown)), poly([B(0,0), B(-1,0), B(-1,1), B(0,1)], lc(brown)), poly([B(0,0), B( 2,0), B( 2,4), B(0,4)], lc(brown)), poly([B(0,0), B(-2,0), B(-2,4), B(0,4)], lc(brown)), para(P[1],P[2], t, 0,2*%pi, lc(red)), para(Q[1],Q[2], t, -2,2, lc(orange)) )$ [Q(0), Q(1) , Q(2)]; [Q(0), Q(-1), Q(-2)]; ##### # # parabolas-2024.1 # 2024mar27 # ##### # «parabolas-2024.1» (to ".parabolas-2024.1") # «myqdraw-flatten» (to ".myqdraw-flatten") # (find-angg ".maxima/maxima-init.mac" "load_qdraw") * (eepitch-maxima) * (eepitch-kill) * (eepitch-maxima) load_qdraw(); myqdraw0([lists]) := apply('qdraw, flatten([lists])); myqdraw ([lists]) := block([], myqdraw_body : lists, apply('myqdraw0, lists)); mypoly([pts]) := poly(pts, lc(orange)); myvec(xy, dxdy) := vector(xy, dxdy, hl(0.1), lw(5), lc(purple)); defs1() := block([], define(Pt(t), diff(P(t),t)), define(Ptt(t), diff(P(t),t,2)), [A,uu,vv] : [P(0), Pt(0), Ptt(0)], B(u,v) := A + u*uu + v*vv/2, PP(t) := A + t*uu + t^2/2 * vv )$ parabola_rects() := [ mypoly(B(0,0), B( 1,0), B( 1,1), B(0,1)), mypoly(B(0,0), B(-1,0), B(-1,1), B(0,1)), mypoly(B(0,0), B( 2,0), B( 2,4), B(0,4)), mypoly(B(0,0), B(-2,0), B(-2,4), B(0,4)) ]$ parabola_vecs() := [ myvec(P(0), Pt(0)), myvec(P(1), Pt(1)), myvec(P(-1), Pt(-1)), myvec(P(-2), Pt(-2)) ]$ P(t) := [3,1] + t*[1,0] + t^2*[0,1]; defs1(); P(t); PP(t); P(t) := [cos(t), sin(t)]; defs1(); P(t); PP(t); P(t) := [2,6] + t*[1,1] + t^2*[2,-1]; defs1(); myqdraw( xr(0,12), yr(0,8), more(proportional_axes=xy), parabola_rects(), parabola_vecs(), para(P(t)[1],P(t)[2], t, -2,2, lc(red)) )$ myqdraw0( more(terminal=pdf, file_name="/tmp/parabola"), myqdraw_body )$ ** (find-maximanode "flatten") ** (find-pdf-page "/tmp/parabola.pdf") ** (find-pdf-text "/tmp/parabola.pdf") ##### # # qdraw-taylor # 2023oct03 # ##### # «qdraw-taylor» (to ".qdraw-taylor") # (to "2023-2-raio-conv") * (eepitch-maxima) * (eepitch-kill) * (eepitch-maxima) load_qdraw(); DDef1(fxy) := buildq([f:op(fxy),xy:args(fxy)], define(f(splice(xy)),f)); DDef([fxys]) ::= map('DDef1,fxys); colors : [black, red, orange, forest_green, blue, dark_violet]$ f : sin(x); derivsf : makelist(diff(f,x,k), k, 0,7); derivsf0 : subst([x=0], derivsf); derivsfk(k) := diff(f,x,k); derivsf0k(k) := subst([x=0], derivsfk(k)); termk(k) := derivsf0k(k) * x^k/k!; newf(K) := sum(termk(k), k, 0, K); newf(7); f0 : newf(0); f1 : newf(1); f3 : newf(3); f5 : newf(5); f7 : newf(7); r : 2*%pi; r : 3*%pi; qdraw(xr(-r,r), yr(-r,r), ex1(f, x, -r,r, lc(colors[1]), lk("orig")), ex1(f0, x, -r,r, lc(colors[2]), lk("grau 0")), ex1(f1, x, -r,r, lc(colors[3]), lk("grau 1")), ex1(f3, x, -r,r, lc(colors[4]), lk("grau 3")), ex1(f5, x, -r,r, lc(colors[5]), lk("grau 5")), ex1(f7, x, -r,r, lc(colors[6]), lk("grau 7")) ); define(f7(x), f7); sin(0.1); f7(0.1); sin(0.1) - f7(0.1); define(f5(x), f5); sin(0.1); f5(0.1); sin(0.1) - f5(0.1); ##### # # qdraw-imp # 2023sep28 # ##### # «qdraw-imp» (to ".qdraw-imp") # (find-mbe-links 13 20 "6 Implicit plots with imp(...) and imp1(...)") # (find-mbe13page 20 "6 Implicit plots with imp(...) and imp1(...)") # (find-mbe13text 20 "6 Implicit plots with imp(...) and imp1(...)") # (to "matrixify") * (eepitch-maxima) * (eepitch-kill) * (eepitch-maxima) load_qdraw(); e : sin(2*x)*cos(y)$ qdraw(imp( e=0.4,x,-3,3,y,-3,3 ), cut(key), more(title=" sin(2 x) cos(y) = 0.4 ", xlabel = "x", ylabel = "y"))$ qdraw(imp( [e=0.4,e=0.7,e=0.9],x,-3,3,y,-3,3 ), cut(key), more(title=" sin(2 x) cos(y) = 0.4,0.7,0.9 ", xlabel = "x", ylabel = "y"))$ ##### # # qdraw-orbita # 2023sep26 # ##### # «qdraw-orbita» (to ".qdraw-orbita") # See: (c3m232trp 9 "orbita") # (c3m232tra "orbita") # (c3m221orbitap 3 "orbita") # (c3m221orbitaa "orbita") # Based on: (to "C3-lissajous") # Uses: (to "DDef") * (eepitch-maxima) * (eepitch-kill) * (eepitch-maxima) load_qdraw(); myqdraw([lists]) := apply('qdraw, apply('append, lists)); seqn(a,b,n) := makelist(a + (b-a)*k/n, k, 0, n); DDef1(fxy) := buildq([f:op(fxy),xy:args(fxy)], define(f(splice(xy)),f)); DDef([fxys]) ::= map('DDef1,fxys); h : 2*%pi / 12; /* configs */ [adjvel,adjacc,r,ts] : [1, 1, 9, seqn(0*h, 12*h, 6)]; [adjvel,adjacc,r,ts] : [1/4, 1/4, 3, seqn(0*h, 12*h, 6)]; [adjvel,adjacc,r,ts] : [1/4, 1/10, 3, seqn(0*h, 12*h, 6)]; [adjvel,adjacc,r,ts] : [1/4, 1/4, 3, seqn(0*h, 12*h, 3)]; [adjvel,adjacc,r,ts] : [1/4, 1/4, 3, seqn(2*h, 14*h, 3)]; [adjvel,adjacc,r,ts] : [1, 1, 9, seqn(0*h, 12*h, 3)]; [adjvel,adjacc,r,ts] : [1, 1, 9, seqn(2*h, 14*h, 3)]; [adjvel,adjacc,r,ts]; P : [cos(t), sin(t)]; R : 1/2 * [cos(4*t), sin(4*t)]; S : P + R; St : diff(S, t); Stt : diff(S, t, 2); vel : vector([S[1],S[2]], [St [1],St [2]]*adjvel, hl(0.1), lc(orange)); acc : vector([S[1],S[2]], [Stt[1],Stt[2]]*adjacc, hl(0.1), lc(purple)); define(vel(t), vel); define(acc(t), acc); vels : makelist(vel(t), t, ts); accs : makelist(acc(t), t, ts); bbox : [ xr(-r,r), yr(-r,r) ]; orbit : [ para(S[1],S[2], t, 0,2*%pi, lc(red)) ]; myqdraw(bbox, orbit, vels, accs); vel(0); vel(%pi); acc(0); acc(%pi); vels; adjvel : 1; adjacc : 1; myqdraw(orbit, vels, accs); acc(0); acc(%pi); myqdraw([ xr(-2,2),yr(-2,2), para(S[1], S[2], t, 0,2*%pi, lc(red)) ]); S(t)[1]; S(t); ##### # # Exercises on Lissajous figures (for Calculus 3) # 2023oct07 # ##### # «qdraw-lissajous» (to ".qdraw-lissajous") # «C3-lissajous» (to ".C3-lissajous") # (c3m232trp 8 "lissajous") # (c3m232tra "lissajous") # (to "intro-core") * (eepitch-maxima) * (eepitch-kill) * (eepitch-maxima) load_qdraw(); P : [cos(t), sin(2*t)]; ts : [0, %pi/4, %pi/2]; define(P(t), P); define(Pt(t), diff(P,t)); define(Ptt(t), diff(P,t,2)); qdraw(xr(-4,4),yr(-4,4), para(P[1],P[2], t,0,2*%pi, lc(orange)), vector(P(0), Pt(0), hl(0.1),lc(red)), vector(P(%pi/4),Pt(%pi/4), hl(0.1),lc(red)), vector(P(0), Ptt(0), hl(0.1),lc(forest_green)), vector(P(%pi/4),Ptt(%pi/4), hl(0.1),lc(forest_green)) ); myqdraw([drargs]) := apply('qdraw, flatten([drargs])); myqdraw(xr(-4,4),yr(-4,4), para(P[1],P[2], t,0,2*%pi, lc(orange)), makelist(vector(P(t),Pt (t), hl(0.1),lc(red)), t, ts), makelist(vector(P(t),Ptt(t), hl(0.1),lc(forest_green)), t, ts) ); myvector(xy,dxdy,color) := vector(xy,dxdy,hl(0.1),lc(color)); myqdraw(drawing); , makelist(myvector(P(t),Pt(t),red), t, ts) para(P[1],P[2], t, 0,2*%pi, lc(red)) ], vels, accs); shrink : 4; /* how much to shrink the vectors */ Pt : diff(P, t) / shrink; Ptt : diff(P, t, 2) / shrink; vel : vector([P[1],P[2]], [Pt [1],Pt [2]], hl(0.1), lc(orange)); acc : vector([P[1],P[2]], [Ptt[1],Ptt[2]], hl(0.1), lc(purple)); vel(t1) := subst([t=t1], vel); acc(t1) := subst([t=t1], acc); vels : makelist(vel(t1), t1, ts); accs : makelist(acc(t1), t1, ts); myqdraw([ xr(-2,2),yr(-2,2), para(P[1],P[2], t, 0,2*%pi, lc(red)) ], vels, accs); /* original: */ qdraw( xr(-2,2),yr(-2,2), para(P[1],P[2], t, 0,2*%pi, lc(red)), vel(0), acc(0) ); ##### # # qdraw-linearize # 2023oct03 # ##### # «qdraw-linearize» (to ".qdraw-linearize") # (find-mbe-links 13 18 "4 Parametric plots with para(...)") # (find-mbe13page 18 "4 Parametric plots with para(...)") # (find-mbe13text 18 "4 Parametric plots with para(...)") * (eepitch-maxima) * (eepitch-kill) * (eepitch-maxima) load_qdraw(); myqdraw([lists]) := apply('qdraw, apply('append, lists)); colors; colors : [red, orange, forest_green, blue, dark_violet]; F : sqrt(1-x^2); x0 : 0.3; x1 : 0.8; [xx1,xx2,xx3,xx4] : [-1.5,-1,1,1.5]; Fx : diff(F, x); DDef(F(x), Fx(x)); L : F(x0) + (x-x0)*Fx(x0); DDef(L(x)); qdraw(xr(xx1,xx4),yr(xx1,xx4), ex1(F, x, xx2, xx3, lc(colors[1])), ex1(L, x, xx1, xx4, lc(colors[2])), pts( [ [x0,0], [x0,F(x0)], [0,F(x0)] ],ps(1.5),pc(colors[3]),pk("(x0,f(x0))")), pts( [ [x1,0], [x1,F(x1)], [0,F(x1)] ],ps(1.5),pc(colors[4]),pk("(x1,f(x1))")), pts( [ [x1,L(x1)], [0,L(x1)] ],ps(1.5),pc(colors[5]),pk("(x1,L(x1))")) )$ FL(x1) := [F(x1), L(x1), F(x1)-L(x1)]; FL(4.1); FL(4.01); FL(4.001); ##### # # qdraw-proportional # 2023nov18 # ##### # «qdraw-proportional» (to ".qdraw-proportional") # (find-anggfile "MAXIMA/eigshow1.mac" "proportional_axes") # (find-maximanode "Functions and Variables for draw" "proportional_axes") # (find-mbe-links 13 56 "13 Even More with more(...)") # (find-mbe13page 56 "13 Even More with more(...)") # (find-mbe13text 56 "13 Even More with more(...)") ##### # # qdraw-colors # 2023oct03 # ##### # «qdraw-colors» (to ".qdraw-colors") # (to "colors") # (find-mbe-links 13 10 "3.1 Default colors and available colors") # (find-mbe13page 10 "3.1 Default colors and available colors") # (find-mbe13text 10 "3.1 Default colors and available colors") # (find-maximanode "") # (find-maximanode "set_plot_option") # (find-maximanode "color") # (find-maximanode "proportional_axes") # (find-maximanode "Functions and Variables for draw" ": color") # (find-maximanode "Functions and Variables for draw" "#23ab0f") # (find-maximanode "Functions and Variables for draw" "proportional_axes") /* Missing: light_magenta, light_turquoise, dark_pink, dark_yellow */ * (eepitch-maxima) * (eepitch-kill) * (eepitch-maxima) load_qdraw(); show_colors([white, black, gray0, grey0, gray10, grey10, gray20, grey20, gray30, grey30, gray40, grey40, gray50, grey50, gray60, grey60, gray70, grey70, gray80, grey80, gray90, grey90, gray100, grey100, gray, grey, light_gray, light_grey, dark_gray, dark_grey], 20); show_colors([red, light_red, dark_red, yellow, light_yellow], 12); show_colors([green, light_green, dark_green, spring_green, forest_green, sea_green], 12); show_colors([blue, light_blue, dark_blue, midnight_blue, navy, medium_blue, royalblue, skyblue], 12); show_colors([cyan, light_cyan, dark_cyan, magenta, dark_magenta, turquoise, dark_turquoise, pink, light_pink], 12); show_colors([coral, light_coral, orange_red, salmon, light_salmon, dark_salmon, orange, dark_orange, aquamarine, khaki, light_goldenrod, dark_khaki, goldenrod, dark_goldenrod, brown, gold, beige, violet, dark_violet, plum, purple], 12); * (eepitch-maxima) * (eepitch-kill) * (eepitch-maxima) load_qdraw(); show_colors([red, orange, yellow], 3); show_colors([red, orange, yellow], 2); ##### # # qdraw-ex-and-ex1 # 2023nov09 # ##### # «qdraw-ex-and-ex1» (to ".qdraw-ex-and-ex1") # (find-mbe-links 13 6 "3 Quick Plots for Explicit Functions: ex(...) and ex1(...)") # (find-mbe13page 6 "3 Quick Plots for Explicit Functions: ex(...) and ex1(...)") # (find-mbe13text 6 "3 Quick Plots for Explicit Functions: ex(...) and ex1(...)") # (find-mbe-links 13 10 "3.1 Default colors and available colors") # (find-mbefile "qdraw.mac") * (eepitch-maxima) * (eepitch-kill) * (eepitch-maxima) load_qdraw(); qdraw(); qdraw1(); /*(%i3)*/ qdraw ( ex (cos(x), x, 0, 6))$ /*(%i4)*/ qdraw ( ex (cos(x), x, 0, 6, lc(red)))$ /*(%i5)*/ qdraw ( ex1 (cos(x), x, 0, 6, lc(red)))$ /*(%i6)*/ qdraw ( ex1 (cos(x), x, 0, 6, lc(red)), more (xlabel = "X", ylabel = "COS(X)", title = "single function"))$ /*(%i7)*/ qdraw ( ex1 (cos(x), x, 0, 6, lc(red)), line ( 0,0,6,0, lc(brown), lw(1)), more (xlabel = "X", ylabel = "COS(X)", title = "single function"))$ /*(%i8)*/ qdraw ( ex1 (cos(x), x, 0, 6, lc(red)), yr (-1.2, 1.2), line ( 0,0,6,0, lc(brown), lw(1)), more (xlabel = "X", ylabel = "COS(X)", title = "single function"))$ /*(%i9)*/ qdraw ( ex ( [x,x^2,x^3],x,-3,3), line ( -3,0,3,0, lc(brown), lw(1)), more (xlabel = "X", title = "Using ex(..) for three functions"))$ /*(%i10)*/ qdraw ( ex ( [x,x^2,x^3],x,-3,3), yr (-2, 2), line ( -3,0,3,0, lc(brown), lw(1)), key (bottom), more (xlabel = "X", title = "Using ex(..) for three functions"))$ /*(%i11)*/ qdraw ( ex ( [x,x^2,x^3],x,-3,3), yr (-2, 2), line ( -3,0,3,0, lc(brown), lw(1)), key (bottom), pts ( [ [-1,-1], [0,0],[1,1] ] ), more (xlabel = "X", title = "Using ex(..) for three functions"))$ /*(%i12)*/ qdraw ( ex ( [x,x^2,x^3],x,-3,3), yr (-2, 2), line ( -3,0,3,0, lc(brown), lw(1)), key (bottom), pts ( [ [-1,-1], [0,0],[1,1] ], ps(2), pc(magenta)), more (xlabel = "X", title = "Using ex(..) for three functions"))$ /*(%i13)*/ qdraw ( ex ( [x,x^2,x^3],x,-3,3), yr (-2, 2), line ( -3,0,3,0, lc(brown), lw(1)), key (bottom), pts ( [ [-1,-1], [0,0],[1,1] ], ps(2), pc(magenta), pk("intersections")), more (xlabel = "X", title = "Using ex(..) for three functions"))$ /*(%i14)*/ default_colors(15)$ /*(%i15)*/ (L1:[[-1,-1],[-1,0],[-1,1]], L2:[[1,-1],[1,0],[1,1]], qdraw ( pts(L1), pts(L2), xr(-2,2),yr(-2,2)))$ /*(%i16)*/ mycL : [aquamarine,beige,blue,brown,cyan,gold,goldenrod,green,khaki, magenta,orange,pink,plum,purple,red,salmon,skyblue,turquoise, violet,yellow ]$ /*(%i17)*/ show_colors(mycL,10)$ /*(%i18)*/ qdraw( ex1(bessel_j(0,x),x,0,20,lc(red),lw(6),lk("bessel_j ( 0, x)") ), ex1(bessel_j(1,x),x,0,20,lc(blue),lw(5),lk("bessel_j ( 1, x)")), ex1(bessel_j(2,x),x,0,20,lc(brown),lw(4),lk("bessel_j ( 2, x)") ), ex1(bessel_j(3,x),x,0,20,lc(green),lw(3),lk("bessel_j ( 3, x)") ) )$ /*(%i19)*/ qdraw(line(0,0,50,0,lc(red),lw(2) ), ex1(bessel_j(0, sqrt(x)),x,0,50 ,lc(blue), lw(7),lk("J0( sqrt(x) )") ) )$ # Local Variables: # coding: utf-8-unix # End: