Question: Ease of Manipulating Formulae in Maple


 

I am interested in how easy it is to work with formulae in the Maple language.  For example, you can easily add two equations together with '+'.

 

e1:=x^2+1=2*x;

x^2+1 = 2*x

(1)

e2:=x^3+x=5;

x^3+x = 5

(2)

e1+e2;

x^3+x^2+x+1 = 2*x+5

(3)

 

I was pleased when the following example added (x+1) to both sides of an equation,

 

e3:=x+1;

x+1

(4)

e1+e3;

x^2+x+2 = 3*x+1

(5)

Some other algebraic operations work.

e1-e3;

x^2-x = x-1

(6)

e1*e3;

(x+1)*(x^2+1) = 2*(x+1)*x

(7)

e1/e3;

(x^2+1)/(x+1) = 2*x/(x+1)

(8)

e1^(1/2);

(x^2+1)^(1/2) = 2^(1/2)*x^(1/2)

(9)

 

Build-in functions do not work, though, but there is a simple solution.

exp(e1);

Error, invalid input: exp expects its 1st argument, x, to be of type algebraic, but received x^2+1 = 2*x

 

exp(rhs(e1))=exp(lhs(e1));

exp(2*x) = exp(x^2+1)

(10)

map(exp,e1);

exp(x^2+1) = exp(2*x)

(11)

 

The methods also apply to inequality formulae.  I'm not as pleased about how it does '*' and '/' for inequalities.  You can get more control using rhs and lhs functions.  Here are some examples:  

e4:=x^3<5*(x+1);

x^3 < 5*x+5

(12)

e4+e3;

x^3+x < 6*x+5

(13)

e4-e3;

x^3-x < 4*x+5

(14)

e4*e3;

(x^3 < 5*x+5)*(x+1)

(15)

e4/e3;

(x^3 < 5*x+5)*(1/(x+1))

(16)

eval(%,x=4);

64/5 < 5

(17)

evalb(%);

false

(18)

(16)/x^2;

((x^3 < 5*x+5)*(1/(x+1)))/x^2

(19)

simplify(%);

((x^3 < 5*x+5)*(1/(x+1)))/x^2

(20)

lhs(e4)/e3/x^2 < rhs(e4)/e3/x^2;

x/(x+1) < (5*x+5)/((x+1)*x^2)

(21)

simplify(%);

x/(x+1) < 5/x^2

(22)

 


 

Download equations.mw

Please Wait...