You can subscribe to this list here.
| 2014 |
Jan
|
Feb
(232) |
Mar
(323) |
Apr
(383) |
May
(359) |
Jun
(435) |
Jul
(252) |
Aug
(172) |
Sep
(265) |
Oct
(263) |
Nov
(350) |
Dec
(359) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2015 |
Jan
(267) |
Feb
(220) |
Mar
(311) |
Apr
(269) |
May
(388) |
Jun
(403) |
Jul
(172) |
Aug
(399) |
Sep
(364) |
Oct
(269) |
Nov
(357) |
Dec
(468) |
| 2016 |
Jan
(618) |
Feb
(592) |
Mar
(625) |
Apr
(516) |
May
(375) |
Jun
(155) |
Jul
(346) |
Aug
(262) |
Sep
(346) |
Oct
(291) |
Nov
(333) |
Dec
(335) |
| 2017 |
Jan
(436) |
Feb
(460) |
Mar
(370) |
Apr
(189) |
May
(252) |
Jun
(272) |
Jul
(286) |
Aug
(293) |
Sep
(303) |
Oct
(331) |
Nov
(346) |
Dec
(273) |
| 2018 |
Jan
(295) |
Feb
(343) |
Mar
(265) |
Apr
(290) |
May
(233) |
Jun
(201) |
Jul
(234) |
Aug
(125) |
Sep
(287) |
Oct
(322) |
Nov
(274) |
Dec
(293) |
| 2019 |
Jan
(406) |
Feb
(255) |
Mar
(418) |
Apr
(187) |
May
(247) |
Jun
(282) |
Jul
(84) |
Aug
(108) |
Sep
(175) |
Oct
(161) |
Nov
(215) |
Dec
(184) |
| 2020 |
Jan
(205) |
Feb
(287) |
Mar
(180) |
Apr
(285) |
May
(272) |
Jun
(266) |
Jul
(133) |
Aug
(253) |
Sep
(281) |
Oct
(346) |
Nov
(293) |
Dec
(253) |
| 2021 |
Jan
(218) |
Feb
(194) |
Mar
(399) |
Apr
(312) |
May
(425) |
Jun
(358) |
Jul
(160) |
Aug
(251) |
Sep
(110) |
Oct
(113) |
Nov
(257) |
Dec
(99) |
| 2022 |
Jan
(233) |
Feb
(184) |
Mar
(284) |
Apr
(221) |
May
(178) |
Jun
(231) |
Jul
(337) |
Aug
(264) |
Sep
(181) |
Oct
(183) |
Nov
(281) |
Dec
(406) |
| 2023 |
Jan
(479) |
Feb
(263) |
Mar
(278) |
Apr
(149) |
May
(186) |
Jun
(215) |
Jul
(353) |
Aug
(195) |
Sep
(232) |
Oct
(140) |
Nov
(211) |
Dec
(197) |
| 2024 |
Jan
(348) |
Feb
(167) |
Mar
(131) |
Apr
(222) |
May
(113) |
Jun
(136) |
Jul
(242) |
Aug
(105) |
Sep
(94) |
Oct
(237) |
Nov
(110) |
Dec
(155) |
| 2025 |
Jan
(372) |
Feb
(234) |
Mar
(332) |
Apr
(310) |
May
(203) |
Jun
(63) |
Jul
(254) |
Aug
(151) |
Sep
(145) |
Oct
(95) |
Nov
|
Dec
|
|
From: Robert D. <rob...@gm...> - 2025-10-24 17:15:05
|
Eduardo, thanks for the update about the display code you're working on. You might be interested to hear that I'm working on another display flag for matrices, to pad rows and columns with spaces (as it is now) or not, so that matrix elements are displayed immediately adjacent to each other. I have made some attempts but it's not quite working. I'll try again this weekend and see if I can get it working. I'll keep you posted. Robert |
|
From: Robert D. <rob...@gm...> - 2025-10-24 17:03:49
|
Barton, thanks for finding that example. I haven't looked at it, but I wonder if an analogous example with sum instead of product runs into the same problem. sum and product share a lot of code, if I remember correctly - I would be interested to know if sum expressions are likewise behaving in unexpected ways. All the best, Robert |
|
From: Robert D. <rob...@gm...> - 2025-10-24 17:01:35
|
Dave, I'm glad to hear that you're making progress on your project. You mentioned that you're interested in finding collaborators. My recommendation about that is to create a project on Github.com or another project hosting site, and post your code there. Lots of open source projects are developed that way; I think it's an easy and effective way to advertise the project to potential collaborators and gather their contributions. Hope this helps, and all the best. Robert |
|
From: Raymond T. <toy...@gm...> - 2025-10-24 16:37:12
|
On 10/22/25 11:48 AM, davelillie--- via Maxima-discuss wrote: > On or about December 2022, I sent an email to you saying: > > /“The problem with document based interfaces for computer algebra > systems for me is: it is always followed with copy and paste to MS > Word to create a final product. I would like to form an open-source > team to utilize ms word directly as the document based interface for > the computer algebra system Maxima. / > I rarely use MS Word so this project doesn't have much use to me personally. (No offense; I don't use wxMaxima either.) I do find it quite interesting though. Could you provide some screenshots of the result? I'm curious to see what this looks like. ​ |
|
From: Jaime V. <vi...@fe...> - 2025-10-24 15:53:08
|
Thank you for pointing that out. If you can, please tell the Wxmaxima maintainers to fix that (they might be reading this list, but just in case). Regards, Jaime On 10/23/25 15:13, Francisco Freitas wrote: > > Greetings Maxima Group > > I was installing today maxima-5.48.1-win64.exe and I got this message : > > I changed the string x64 to amd64 > > this line > > processorArchitecture="amd64" > > and I could run the sotfware > > Sincerely yours > Francisco A. Da Silva Freitas > University of Aveiro > > > > > _______________________________________________ > Maxima-discuss mailing list > Max...@li... > https://lists.sourceforge.net/lists/listinfo/maxima-discuss |
|
From: Raymond T. <toy...@gm...> - 2025-10-24 01:50:39
|
On 10/23/25 9:06 AM, Stavros Macrakis wrote: > It's great the way def-simplifierstandardizes the definition of > simplifying (mathematical) functions. > > I use the Tags system in Emacs, so I type META-. /function/to jump to > the definition of a function. That certainly wasn't the intention, but I'm glad there are additional benefits. > > def-simplifier makes this much more efficient. I used to have to know > that the simplifier for gamma is simp-%gamma, for example. Yeah, and the naming wasn't always consistent. > > But unfortunately, the def-simplifierscheme doesn't apply to all > functions: it fails for min, floor, matrix, lambda, etc., not to > mention operators like +, ^^, etc. This is probably because these functions have lambda args that aren't currently supported. Also, I think some functions use maclisp syntax. We should probably replace all of these old-style functions with CL-style. A different task, I think. > > It would be nice if we could somehow extend the def-simplifier scheme > to cover all these cases, even if the call is actually a no-op -- that > is, use def-simplifier simply to make the simplifier findable. > > (def-simplifier lambda simplambda) ;; random syntax > (defun simplambda (x vestigial simp-flag) A different syntax that I didn't think of. I'll look into it, but part of the reason for def-simplifier was to make the bodies also consistent so that errors and what not produce consistent results. This kind of defeats that purpose. ​ |
|
From: Stavros M. <mac...@gm...> - 2025-10-23 16:07:00
|
It's great the way def-simplifier standardizes the definition of simplifying (mathematical) functions. I use the Tags system in Emacs, so I type META-. *function* to jump to the definition of a function. def-simplifier makes this much more efficient. I used to have to know that the simplifier for gamma is simp-%gamma, for example. But unfortunately, the def-simplifier scheme doesn't apply to all functions: it fails for min, floor, matrix, lambda, etc., not to mention operators like +, ^^, etc. It would be nice if we could somehow extend the def-simplifier scheme to cover all these cases, even if the call is actually a no-op -- that is, use def-simplifier simply to make the simplifier findable. (def-simplifier lambda simplambda) ;; random syntax (defun simplambda (x vestigial simp-flag) |
|
From: Francisco F. <fs...@ua...> - 2025-10-23 14:29:44
|
Greetings Maxima Group I was installing today maxima-5.48.1-win64.exe and I got this message : I changed the string x64 to amd64 this line processorArchitecture="amd64" and I could run the sotfware Sincerely yours Francisco A. Da Silva Freitas University of Aveiro |
|
From: Andrew W. <aw...@gm...> - 2025-10-22 19:23:36
|
Sounds like a good project. But the problem with the proposal to have some open-source team is that you are asking for volunteers, most prospects of whom have time constraints and obligations already. These prospects may already be involved in significant open source projects already, such as maintaining core maxima. I won't tell you what a business person would tell you, because I'm not a business person, I am an engineer who produces open source software funded by the fruits of my day job. I'm sure you've heard what a business oriented person would say already. So if you're not able to take their advice, continue to persevere as many of us do already. On Wed, Oct 22, 2025 at 2:07 PM davelillie--- via Maxima-discuss < max...@li...> wrote: > On or about December 2022, I sent an email to you saying: > > *“The problem with document based interfaces for computer algebra systems > for me is: it is always followed with copy and paste to MS Word to create a > final product. I would like to form an open-source team to utilize ms word > directly as the document based interface for the computer algebra system > Maxima. * > > > > *I’ve written a dll that parses the oMath equations created by ms word’s > built-in equation editor, I’ve written the VBA macro code that extracts > oMath equations contained in a ms word document, I’ve written the VBA macro > code that calls the dll. The goal to utilize ms word directly as the > document based interface for the computer algebra system Maxima is proven > feasible.* > > *Basically, equations are created in a ms word document using ms word’s > equation editor. These are extracted as Latex math by a VBA macro which is > part of the document. This Latex math is converted to Maxima format using > VBA macro and a dll. A TCP_Server that is built-in to the dll (previously > described) communicates with Maxima. Maxima returns results as Latex math > and ms word is capable to directly use Latex math as the document’s > equations.* > > *Most of the software execution is being done by the dll; the VBA macro’s > are just a convenient way to extract objects and fields from the document.* > > *Please, direct me to a contact for the formation an open-source team for > this effort.”* > > > > Since then, I’ve been steadily working on the idea and found it to be > feasible. I’ve successfully created a dll that parses the latex-like code > found in MS Equations of Word into Maxima command lines. I’ve successfully > created code that exchanges communications between MS Word and Maxima (the > need of VBA macros is eliminated). Presently, I’m on a promising path to > create a MS Word Add-in that interfaces the afore mentioned dll from within > a Word document. This combination will create a poor man’s MathCAD-like > active document within MS Word but with the benefit of having MS Word’s > powerful word processing to create an end product of a well formatted > document. The most common dislike of PTC’s MathCAD has been the inability > to create well formatted documents and I agree. Here, I solve that > “dislike” and invoke *ALL* of the CAS benefits of Maxima. The resulting > document with filetype .docx or .docm can be shared as is with anyone with > MS Word as a “dumb” document. It is required to have Maxima and the dll > installed to be an mathematically active document. > > > > What I’m working on remains to be too large for one person to complete but > I will keep going. However, I believe this is a worthwhile project to be > considered by you. > > > > Thanks; > > Dave Lillie > > > _______________________________________________ > Maxima-discuss mailing list > Max...@li... > https://lists.sourceforge.net/lists/listinfo/maxima-discuss > |
|
From: <dav...@ya...> - 2025-10-22 18:59:10
|
On or about December 2022, I sent an email to you saying: "The problem with document based interfaces for computer algebra systems for me is: it is always followed with copy and paste to MS Word to create a final product. I would like to form an open-source team to utilize ms word directly as the document based interface for the computer algebra system Maxima. I've written a dll that parses the oMath equations created by ms word's built-in equation editor, I've written the VBA macro code that extracts oMath equations contained in a ms word document, I've written the VBA macro code that calls the dll. The goal to utilize ms word directly as the document based interface for the computer algebra system Maxima is proven feasible. Basically, equations are created in a ms word document using ms word's equation editor. These are extracted as Latex math by a VBA macro which is part of the document. This Latex math is converted to Maxima format using VBA macro and a dll. A TCP_Server that is built-in to the dll (previously described) communicates with Maxima. Maxima returns results as Latex math and ms word is capable to directly use Latex math as the document's equations. Most of the software execution is being done by the dll; the VBA macro's are just a convenient way to extract objects and fields from the document. Please, direct me to a contact for the formation an open-source team for this effort." Since then, I've been steadily working on the idea and found it to be feasible. I've successfully created a dll that parses the latex-like code found in MS Equations of Word into Maxima command lines. I've successfully created code that exchanges communications between MS Word and Maxima (the need of VBA macros is eliminated). Presently, I'm on a promising path to create a MS Word Add-in that interfaces the afore mentioned dll from within a Word document. This combination will create a poor man's MathCAD-like active document within MS Word but with the benefit of having MS Word's powerful word processing to create an end product of a well formatted document. The most common dislike of PTC's MathCAD has been the inability to create well formatted documents and I agree. Here, I solve that "dislike" and invoke ALL of the CAS benefits of Maxima. The resulting document with filetype .docx or .docm can be shared as is with anyone with MS Word as a "dumb" document. It is required to have Maxima and the dll installed to be an mathematically active document. What I'm working on remains to be too large for one person to complete but I will keep going. However, I believe this is a worthwhile project to be considered by you. Thanks; Dave Lillie |
|
From: Daniel V. <dan...@ya...> - 2025-10-22 06:47:06
|
Hi Barton,
I don't know if this will help you or not but I'm running the same testsin Maxima "5.38.1" (I know, it's old) in Windows 10 (I know, it's old)and I get very different results:
fpprintprec:5$
timer(?simpprod)$
xxx : product(f(i),i,1,∞)$
xxx : subst(f(i) = product(g(k),k,1,∞), xxx)$
timer_info();
matrix([function,time\/\/call,calls,runtime,gctime], [simpprod,0.0013867*sec,3098,4.296*sec,0], [total,0.0013867*sec,3098,4.296*sec,0])
:lisp(defun infsimp (e) e);
WARNING: redefining MAXIMA::INFSIMP in DEFUN INFSIMPxxx : product(f(i),i,1,∞)$
xxx : subst(f(i) = product(g(k),k,1,∞), xxx)$
timer_info();
matrix([function,time\/\/call,calls,runtime,gctime], [simpprod,0.0013775*sec,3256,4.485*sec,0], [total,0.0013775*sec,3256,4.485*sec,0])
xxx : product(product(product(g(k),k,1,∞),m,1,∞),s,1,∞)$
:lisp(print $xxx)
((%PRODUCT) ((%PRODUCT SIMP) ((%PRODUCT SIMP) (($G SIMP) $K) $K 1 $INF) $M 1 $INF) $S 1 $INF) ((%PRODUCT) ((%PRODUCT SIMP) ((%PRODUCT SIMP) (($G SIMP) $K) $K 1 $INF) $M 1 $INF) $S 1 $INF)
Daniel Volinski
En martes, 21 de octubre de 2025, 23:06:44 GMT+3, Barton Willis via Maxima-discuss <max...@li...> escribió:
#yiv4441728438 P {margin-top:0;margin-bottom:0;}Last observation for now:
(%i1) xxx : product(product(product(g(k),k,1,inf),m,1,inf),s,1,inf)$
(%i2) :lisp(print $xxx)((%PRODUCT) ((%PRODUCT) ((%PRODUCT SIMP) (($G SIMP) $K) $K 1 $INF) $M 1 $INF) $S 1 $INF)
The outer two products are not marked as simplified, but the inner product is simplified.
--BartonFrom: Barton Willis <wi...@un...>
Sent: Tuesday, October 21, 2025 12:11 PM
To: <max...@li...> <max...@li...>; Barton Willis <wi...@un...>
Subject: Re: modest calculation that calls infsimp 2.4 million times <!--#yiv4441728438 p {margin-top:0;margin-bottom:0;}-->
(%i2) timer(?simpprod);(%o2) [simpprod](%i3) xxx : product(f(i),i,1,inf)$(%i4) xxx : subst(f(i) = product(g(k),k,1,inf), xxx)$(%i5) timer_info();(%o5) matrix( [function, time\/call, calls, runtime, gctime], [simpprod, 1.4972326095270472*10^-4*sec, 47066, 7.046875*sec, 0], [total, 1.4972326095270472*10^-4*sec, 47066, 7.046875*sec, 0] )
Over 47,000 calls to simpprod is crazy. Let's try this again, but define infsimp to be the identity fumction:
(%i1) timer(?simpprod);(%o1) [simpprod](%i2) :lisp(defun infsimp (e) e);INFSIMP(%i2) xxx : product(f(i),i,1,inf)$(%i3) xxx : subst(f(i) = product(g(k),k,1,inf), xxx)$(%i4) timer_info();(%o4) matrix( [function, time\/call, calls, runtime, gctime], [simpprod, 4.222972972972973*10^-4*sec, 74, 0.03125*sec, 0], [total, 4.222972972972973*10^-4*sec, 74, 0.03125*sec, 0] )
Now only 74 calls to simpprod—that's too many, I think, but it's better than 47,000.From: Barton Willis via Maxima-discuss <max...@li...>
Sent: Monday, October 20, 2025 9:21 AM
To: <max...@li...> <max...@li...>
Subject: [Maxima-discuss] modest calculation that calls infsimp 2.4 million times <!--#yiv4441728438 p {margin-top:0;margin-bottom:0;}-->
| | Caution: Non-NU Email |
If you all are looking for a puzzle that is possibly more fun than Sudoko or Queens, figure out whyinfsimp is called over 2.4 million times to do the following modest calculation:
(%i1) timer(?infsimp)$
(%i2) xxx : product(f(i),i,1,inf)$
(%i3) xxx : subst(f(i) = product(g(k),k,1,inf), xxx)$
(%i4) xxx : subst(g(k) = product(w(m),m,1,inf), xxx)$
(%i5) timer_info();(%o5) matrix( [function, time\/call, calls, runtime, gctime], [infsimp, 6.329070747905959*10^-5*sec, 2400382, 151.921875*sec, 0], [total, 6.329070747905959*10^-5*sec, 2400382, 151.921875*sec, 0] )
I haven't tried to figure this out.
--Barton_______________________________________________
Maxima-discuss mailing list
Max...@li...
https://lists.sourceforge.net/lists/listinfo/maxima-discuss
|
|
From: Eduardo O. <edu...@gm...> - 2025-10-21 20:28:54
|
Hi list,
long story very short: the code below produces this,
(%i4) VB1 : verbatimbox("ab", "cdef", "g");
(%o4) ab
cdef
g
but it has some bugs.
Here's how to test it. Save the code below to
/tmp/verbatimbox.lisp,
--snip--snip--
(defclass verbatimbox ()
((result :initarg :result :initform nil)
(lastwidth :initarg :lastwidth :initform nil)
(maxwidth :initarg :maxwidth :initform nil)
(depth :initarg :depth :initform nil)))
(defun make-verbatimbox-from-string (str)
(let* ((chars (exploden str))
(width (length chars)))
(make-instance 'verbatimbox
:maxwidth width
:lastwidth width
:depth 0
:result (reverse chars))))
(defmethod verbatimbox-add-line-at-bottom ((vb verbatimbox) str)
(with-slots (result lastwidth maxwidth (dp depth)) vb
(let* ((chars (exploden str))
(width (length chars)))
(setq dp (1+ dp))
(setq result `((,(- lastwidth) ,(- dp) ,@(reverse chars)) ,@result))
(setq lastwidth width)
(setq maxwidth (max maxwidth width))
vb)))
(defun make-verbatimbox-from-strings (strs)
(let ((vb (make-verbatimbox-from-string (car strs))))
(loop for str in (cdr strs)
do (verbatimbox-add-line-at-bottom vb str))
vb))
(defmethod verbatimbox-setqs ((vb verbatimbox))
(with-slots (lastwidth maxwidth (dp depth)) vb
`(setq depth ,dp
maxdp ,dp
width ,maxwidth)))
(defmethod verbatimbox-result ((vb verbatimbox))
(with-slots (result) vb result))
(defun dim-verbatimbox (form result)
(let* ((strings (cdr form))
(vb (make-verbatimbox-from-strings strings))
(setqs (verbatimbox-setqs vb))
(vbresult (verbatimbox-result vb)))
(eval setqs)
(append vbresult result)))
(setf (get '$verbatimbox 'dimension) 'dim-verbatimbox)
--snip--snip--
...and then run either one, or both, of these blocks in a Maxima REPL:
--snip--snip--
load("/tmp/verbatimbox.lisp");
display2d_unicode : false;
linel : 50;
VB : verbatimbox("ab", "cdef", "g");
M : matrix([VB]);
matrix([2, VB, 3]);
matrix([2, M, 3]);
to_lisp();
(load "/tmp/verbatimbox.lisp")
(defvar myvb)
(setq myvb (make-verbatimbox-from-strings '("ab" "cdef" "g")))
(describe myvb)
(verbatimbox-setqs myvb)
(verbatimbox-result myvb)
(to-maxima)
--snip--snip--
Here are the relevant parts of their outputs:
(%i4) VB : verbatimbox("ab", "cdef", "g");
(%o4) ab
cdef
g
(%i5) M : matrix([VB]);
[ ab]
(%o5) [ cdef]
[ g ]
(%i6) matrix([2, VB, 3]);
[ 2 ab 3 ]
(%o6) [ cdef ]
[ g ]
(%i7) matrix([2, M, 3]);
[ [ ab] ]
(%o7) [ 2 [ cdef] 3 ]
[ [ g ] ]
(%i8)
MAXIMA> (describe myvb)
Slots with :INSTANCE allocation:
RESULT = ((-4 -2 #\g) (-2 -1 #\f #\e #\d #\c) #\b #\a)
LASTWIDTH = 1
MAXWIDTH = 4
DEPTH = 2
MAXIMA> (verbatimbox-setqs myvb)
(SETQ DEPTH 2
MAXDP 2
WIDTH 4)
It seems that doing "(setq width 4)" is not enough...
Suggestions, please?
Cheers,
Eduardo...
http://anggtwu.net/eev-maxima.html
P.S.: this is related to these two posts, that I sent
to the list a few hours ago...
https://sourceforge.net/p/maxima/mailman/message/59249515/
https://sourceforge.net/p/maxima/mailman/message/59249497/
|
|
From: Barton W. <wi...@un...> - 2025-10-21 20:04:00
|
Last observation for now: (%i1) xxx : product(product(product(g(k),k,1,inf),m,1,inf),s,1,inf)$ (%i2) :lisp(print $xxx) ((%PRODUCT) ((%PRODUCT) ((%PRODUCT SIMP) (($G SIMP) $K) $K 1 $INF) $M 1 $INF) $S 1 $INF) The outer two products are not marked as simplified, but the inner product is simplified. --Barton ________________________________ From: Barton Willis <wi...@un...> Sent: Tuesday, October 21, 2025 12:11 PM To: <max...@li...> <max...@li...>; Barton Willis <wi...@un...> Subject: Re: modest calculation that calls infsimp 2.4 million times (%i2) timer(?simpprod); (%o2) [simpprod] (%i3) xxx : product(f(i),i,1,inf)$ (%i4) xxx : subst(f(i) = product(g(k),k,1,inf), xxx)$ (%i5) timer_info(); (%o5) matrix( [function, time\/call, calls, runtime, gctime], [simpprod, 1.4972326095270472*10^-4*sec, 47066, 7.046875*sec, 0], [total, 1.4972326095270472*10^-4*sec, 47066, 7.046875*sec, 0] ) Over 47,000 calls to simpprod is crazy. Let's try this again, but define infsimp to be the identity fumction: (%i1) timer(?simpprod); (%o1) [simpprod] (%i2) :lisp(defun infsimp (e) e); INFSIMP (%i2) xxx : product(f(i),i,1,inf)$ (%i3) xxx : subst(f(i) = product(g(k),k,1,inf), xxx)$ (%i4) timer_info(); (%o4) matrix( [function, time\/call, calls, runtime, gctime], [simpprod, 4.222972972972973*10^-4*sec, 74, 0.03125*sec, 0], [total, 4.222972972972973*10^-4*sec, 74, 0.03125*sec, 0] ) Now only 74 calls to simpprod—that's too many, I think, but it's better than 47,000. ________________________________ From: Barton Willis via Maxima-discuss <max...@li...> Sent: Monday, October 20, 2025 9:21 AM To: <max...@li...> <max...@li...> Subject: [Maxima-discuss] modest calculation that calls infsimp 2.4 million times Caution: Non-NU Email If you all are looking for a puzzle that is possibly more fun than Sudoko or Queens, figure out why infsimp is called over 2.4 million times to do the following modest calculation: (%i1) timer(?infsimp)$ (%i2) xxx : product(f(i),i,1,inf)$ (%i3) xxx : subst(f(i) = product(g(k),k,1,inf), xxx)$ (%i4) xxx : subst(g(k) = product(w(m),m,1,inf), xxx)$ (%i5) timer_info(); (%o5) matrix( [function, time\/call, calls, runtime, gctime], [infsimp, 6.329070747905959*10^-5*sec, 2400382, 151.921875*sec, 0], [total, 6.329070747905959*10^-5*sec, 2400382, 151.921875*sec, 0] ) I haven't tried to figure this out. --Barton |
|
From: Barton W. <wi...@un...> - 2025-10-21 19:10:51
|
(%i2) timer(?simpprod); (%o2) [simpprod] (%i3) xxx : product(f(i),i,1,inf)$ (%i4) xxx : subst(f(i) = product(g(k),k,1,inf), xxx)$ (%i5) timer_info(); (%o5) matrix( [function, time\/call, calls, runtime, gctime], [simpprod, 1.4972326095270472*10^-4*sec, 47066, 7.046875*sec, 0], [total, 1.4972326095270472*10^-4*sec, 47066, 7.046875*sec, 0] ) Over 47,000 calls to simpprod is crazy. Let's try this again, but define infsimp to be the identity fumction: (%i1) timer(?simpprod); (%o1) [simpprod] (%i2) :lisp(defun infsimp (e) e); INFSIMP (%i2) xxx : product(f(i),i,1,inf)$ (%i3) xxx : subst(f(i) = product(g(k),k,1,inf), xxx)$ (%i4) timer_info(); (%o4) matrix( [function, time\/call, calls, runtime, gctime], [simpprod, 4.222972972972973*10^-4*sec, 74, 0.03125*sec, 0], [total, 4.222972972972973*10^-4*sec, 74, 0.03125*sec, 0] ) Now only 74 calls to simpprod—that's too many, I think, but it's better than 47,000. ________________________________ From: Barton Willis via Maxima-discuss <max...@li...> Sent: Monday, October 20, 2025 9:21 AM To: <max...@li...> <max...@li...> Subject: [Maxima-discuss] modest calculation that calls infsimp 2.4 million times Caution: Non-NU Email If you all are looking for a puzzle that is possibly more fun than Sudoko or Queens, figure out why infsimp is called over 2.4 million times to do the following modest calculation: (%i1) timer(?infsimp)$ (%i2) xxx : product(f(i),i,1,inf)$ (%i3) xxx : subst(f(i) = product(g(k),k,1,inf), xxx)$ (%i4) xxx : subst(g(k) = product(w(m),m,1,inf), xxx)$ (%i5) timer_info(); (%o5) matrix( [function, time\/call, calls, runtime, gctime], [infsimp, 6.329070747905959*10^-5*sec, 2400382, 151.921875*sec, 0], [total, 6.329070747905959*10^-5*sec, 2400382, 151.921875*sec, 0] ) I haven't tried to figure this out. --Barton |
|
From: Michel T. <ta...@lp...> - 2025-10-21 18:38:45
|
Maybe this can help you: (%i1) load(cgrind); (%i2) var:-((sqrt(m_piM^4+W^8*cost^2-W^8+4*P0^2*W^6)+((cost^2-1)*m_nuc^2+W^2*cost^2-W^2)*m_piM^4+sqrt(m_piM^2+P0^2)*(4*W^2*m_nuc*m_piM^2-4*W^2*m_nuc^3+4*W^4*m_nuc)+((2-2*cost^2)*m_nuc^4-4*W^2*cost^2*m_nuc^2-2*W^4*cost^2-2*W^4)*m_piM^2+(cost^2-1)*m_nuc^6+(W^2-W^2*cost^2)*m_nuc^4+(W^4-W^4*cost^2)*m_nuc^2+W^6*cost^2-W^6)/((cost^2-1)*m_piM^4+((2-2*cost^2)*m_nuc^2-2*W^2*cost^2-2*W^2)*m_piM^2+(cost^2-1)*m_nuc^4+(2*W^2-2*W^2*cost^2)*m_nuc^2+W^4*cost^2-W^4)); (%i3) cgrind(var); -((sqrt(pow(m_piM,4)+pow(W,8)*pow(cost,2)-pow(W,8)+4*pow(P0,2)*pow(W,6)) +((pow(cost,2)-1)*pow(m_nuc,2)+pow(W,2)*pow(cost,2)-pow(W,2))*pow(m_piM,4) +sqrt(pow(m_piM,2)+pow(P0,2))*(4*pow(W,2)*m_nuc*pow(m_piM,2) -4*pow(W,2)*pow(m_nuc,3)+4*pow(W,4)*m_nuc) +((2-2*pow(cost,2))*pow(m_nuc,4)-4*pow(W,2)*pow(cost,2)*pow(m_nuc,2) -2*pow(W,4)*pow(cost,2)-2*pow(W,4)) *pow(m_piM,2)+(pow(cost,2)-1)*pow(m_nuc,6) +(pow(W,2)-pow(W,2)*pow(cost,2))*pow(m_nuc,4) +(pow(W,4)-pow(W,4)*pow(cost,2))*pow(m_nuc,2)+pow(W,6)*pow(cost,2)-pow(W,6)) /((pow(cost,2)-1)*pow(m_piM,4)+((2-2*pow(cost,2))*pow(m_nuc,2) -2*pow(W,2)*pow(cost,2)-2*pow(W,2)) *pow(m_piM,2)+(pow(cost,2)-1)*pow(m_nuc,4) +(2*pow(W,2)-2*pow(W,2)*pow(cost,2)) *pow(m_nuc,2)+pow(W,4)*pow(cost,2)-pow(W,4))); (%o3) done Of course, contrary to gentran, cgrind will not translate maxima programs, only formulas. Le 21/10/2025 à 14:24, Ivan via Maxima-discuss a écrit : > Hi all, > > I cannot convert a long enough expression into C code with gentran. Is > it bug or I'm missing something? -- Michel Talon |
|
From: Eduardo O. <edu...@gm...> - 2025-10-21 18:13:19
|
Update! This is much better - the change is the ",@result" in the
backquote:
to_lisp();
(setf (get '$abcdef 'dimension) 'dim-abcdef)
(defun dim-abcdef (form result)
(declare (ignorable form result))
(setq depth 2)
(setq maxdp 2)
(setq width 3)
`((-3 -2 #\f #\e) (-1 -1 #\d #\c #\b) #\a ,@result))
(to-maxima)
linel : 40;
display2d_unicode : false;
matrix([abcdef(), 42]);
42 + abcdef();
abcdef();
The output is:
(%i4) matrix([abcdef(), 42]);
[ a 42 ]
(%o4) [ bcd ]
[ ef ]
(%i5) 42 + abcdef();
(%o5) a + 42
bcd
ef
(%i6) abcdef();
(%o6) a
bcd
ef
It works well enough for what I need, but it is drawn glued to the "+"
instead of separated from it by a space. Any suggestions very welcome,
of course - but I'll try to clean up the code even without that fix,
and I will post it here when it gets ready...
Cheers =),
Eduardo
On Tue, 21 Oct 2025 at 11:52, Eduardo Ochs <edu...@gm...> wrote:
> Hi list!
>
> First, some context. In this message from a few days ago
>
> https://sourceforge.net/p/maxima/mailman/message/59245670/
>
> Robert Dodier showed a way to draw matrixes without border characters.
> I have lots of objects - like trees and certain diagrams for teaching
> set comprehensions - that can be represented nicely in ascii art, and
> using RD's trick I can almost do what I want/need.
>
> The most obvious way of handling that problem is saying that what I
> want is wrong, but let me follow another path, and start by a minimal
> example. Here is what I can do with RD's trick. If we run this in a
> REPL in a recent Maxima,
>
> to_lisp();
> (setf (get '$barematrix 'dimension) 'dim-$barematrix)
> (defun dim-$barematrix (form result)
> (let (($display_matrix_brackets nil))
> (dim-$matrix form result)))
> (to-maxima)
> linel : 60;
> display2d_unicode : false;
> BM : barematrix(["a "], ["bcd"], ["ef "]);
> matrix([BM, 42]);
>
> We get this:
>
> (%i4) BM : barematrix(["a "], ["bcd"], ["ef "]);
> a
>
> (%o4) bcd
>
> ef
> (%i5) matrix([BM, 42]);
> [ a ]
> [ ]
> (%o5) [ bcd 42 ]
> [ ]
> [ ef ]
> (%i6)
>
> BM looks like "a\n\nbcd\n\nef", but I would like to get something that
> looks like "a\nbcd\nef", without the interline spacings.
>
> Here is an attempt to get a "a\nbcd\nef" using very low-level tools.
> If we run this in a Maxima REPL,
>
> to_lisp();
> (setf (get '$abcdef 'dimension) 'dim-abcdef)
> (defun dim-abcdef (form result)
> (declare (ignorable form result))
> (setq depth 2)
> (setq maxdp 2)
> (setq width 3)
> '((-3 -2 #\f #\e) (-1 -1 #\d #\c #\b) #\a))
> (to-maxima)
> linel : 40;
> display2d_unicode : false;
> matrix([abcdef(), 42]);
> 42 + abcdef();
> abcdef();
>
> it works, or sort of, in some contexts, but it is very buggy. Look:
>
> (%i4) matrix([abcdef(), 42]);
> [ a 42 ]
> (%o4) [ bcd ]
> [ ef ]
>
> (%i5) 42 + abcdef();
> a + 42
> bcd
> ef
> (%i6) abcdef();
> 24 +
>
> ef
>
> I'm looking for suggestions on what to fix in my dim-abcdef. If anyone
> wants to take a look at the tools that I am using to explore
> displa.lisp and displm.lisp, they are here -
> <http://anggtwu.net/MAXIMA/2025-testdispla.lisp.html> - but they are
> not worth looking at now, and they are only "documented" using test
> blocks: <http://anggtwu.net/eepitch.html#test-blocks>.
>
> Suggestions like "trace the variables such and such" would be great,
> and suggestions like "use the functions blah and blah instead of your
> setqs", or "make your function return bleh instead of '((-3 -2 #\f
> #\e) (-1 -1 #\d #\c #\b) #\a)" would be even better...
>
> Thanks in advance!
> Eduardo Ochs =)
> http://anggtwu.net/eev-maxima.html
>
>
|
|
From: Eduardo O. <edu...@gm...> - 2025-10-21 17:50:20
|
Hi list! First, some context. In this message from a few days ago https://sourceforge.net/p/maxima/mailman/message/59245670/ Robert Dodier showed a way to draw matrixes without border characters. I have lots of objects - like trees and certain diagrams for teaching set comprehensions - that can be represented nicely in ascii art, and using RD's trick I can almost do what I want/need. The most obvious way of handling that problem is saying that what I want is wrong, but let me follow another path, and start by a minimal example. Here is what I can do with RD's trick. If we run this in a REPL in a recent Maxima, to_lisp(); (setf (get '$barematrix 'dimension) 'dim-$barematrix) (defun dim-$barematrix (form result) (let (($display_matrix_brackets nil)) (dim-$matrix form result))) (to-maxima) linel : 60; display2d_unicode : false; BM : barematrix(["a "], ["bcd"], ["ef "]); matrix([BM, 42]); We get this: (%i4) BM : barematrix(["a "], ["bcd"], ["ef "]); a (%o4) bcd ef (%i5) matrix([BM, 42]); [ a ] [ ] (%o5) [ bcd 42 ] [ ] [ ef ] (%i6) BM looks like "a\n\nbcd\n\nef", but I would like to get something that looks like "a\nbcd\nef", without the interline spacings. Here is an attempt to get a "a\nbcd\nef" using very low-level tools. If we run this in a Maxima REPL, to_lisp(); (setf (get '$abcdef 'dimension) 'dim-abcdef) (defun dim-abcdef (form result) (declare (ignorable form result)) (setq depth 2) (setq maxdp 2) (setq width 3) '((-3 -2 #\f #\e) (-1 -1 #\d #\c #\b) #\a)) (to-maxima) linel : 40; display2d_unicode : false; matrix([abcdef(), 42]); 42 + abcdef(); abcdef(); it works, or sort of, in some contexts, but it is very buggy. Look: (%i4) matrix([abcdef(), 42]); [ a 42 ] (%o4) [ bcd ] [ ef ] (%i5) 42 + abcdef(); a + 42 bcd ef (%i6) abcdef(); 24 + ef I'm looking for suggestions on what to fix in my dim-abcdef. If anyone wants to take a look at the tools that I am using to explore displa.lisp and displm.lisp, they are here - <http://anggtwu.net/MAXIMA/2025-testdispla.lisp.html> - but they are not worth looking at now, and they are only "documented" using test blocks: <http://anggtwu.net/eepitch.html#test-blocks>. Suggestions like "trace the variables such and such" would be great, and suggestions like "use the functions blah and blah instead of your setqs", or "make your function return bleh instead of '((-3 -2 #\f #\e) (-1 -1 #\d #\c #\b) #\a)" would be even better... Thanks in advance! Eduardo Ochs =) http://anggtwu.net/eev-maxima.html |
|
From: Robert D. <rob...@gm...> - 2025-10-21 17:45:19
|
Ivan, sorry to hear you're having trouble with Gentran. It is probably
some relatively simple bug, but I don't know enough about Gentran to
fix it.
I've had some luck using f90 (Fortran 90) to generate C code. First
I'll replace "^" (exponent) expressions with "pow" -- one could of
course substitute any function.
var:-((sqrt(m_piM^4+W^8*cost^2-W^8+4*P0^2*W^6)+((cost^2-1)*m_nuc^2+W^2*cost^2-W^2)*m_piM^4+sqrt(m_piM^2+P0^2)*(4*W^2*m_nuc*m_piM^2-4*W^2*m_nuc^3+4*W^4*m_nuc)+((2-2*cost^2)*m_nuc^4-4*W^2*cost^2*m_nuc^2-2*W^4*cost^2-2*W^4)*m_piM^2+(cost^2-1)*m_nuc^6+(W^2-W^2*cost^2)*m_nuc^4+(W^4-W^4*cost^2)*m_nuc^2+W^6*cost^2-W^6)/((cost^2-1)*m_piM^4+((2-2*cost^2)*m_nuc^2-2*W^2*cost^2-2*W^2)*m_piM^2+(cost^2-1)*m_nuc^4+(2*W^2-2*W^2*cost^2)*m_nuc^2+W^4*cost^2-W^4));
var1: subst ("^" = pow, var);
load (f90);
f90_output_line_length_max: 100000;
f90 (var1);
Here's what I get:
-((pow(pow(m_piM,4)+pow(W,8)*pow(cost,2)-pow(W,8)+4*pow(P0,2)*pow(W,6),1.0d0/2.0d0)+(4*pow(W,2)*m_nuc*pow(m_piM,2)-4*pow(W,2)*pow(m_nuc,3)+4*pow(W,4)*m_nuc)*pow(pow(m_piM,2)+pow(P0,2),1.0d0/2.0d0)+((pow(cost,2)-1)*pow(m_nuc,2)+pow(W,2)*pow(cost,2)-pow(W,2))*pow(m_piM,4)+((2-2*pow(cost,2))*pow(m_nuc,4)-4*pow(W,2)*pow(cost,2)*pow(m_nuc,2)-2*pow(W,4)*pow(cost,2)-2*pow(W,4))*pow(m_piM,2)+(pow(cost,2)-1)*pow(m_nuc,6)+(pow(W,2)-pow(W,2)*pow(cost,2))*pow(m_nuc,4)+(pow(W,4)-pow(W,4)*pow(cost,2))*pow(m_nuc,2)+pow(W,6)*pow(cost,2)-pow(W,6))*pow((pow(cost,2)-1)*pow(m_piM,4)+((2-2*pow(cost,2))*pow(m_nuc,2)-2*pow(W,2)*pow(cost,2)-2*pow(W,2))*pow(m_piM,2)+(pow(cost,2)-1)*pow(m_nuc,4)+(2*pow(W,2)-2*pow(W,2)*pow(cost,2))*pow(m_nuc,2)+pow(W,4)*pow(cost,2)-pow(W,4),-1))
Note that this is all on one line -- f90 introduces continuation
characters (ampersand) when the expression is longer than
f90_output_line_length_max.
There are other possibilities -- maybe you can say more about what you
are trying to do.
Robert
|
|
From: Ivan <ast...@bk...> - 2025-10-21 12:24:06
|
Hi all, I cannot convert a long enough expression into C code with gentran. Is it bug or I'm missing something? Also, is there any other way to generate C code? The expression that cannot be converted is var:-((sqrt(m_piM^4+W^8*cost^2-W^8+4*P0^2*W^6)+((cost^2-1)*m_nuc^2+W^2*cost^2-W^2)*m_piM^4+sqrt(m_piM^2+P0^2)*(4*W^2*m_nuc*m_piM^2-4*W^2*m_nuc^3+4*W^4*m_nuc)+((2-2*cost^2)*m_nuc^4-4*W^2*cost^2*m_nuc^2-2*W^4*cost^2-2*W^4)*m_piM^2+(cost^2-1)*m_nuc^6+(W^2-W^2*cost^2)*m_nuc^4+(W^4-W^4*cost^2)*m_nuc^2+W^6*cost^2-W^6)/((cost^2-1)*m_piM^4+((2-2*cost^2)*m_nuc^2-2*W^2*cost^2-2*W^2)*m_piM^2+(cost^2-1)*m_nuc^4+(2*W^2-2*W^2*cost^2)*m_nuc^2+W^4*cost^2-W^4)); Here is full example: $ maxima Loading /home/larry/.maxima/maxima-init.mac Maxima 5.48.1 https://maxima.sourceforge.io using Lisp SBCL 2.5.4 Distributed under the GNU Public License. See the file COPYING. Dedicated to the memory of William Schelter. The function bug_report() provides bug reporting information. (%i1) load(allgentran); (%o1) /usr/share/maxima/5.48.1/share/contrib/gentran/allgentran.lisp (%i2) gentranlang:c; (%o2) c (%i3) var:-((sqrt(m_piM^4+W^8*cost^2-W^8+4*P0^2*W^6)+((cost^2-1)*m_nuc^2+W^2*cost^2-W^2)*m_piM^4+sqrt(m_piM^2+P0^2)*(4*W^2*m_nuc*m_piM^2-4*W^2*m_nuc^3+4*W^4*m_nuc)+((2-2*cost^2)*m_nuc^4-4*W^2*cost^2*m_nuc^2-2*W^4*cost^2-2*W^4)*m_piM^2+(cost^2-1)*m_nuc^6+(W^2-W^2*cost^2)*m_nuc^4+(W^4-W^4*cost^2)*m_nuc^2+W^6*cost^2-W^6)/((cost^2-1)*m_piM^4+((2-2*cost^2)*m_nuc^2-2*W^2*cost^2-2*W^2)*m_piM^2+(cost^2-1)*m_nuc^4+(2*W^2-2*W^2*cost^2)*m_nuc^2+W^4*cost^2-W^4)); 4 8 2 8 2 6 (%o3) - (sqrt(m_piM + W cost - W + 4 P0 W ) 2 2 2 2 2 4 + ((cost - 1) m_nuc + W cost - W ) m_piM 2 2 2 2 2 3 4 + sqrt(m_piM + P0 ) (4 W m_nuc m_piM - 4 W m_nuc + 4 W m_nuc) 2 4 2 2 2 4 2 4 2 + ((2 - 2 cost ) m_nuc - 4 W cost m_nuc - 2 W cost - 2 W ) m_piM 2 6 2 2 2 4 4 4 2 2 + (cost - 1) m_nuc + (W - W cost ) m_nuc + (W - W cost ) m_nuc 6 2 6 2 4 2 2 2 2 + W cost - W )/((cost - 1) m_piM + ((2 - 2 cost ) m_nuc - 2 W cost 2 2 2 4 2 2 2 2 4 2 - 2 W ) m_piM + (cost - 1) m_nuc + (2 W - 2 W cost ) m_nuc + W cost 4 - W ) (%i4) gentran(eval(var)); Maxima encountered a Lisp error: LEFTOVER-MFORMAT-ARGS?: extra mformat args (NIL T0 undeclared variable NIL) Automatically continuing. To enable the Lisp debugger set *debugger-hook* to nil. |
|
From: Barton W. <wi...@un...> - 2025-10-20 17:56:49
|
If you all are looking for a puzzle that is possibly more fun than Sudoko or Queens, figure out why infsimp is called over 2.4 million times to do the following modest calculation: (%i1) timer(?infsimp)$ (%i2) xxx : product(f(i),i,1,inf)$ (%i3) xxx : subst(f(i) = product(g(k),k,1,inf), xxx)$ (%i4) xxx : subst(g(k) = product(w(m),m,1,inf), xxx)$ (%i5) timer_info(); (%o5) matrix( [function, time\/call, calls, runtime, gctime], [infsimp, 6.329070747905959*10^-5*sec, 2400382, 151.921875*sec, 0], [total, 6.329070747905959*10^-5*sec, 2400382, 151.921875*sec, 0] ) I haven't tried to figure this out. --Barton |
|
From: Stavros M. <mac...@gm...> - 2025-10-18 22:47:41
|
Thanks for your interest in Maxima!
In addition to Barton's comments, note that your conditional will never
fall through to the third case (oscillatory).
So for *expression: sin(n)* or *n*sin(n)*, it prints that it is convergent.
On Sat, Oct 18, 2025 at 3:21 PM SHIVAMMA K <shi...@gm...> wrote:
> kill(all)$
> expression: (log(n+1)-log(n))/sin(1/n);
> variable: n$
> print("The given sequence is: ", expression)$
> sequence: limit(expression, variable, inf)$
> print("Limit of the sequence as n tends to infinity is: ", sequence)$
> if abs(sequence) = inf then
> print("By the definition, the sequence is divergent")
> else if abs(sequence) # inf then
> print("By the definition, the sequence is convergent")
> else
> print("By the definition, the sequence is oscillatory")$
>
> _______________________________________________
> Maxima-discuss mailing list
> Max...@li...
> https://lists.sourceforge.net/lists/listinfo/maxima-discuss
>
|
|
From: Barton W. <wi...@un...> - 2025-10-18 22:05:34
|
Hi Shivamma,
Did you have a question about your calculation? Maybe you would like to write a function that does what you have shown for one example? If so, I think that should be possible.
Two things you might like to know: First Maxima sometimes returns ind (bounded & indefinite) or und (undefined) for a limit; here are examples:
(%i2) limit(sin(x),x,inf);
(%o2) ind
(%i3) limit(x*sin(x),x,inf);
(%o3) und
Maybe you can find more information in the manual.
Second, Maxima's limit function doesn't have support for telling limit that the limit variable is an integer--it assumes the limit variable is continuous even when it is declared integer. That gives undesirable results such as
(%i13) declare(n,integer)$
(%i14) limit(sin(n*%pi+1/n),n,inf);
(%o14) ind
But notice that
(%i15) limit(sin(n*%pi),n,inf);
(%o15) 0
Appears to understand that n is an integer, but actually, Maxima simplifies sin(n * %pi) to zero before limit is called limit.
If limit understood that the limit varible was an integer, the limit would be zero. But to Maxima, the limit is of the function n ∈ Reals -> sin(n * %pi + 1/n) even when n is declared an integer.
Please let us know if you all have questions.
--Barton
________________________________
From: SHIVAMMA K <shi...@gm...>
Sent: Tuesday, October 14, 2025 11:26 AM
To: max...@li... <max...@li...>
Subject: [Maxima-discuss] Maths
Caution: Non-NU Email
kill(all)$
expression: (log(n+1)-log(n))/sin(1/n);
variable: n$
print("The given sequence is: ", expression)$
sequence: limit(expression, variable, inf)$
print("Limit of the sequence as n tends to infinity is: ", sequence)$
if abs(sequence) = inf then
print("By the definition, the sequence is divergent")
else if abs(sequence) # inf then
print("By the definition, the sequence is convergent")
else
print("By the definition, the sequence is oscillatory")$
|
|
From: LÓPEZ M. D. J. <Dav...@up...> - 2025-10-18 12:07:22
|
Thank you for your answers. I think that (setf (get 'mminus 'tex-rbp) 100) is just the code I was looking for. Best regards, David. ________________________________ De: Robert Dodier <rob...@gm...> Enviado: sábado, 18 de octubre de 2025 6:00 Para: LÓPEZ MEDINA, DAVID JAVIER <Dav...@up...> Cc: max...@li... <max...@li...> Asunto: Re: [Maxima-discuss] Weird behaviour of maxima and tex function with minus signs On Fri, Oct 17, 2025 at 11:54 AM LÓPEZ MEDINA, DAVID JAVIER <Dav...@up...> wrote: > (%i1) -1-2*x-(-3*y)-4*z; > > leads to the output > > (%o1) - 4 z + 3 y - 2 x - 1 > > (what is nice), but the tex output is strange > > (%i2) tex(%)$ > $$-\left(4\,z\right)+3\,y-2\,x-1$$ Placement of parentheses is governed by what is called right binding power and left binding power -- these are essentially operator precedence levels. The rbp and lbp for various operators have been adjusted over the years to solve parentheses placement problems, in particular, to ensure that there are parentheses to make the expression unambiguous. This sometimes leads to excess parentheses, as we see here. A quick fix for this specific problem is :lisp (setf (get 'mminus 'tex-rbp) 100) which, for TeX output, reduces the right binding power from its current value (134) to 100. This is enough to get the expected behavior in the example shown -- after that, I get tex (-1-2*x-(-3*y)-4*z); => $$-4\,z+3\,y-2\,x-1$$ Whether the different binding power is generally desirable would depend on how it interacts with other operators such as "+", "*", "/", and "^". I will open a bug report about to keep track of whatever I (or anyone else) can figure out. Robert |
|
From: Robert D. <rob...@gm...> - 2025-10-18 04:04:08
|
On Fri, Oct 17, 2025 at 2:02 PM serge de marre <sde...@gm...> wrote: > > Strangely enough, when running imaxima (an emacs mode which immediately displays expressions using tex), the expressions are looking good and calling the tex() function doesn't have those \left( and \right). Imaxima has its own TeX code, and redefines some of the stuff which is also present in Maxima. In particular MMINUS (unary minus) is given right binding power equal to 100. I think that was the value in Maxima a long time ago, but it was changed maybe 10 or 15 years ago to solve some other problem having to do with parentheses. All the best, Robert |
|
From: Robert D. <rob...@gm...> - 2025-10-18 04:00:46
|
On Fri, Oct 17, 2025 at 11:54 AM LÓPEZ MEDINA, DAVID JAVIER <Dav...@up...> wrote: > (%i1) -1-2*x-(-3*y)-4*z; > > leads to the output > > (%o1) - 4 z + 3 y - 2 x - 1 > > (what is nice), but the tex output is strange > > (%i2) tex(%)$ > $$-\left(4\,z\right)+3\,y-2\,x-1$$ Placement of parentheses is governed by what is called right binding power and left binding power -- these are essentially operator precedence levels. The rbp and lbp for various operators have been adjusted over the years to solve parentheses placement problems, in particular, to ensure that there are parentheses to make the expression unambiguous. This sometimes leads to excess parentheses, as we see here. A quick fix for this specific problem is :lisp (setf (get 'mminus 'tex-rbp) 100) which, for TeX output, reduces the right binding power from its current value (134) to 100. This is enough to get the expected behavior in the example shown -- after that, I get tex (-1-2*x-(-3*y)-4*z); => $$-4\,z+3\,y-2\,x-1$$ Whether the different binding power is generally desirable would depend on how it interacts with other operators such as "+", "*", "/", and "^". I will open a bug report about to keep track of whatever I (or anyone else) can figure out. Robert |