From: Oleg N. <ol...@re...> - 2025-08-08 08:50:38
|
On 08/07, Robert Dodier wrote: > > On Thu, Aug 7, 2025 at 1:09 PM Michael Gough > <inn...@gm...> wrote: > > > > I need to prevent maxima from maxima from simplifying a subexpression. Let’s say I have x+x. > > > > Try as I might, I can not keep it from becoming 2x. > > Mike, take a look at a little package I wrote called superq (for > superquote). You can find it in the folder robert-dodier/superq at: > https://github.com/maxima-project-on-github/maxima-packages Thanks, I will probably use it ;) On a related note... From time to time I do something like (%i1) '"+"(2,2) = 4; (%o1) 2 + 2 = 4 without "simp: false" and then I can copy the unsimplified expression somewhere. This mostly works, but (%i2) '"."(matrix([1, 2], [3, 4]), matrix([1], [2])) = matrix([5],[11]); ┌ ┐ ┌ ┐ ┌ ┐ │ 1 2 │ │ 1 │ │ 5 │ (%o2) (│ │) . (│ │) = │ │ │ 3 4 │ │ 2 │ │ 11 │ └ ┘ └ ┘ └ ┘ looks a bit worse. If I do (%i3) :lisp (def-lbp $matrix 201) (%i3) :lisp (def-rbp $matrix 201) then (%i3) '"."(matrix([1, 2], [3, 4]), matrix([1], [2])) = matrix([5],[11]); ┌ ┐ ┌ ┐ ┌ ┐ │ 1 2 │ │ 1 │ │ 5 │ (%o3) │ │ . │ │ = │ │ │ 3 4 │ │ 2 │ │ 11 │ └ ┘ └ ┘ └ ┘ and this matches "matrix([1, 2], [3, 4]) . matrix([1], [2]) = matrix([5],[11])" with "simp: false". :lisp (defprop %mnctimes 130. lbp) :lisp (defprop %mnctimes 129. rbp) works too and probably makes more sense, this matches "(defprop mnctimes ...)" in src/grind.lisp. Another simple example: (%i4) a = b . c; (%o4) a = b . c (%i5) '"="(a, b.c); (%o5) a = (b . c) (%i6) :lisp (defprop %mequal 80. lbp) (%i6) :lisp (defprop %mequal 80. rbp) (%i6) '"="(a, b.c); (%o6) a = b . c so perhaps it makes sense to update src/grind.lisp even if this all is purely cosmetic? Oleg. |