|
From: Stavros M. <mac...@gm...> - 2025-11-13 15:50:35
|
There are lots of ways to get the result you want manually: *x*multthru(tst/x) *-- Ray's suggestion *multthru *only operates on the top level of the expression, so is more "precise" than *expand* *substpart(multthru(piece),factor(tst),[1,2])* this post-processes the result of *factor* *rembox(factor(substpart(box(piece),tst,1,1)))* this is essentially Fateman's solution, using *box* instead of variable substitution *rembox(factor(substpart(box(piece),tst,1,1,2)))* more narrowly targeted version of the same There's also the *format* subsystem, though I'm not very familiar with it. On Mon, Nov 10, 2025 at 10:31 AM Richard Fateman <fa...@gm...> wrote: > I agree with Ray on this. Note that > factor operates on the rational form of tst, and > rat(tst) produces > > (x*%e^cos(x+1)+x)/%e^cos(x+1) > > in essence, the exp(-cos(x+1)) is "simplified" to 1/ exp(cos(x+1)) > before factoring. > > If the user wants exp(-cos(x+1)) to be treated as a single unit, then use > a symbol, > like emcosxp1 for manipulation, at least until such time as some > property > related to x or cos ... is needed. > > factor( x* emcosxp1+x) produces what you might expect. > > RJF > > > On Mon, Nov 10, 2025 at 9:02 AM Raymond Toy <toy...@gm...> wrote: > >> >> On 11/10/25 1:35 AM, Gunter Königsmann via Maxima-discuss wrote: >> >> Dear all, >> >> A colleague of mine has asked me how to factor out the x in >> >> tst:x*exp(-cos(x+1))+x; >> >> factor(tst) factorizes the exp() function, as well, which doesn't meet my >> colleague's idea of "simple". >> >> He wants the result to be `x*(1+exp(-cos(x+1))`? >> >> I thought maybe `factorout` would do this, but it doesn't. >> >> I've generally given up on finding ways to make Maxima produce the form I >> want and just accept what Maxima produces. If I really, really want a >> certain form, I just do it by hand. In this case, do `x*expand(tst/x)`. >> Sometimes it's just easier to do by hand instead of spending minutes or >> hours trying to figure out how to get Maxima to do it. Especially if it's >> just a one-time change. >> >> >> _______________________________________________ >> Maxima-discuss mailing list >> Max...@li... >> https://lists.sourceforge.net/lists/listinfo/maxima-discuss >> > _______________________________________________ > Maxima-discuss mailing list > Max...@li... > https://lists.sourceforge.net/lists/listinfo/maxima-discuss > |