From: Stavros M. <mac...@gm...> - 2025-08-08 00:51:37
|
One trick is to wrap the expression in a lambda, which blocks simplification: lambda([],2+2) => lambda([],2+2) But lambda([],2+2)+lambda([],2+2) => 2*lambda([],2+2) To block that, you can construct unique lambdas: lambda([z23],2+2) + lambda([z24],2+2) doesn't simplify. Then you can write a simple function to remove these lambdas. If this isn't clear, please ask for more info. -s On Thu, Aug 7, 2025, 16:42 Michael Gough <inn...@gm...> wrote: > i need simplification to work on most expressions. I need a way to wrap a > subexpression so it doesn't simplify. I'm thinking of changing the operator > so instead of x+x I would use mikeplus(x,x). I won't define mikeplus, so it > won't simplify, but the tree will still contain the subexpression in some > form. I think that's what I need. > > > On Thu, Aug 7, 2025 at 1:27 PM Barton Willis <wi...@un...> wrote: > >> Setting the option variable 'simp' to false disables simplification; for >> example, >> >> (%i101) simp : false$ >> >> (%i102) xxx : x+x; >> (%o102) x + x >> >> (%i103) xxx - 2*x; >> (%o103) (x + x) - 2 x >> >> (%i104) simp : true$ >> >> (%i105) xxx - 2*x; >> (%o105) 0 >> >> But when simp is false, few things are guaranteed to work. One of the >> few (only?) uses of setting simp to false is to define a simplification >> rule, such as 0^0 = 1. Maybe another legitimate use is an educational or >> math tutorial use. >> >> Users often want to set simp to false, but I think it rarely turns out >> well, and it usually invokes the question: Why do you need to set simp to >> false? Can you explain what you are trying to do? There might be a better >> option than turning off simplification. >> >> ------------------------------ >> *From:* Michael Gough <inn...@gm...> >> *Sent:* Thursday, August 7, 2025 3:05 PM >> *To:* <max...@li...> < >> max...@li...> >> *Subject:* [Maxima-discuss] Stop simplifying a subexpression >> >> Caution: Non-NU Email >> >> 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. >> >> Pkease note that x+x is just an example of a subexpression. >> >> Thanks in advance! >> Mike >> > _______________________________________________ > Maxima-discuss mailing list > Max...@li... > https://lists.sourceforge.net/lists/listinfo/maxima-discuss > |