Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
;; This file: ;; http://anggtwu.net/MAXIMA/lazynouns.lisp.html ;; http://anggtwu.net/MAXIMA/lazynouns.lisp ;; (find-angg "MAXIMA/lazynouns.lisp") ;; Author: Eduardo Ochs <eduardoochs@gmail.com> ;; ;; Introduction ;; ============ ;; This file defines "lazy nouns" for "diff", "integrate", and "*". ;; Nouns are "less active" than verbs. ;; Lazy nouns are "less active" than nouns. ;; Nouns do some simplifications. ;; My lazy nouns don't simplify anything. ;; ;; Compare: ;; diff(f(x),x) <- here "diff" is a verb ;; 'diff(f(x),x) <- here "'diff" is a noun ;; diff(x^3,x) <- calculates a derivative ;; 'diff(x^3,x) <- returns an uncalculated derivative ;; diff(1,x) <- simplifies to 0 ;; 'diff(1,x) <- also simplifies to 0 =( ;; _diff(1,x) <- returns d1/dx, does not simplify ;; ;; See: (find-maximanode "Nouns and Verbs") ;; (find-angg "MAXIMA/dim-2.lisp") ;; ;; «.lazy-ops» (to "lazy-ops") ;; «.vira» (to "vira") ;; «.vira-tests» (to "vira-tests") (defun my-copy-properties (tosymbol fromsymbol keys) (loop for key in keys do (setf (get tosymbol key) (get fromsymbol key)))) ;; (my-copy-properties '$diff_ '%derivative '(dimension tex)) ;; (my-copy-properties '$integrate_ '%integrate '(dimension tex)) (my-copy-properties '$_diff '%derivative '(dimension tex)) (my-copy-properties '$_integrate '%integrate '(dimension tex)) ;; «lazy-ops» (to ".lazy-ops") ;; (find-maxima-links "*") ;; (find-maxima-links "/") ;; (find-maxima-links "+") ;; (find-maxima-links "-") ;; Why the "$nary"s? ;; ($infix "*." 120 120) ($infix "*." 120) ($nary "*.") (my-copy-properties '|$*.| 'mtimes '($nary lbp rbp dimension dissym tex texsym)) ($infix "/." 120 120) ($nary "/.") (my-copy-properties '|$/.| 'mquotient '($nary lbp rbp dimension dissym tex texsym)) ($infix "+." 100 134) ($nary "+.") (my-copy-properties '|$+.| 'mplus '($nary lbp rbp dimension dissym tex texsym)) ($infix "-." 100 134) ($nary "-.") (my-copy-properties '|$-.| 'mminus '($nary lbp rbp dimension dissym tex texsym)) #| * (eepitch-maxima) * (eepitch-kill) * (eepitch-maxima) load("lazynouns.lisp"); [o1,o2] : [2*x^3, 1]; matrix(["", "diff", "'diff", "diff_"], [o1, diff(o1,x), 'diff(o1,x), diff_(o1,x)], [o2, diff(o2,x), 'diff(o2,x), diff_(o2,x)]); [o1,o2] : [2*f(x), 2*x]; matrix(["", "integrate", "'integrate", "integrate_"], [o1, integrate(o1,x), 'integrate(o1,x), integrate_(o1,x)], [o2, integrate(o2,x), 'integrate(o2,x), integrate_(o2,x)]); matrix(["*", "*."], [2*3*4*5, 2*.3*.4*.5], [a*c*d*b, a*.c*.d*.b]); (-2) / (-3); (-2) /. (-3); (-2) -. (-3) -. (-4); |# ;; «vira» (to ".vira") ;; (find-es "maxima" "stringdisp-mdefine") (displa-def $vira dimension-infix " := " 80 80) (defprop $vira tex-infix tex) (defprop $vira (" := ") texsym) (displa-def $becomes dimension-infix " := " 80 80) (defprop $becomes tex-infix tex) (defprop $becomes (" := ") texsym) #| ** «vira-tests» (to ".vira-tests") * (eepitch-sbcl) * (eepitch-kill) * (eepitch-sbcl) (load "lazynouns.lisp") |#