Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
/* * This file: * http://anggtwu.net/MAXIMA/2025-cases.mac.html * http://anggtwu.net/MAXIMA/2025-cases.mac * (find-angg "MAXIMA/2025-cases.mac") * Author: Eduardo Ochs <eduardoochs@gmail.com> * * (defun e () (interactive) (find-angg "MAXIMA/2025-cases.mac")) * (find-angg "MAXIMA/2025-methods.mac") * (find-es "maxima" "2024.1-taylor-1") * (find-angg "MAXIMA/2025-1-taylor.mac") * «.core» (to "core") * «.core-tests» (to "core-tests") * «.myex» (to "myex") * «.myex-tests» (to "myex-tests") * «.pts» (to "pts") * «.pts-tests» (to "pts-tests") */ load("~/MAXIMA/2025-methods.mac"); /* «core» (to ".core") */ defstruct(Cases(conds,fs)); Cases__n (c) := length(c@fs); Cases__condi (c,i) := c@conds[i]; Cases__fi (c,i) := c@fs [i]; Cases__pairi (c,i) := [c@@condi(i), c@@fi(i)]; Cases__pairs (c) := makelist(c@@pairi(i), i,1,c@@n()); Cases__matrix(c) := apply('matrix, c@@pairs()); Cases__makeif(c) := apply("if", apply('append, c@@pairs())); /* «core-tests» (to ".core-tests") * (eepitch-maxima) * (eepitch-kill) * (eepitch-maxima) load("2025-cases.mac"); myc : Cases([x<2, x<=3, true], [3-x, 2, x-2])$ myc : Cases([x<2, x<=3, x<=5, true], [3-x, 2, x-2, 3])$ myc@@pairs(); myc@@matrix(); myc@@makeif(); myc@@opi(1); myc@@opi(2); */ /* «myex» (to ".myex") * (find-myqdraw "myqdraw3.mac" "myex") * (find-myqdraw "myqdraw-core.mac" "myapply") */ Cases__myexL (c, opts) := myapply_fl('ex1, c@@fi(1), 'x, xmin,c@@bi(1), opts); Cases__myexMi(c,i,opts) := myapply_fl('ex1, c@@fi(i), 'x,c@@bi(i-1),c@@bi(i), opts); Cases__myexR (c, opts) := myapply_fl('ex1, c@@fi(c@@n()), 'x,c@@bi(c@@n()-1),xmax, opts); Cases__myex (c,[opts]) := [c@@myexL(opts), makelist(c@@myexMi(i,opts), i,2,c@@n()-1), c@@myexR(opts)]; /* «myex-tests» (to ".myex-tests") * (eepitch-maxima) * (eepitch-kill) * (eepitch-maxima) load("2025-cases.mac"); myc : Cases([x<2, x<=3, x<=5, true], [3-x, 2, x-2, 3])$ define(f(x), myc@@makeif()); ** (find-myqdraw "myqdraw3.mac") ** (find-myqdraw "myqdraw3.mac" "myex") load_myqdraw(); [xmin,ymin, xmax,ymax] : [0,0, 6,5]; myc@@myex(); myqdraw(xyrange(), myex1(f(x), lc(orange))); myqdraw(xyrange(), myc@@myex (lc(orange))); */ /* «pts» (to ".pts") */ Cases__bi (c,i) := args(c@@condi(i))[2]; Cases__opi (c,i) := op(c@@condi(i)); Cases__fLi (c,i) := at(c@@fi(i), 'x=c@@bi(i)); Cases__fRi (c,i) := at(c@@fi(i+1), 'x=c@@bi(i)); Cases__nojump (c,i) := is(c@@fLi(i)=c@@fRi(i)); Cases__Lclosed (c,i) := is(c@@opi(i)="<="); Cases__ptclosed(c,i) := if c@@nojump (i) then [] elseif c@@Lclosed(i) then [[c@@bi(i), c@@fRi(i)]] else [[c@@bi(i), c@@fLi(i)]]; Cases__ptopen (c,i) := if c@@nojump (i) then [] elseif c@@Lclosed(i) then [[c@@bi(i), c@@fLi(i)]] else [[c@@bi(i), c@@fRi(i)]]; Cases__ptsclosed__(c) := makelist(c@@ptclosed(i), i,1,c@@n()-1); Cases__ptsopen__ (c) := makelist(c@@ptopen (i), i,1,c@@n()-1); Cases__ptsclosed_ (c) := apply('append, c@@ptsclosed__()); Cases__ptsopen_ (c) := apply('append, c@@ptsopen__ ()); Cases__ptsclosed (c,opts) := myapply_fl('pts_open, c@@ptsclosed_(), opts); Cases__ptsopen (c,opts) := myapply_fl('pts, c@@ptsopen_ (), opts); Cases__pts (c,[opts]) := [c@@ptsclosed(opts), c@@ptsopen(opts)]; Cases__myexpts (c,lopts,popts) := [c@@myex(lopts), c@@pts(popts)]; /* «pts-tests» (to ".pts-tests") * (eepitch-maxima) * (eepitch-kill) * (eepitch-maxima) load("2025-cases.mac"); myc : Cases([x<2, x<=3, x<=5, true], [3-x, 2, x-2, 3])$ myc@@ptclosed(1); myc@@ptclosed(2); myc@@ptsclosed__(); myc@@ptsclosed_(); myc@@ptsopen__ (); myc@@ptsopen_ (); myc@@pts (); ** (find-myqdraw "myqdraw3.mac") ** (find-myqdraw "myqdraw3.mac" "myex") load_myqdraw(); myqdraw(xyrange(), myc@@myex(lc(orange)), myc@@pts()); myqdraw(xyrange(), myc@@myex(lc(orange)), myc@@pts(pc(red))); * (eepitch-maxima) * (eepitch-kill) * (eepitch-maxima) load("2025-cases.mac"); load_myqdraw(); [xmin,ymin, xmax,ymax] : [0,0, 6,5]; myc : Cases([x<2, x<=3, x<=5, true], [3-x, 2, x-2, 3])$ myc@@makeif(); myc@@matrix(); myqdraw(xyrange(), myc@@myexpts([], []))$ myqdraw(xyrange(), myc@@myexpts([lc(orange)], [pc(red)]))$ */ /* * Local Variables: * coding: utf-8-unix * End: */