Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

simplifying formulas in maxima

Tags:

maxima

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.

  1. 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.

  1. 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
like image 396
Arthur Avatar asked Apr 18 '14 15:04

Arthur


People also ask

What is the command used to clear all the variables in Maxima?

If the value of a variable is removed with the commands kill , remove , or remvalue the variable is deleted from values .

What does Radcan mean?

The algorithm which is called RADCAN, an acronym for RADical CANonical simplifier, was implemented by Fateman [Mat 75] and was initially available in 1970.

Why do we use dollar in Maxima?

An alternative input terminator to the semicolon (;) is the dollar sign ($), which, however, suppresses the display of Maxima's computation. This is useful if you are computing some long intermediate result, and you don't want to waste time having it displayed on the screen.


1 Answers

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)
like image 162
Robert Dodier Avatar answered Sep 27 '22 22:09

Robert Dodier