simplifying formulas in maxima

maxima

Solution

Well, you can define simplification rules via `tellsimp` (and `tellsimpafter`, `defrule`, and `defmatch`). Maybe this is enough to get started.

(%i3) infix ("=~") $
(%i4) matchdeclare ([aa, bb, cc], all) $
(%i5) tellsimp ((aa =~ bb) * cc, (aa * cc) =~ (bb * cc)) $
tellsimp: warning: rule will treat '?mtimes' as noncommutative and nonassociative.
(%i6) tellsimp ((aa =~ bb) + cc, (aa + cc) =~ (bb + cc)) $
tellsimp: warning: rule will treat '?mplus' as noncommutative and nonassociative.
(%i7) (2*x + 3) =~ (u + v);
(%o7) (2*x+3) =~ (v+u)
(%i8) (% - 3)/2;
(%o8) x =~ ((v+u-3)/2)

Problem

I'm using maxima software to help me simplify formulas. Usually, I can manage easily with subst, ratsubst, factor, ratsimp, ... But there are still are few formulas I find hard to simplify the way I'd like to. assuming that a > b and c > d, I'd like to simplify fractions starting with a - sign this way : ``` -(a - b)/(d - c) -> ( a - b )/( c - d) ``` but I don't how to do it. It seems that maxima simplifier algorithm will try to sort variables in its own way. I created my own maxima function to try to simplify these useless minus signs. ``` no_minus(fraction):= block([simp:true, numerat:expand(-ratnumer(fraction)), denominat:expand(-ratdenom(fraction))], block([simp:false], numerat/denominat)); -a/(b-x); no_minus(-a/(b-x)); no_minus(-a*b*c/(b-x*b*f-f)); ``` I'd expected no_minus(-a/(b-x)) would have returned a/(x-b) but it didn't. I'd like to introduce a new infix operator to denote that two expressions are approximately equal. For instance, if x is approximately equal to y. I'd like to note it ``` x =~ y infix("=~"). ``` How to configure the simplifier so that when the input is ``` 2*x+3 =~ u+v; (%-3)/2; ``` the output is ``` x =~ (u+v-3)/2 ```

Original source