From: Eduardo O. <edu...@gm...> - 2024-10-27 05:17:36
|
Hi list, I know that this is not supposed to work, but I think that the question is interesting anyway... In this thread from mid-august - https://sourceforge.net/p/maxima/mailman/message/58807287/ ...I learned that the result of factor(12345678) is not simplified because is starts with (MTIMES SIMP FACTORED). A few hours ago I decided to test if I could use that same trick with other arithmetic expressions, and it ALMOST worked. These three expressions factor(12345678); lambda([], 2 * 3^2 * 47 * 14593); lambda([], 2+3); are, respectively: ((MTIMES SIMP FACTORED) 2 ((MEXPT SIMP) 3 2) 47 14593) ((LAMBDA SIMP) ((MLIST)) ((MTIMES) 2 ((MEXPT) 3 2) 47 14593)) ((LAMBDA SIMP) ((MLIST)) ((MPLUS) 2 3)) I tried to run this in a REPL, format0(o) := format("~s",o); o : factor(12345678); o2 : lambda([], 2 * 3^2 * 47 * 14593); o3 : lambda([], 2+3); format0(o); format0(o2); format0(o3); to_lisp(); (defun $unlambda (olambda) (let* ((obody (cddr olambda)) (oop (caaar obody)) (oargs (cdar obody))) `((,oop simp factored) ,@oargs) )) #$o$ #$o2$ #$o3$ ($unlambda #$o2$) ($unlambda #$o3$) (to-maxima) unlambda(o2); unlambda(o3); format0(unlambda(o3)); And ta-da: the result of format0(unlambda(lambda([], 2+3))); is this, ((MPLUS SIMP FACTORED) 2 3) that looks promising... but Maxima prints the result of unlambda(lambda([], 2+3)); as 3 + 2 instead of the "2 + 3" that I was hoping for. Any comments? Cheers =) =) =), Eduardo Ochs |