Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
/* * This file: * http://anggtwu.net/.maxima/maxima-init.mac.html * http://anggtwu.net/.maxima/maxima-init.mac * (find-angg ".maxima/maxima-init.mac") * Author: Eduardo Ochs <eduardoochs@gmail.com> * * See: (find-es "maxima" "init-file") * * «.seq» (to "seq") * «.format» (to "format") * «.traverse» (to "traverse") * «.align_eqs» (to "align_eqs") * «.mapconcat» (to "mapconcat") * «.load_qdraw» (to "load_qdraw") * «.HOME» (to "HOME") * «.DDef» (to "DDef") */ /* «seq» (to ".seq") * (find-es "maxima" "seq") */ seq (a,b) := makelist(i, i,a,b); seqby(a,b,stp) := makelist(i, i,a,b,stp); seqn (a,b,n) := makelist(a + (b-a)*k/n, k,0,n); /* * (eepitch-maxima) * (eepitch-kill) * (eepitch-maxima) seq (2,5); seq (5,2); seqby(5,2,-1); seqby(2,20,3); seqn (2,4,6); */ /* «format» (to ".format") * (find-es "maxima" "format") */ format([args]) := apply(?format, append([false], args)); /* «traverse» (to ".traverse") * (find-es "maxima" "op-and-args") * (find-angg "MAXIMA/traverse.mac") */ traverse_1 : lambda([o, action], if is(action = 'op) then op(o) elseif is(action = 'args) then args(o) else args(o)[action]); traverse(o, [actions]) := xreduce('traverse_1, actions, o); /* * (eepitch-maxima) * (eepitch-kill) * (eepitch-maxima) load("maxima-init.mac"); o : a*b + c/d; traverse(o); traverse(o, op); traverse(o, args); traverse(o, 1); traverse(o, 1, op); traverse(o, 1, args); */ /* «align_eqs» (to ".align_eqs") * (find-es "maxima" "align_eqs") */ align_eqs(as) := apply('matrix, align_eqs_0(as))$ align_eqs_0(as) := append([[as[1], "=", as[2]]], makelist(["", "=", as[i]], i, 3, length(as)))$ /* * (eepitch-maxima) * (eepitch-kill) * (eepitch-maxima) a : [11, 22, 33, 44, 55, 66]; align_eqs(a); */ /* «mapconcat» (to ".mapconcat") * (find-es "maxima" "mapconcat") * (find-maximanode "Introduction to Strings") * (find-maximanode "Introduction to Strings" "Embedded line termination") */ newline : " "; intercalate(sep, strs) := block([strs2, rest], strs2: makelist(concat(sep,strs[i]), i,2,length(strs)), rest: apply('concat, strs2), concat(strs[1], rest))$ mapconcat(f,a,sep) := intercalate(sep, map(f,a))$ concatvstrings (L) := mapconcat('string, L, newline); /* * (eepitch-maxima) * (eepitch-kill) * (eepitch-maxima) intercalate(",", ["a", "b", "c"]); intercalate("_err_", []); mapconcat(tex1, [x/y, z*w], " & "); concatvstrings ([x/y, z*w]); [x/y, z*w]; */ /* «load_qdraw» (to ".load_qdraw") * See: (find-windows-beginner-intro "12. Install qdraw") * For versions that flatten the list of arguments, see: * (find-angg "MAXIMA/myqdraw3.mac") * (find-angg "MAXIMA/topdf1.mac") * The suffix "1" means "use qdraw1 to process the list of arguments". * The suffix "v" means "run concatvstrings (and don't draw)". * * (find-es "maxima" "qdraw") * (find-es "maxima" "myqdraw-flatten") * (find-es "maxima" "no-init") * (find-fline "~/MAXIMA/qdraw.mac") * (find-fline "~/MAXIMA/qdraw.mac" "qdraw1" "produces drlist") * (find-fline "~/MAXIMA/qdraw.mac" "qdraw([qargs]) :=") * (find-angg "MAXIMA/myqdraw1.mac") * (find-angg "MAXIMA/myqdraw2.mac") * (find-es "mbe" "download") * https://home.csulb.edu/~woollett/qdraw.mac */ load_qdraw() := (load_qdraw_add_paths(), load("qdraw")); load_qdraw_add_paths() := (file_search_maxima:append(file_search_maxima, ["~/MAXIMA/*.mac", "~/MAXIMA/*.lisp", "~/snarf/https/home.csulb.edu/~woollett/*.mac", "~/snarf/https/home.csulb.edu/~woollett/*.lisp"])); qdraw1v([qargs]) := concatvstrings(apply('qdraw1, qargs)); qdrawv ([qargs]) := concatvstrings (qargs); /* * (eepitch-maxima) * (eepitch-kill) * (eepitch-maxima) load_qdraw(); [p1,p2,p3] : [pts([[1,1]]), pts([[2,2]]), pts([[3,3]])]; qdrawv (p1,p2,p3); qdraw1v(p1,p2,p3); qdraw1 (p1,p2,p3); qdraw (p1,p2,p3); */ /* «HOME» (to ".HOME") * (find-es "maxima" "getenv") */ HOME() := (load("operatingsystem"), getenv("HOME"))$ /* «DDef» (to ".DDef") * (find-es "maxima" "DDef") */ DDef1(fxy) := buildq([f:op(fxy),xy:args(fxy)], define(f(splice(xy)),f))$ DDef([fxys]) ::= map('DDef1,fxys)$