## New functions AddSides(), SubtractSides(), MultiplySides() and DivideSides()

Messages in english

compsystems
Messages : 534
Inscription : sam. févr. 04, 2017 11:34 pm
Localisation : Colombia
Contact :

### New functions AddSides(), SubtractSides(), MultiplySides() and DivideSides()

The purpose I give Xcas is to teach algebra, but not to do scientific calculations.

Introductory algebra courses cover how to solve linear equations using basic algebra to isolate terms.
with new functions like AddSides (), SubtractSides (), MultiplySides () and DivideSides () allow these basic operations to be applied in a functional way, this makes the student write a script that thinks about procedures, but not operators or math symbols. The following illustrates this by solving the system of equations.

(future version of XCAS)

Code : Tout sélectionner

``````eq1:=2*x+3*y=5; eq2:=x-y=5

MultiplySides(eq2,2) // 2*(x-y)=10 Multiply both sides of the second equation by 2

simplify(ans(-1)) // 2*x-2*y=10

SubtractSides(eq1,ans(-1)) // 5*y=-5 Subtract the result from the first equation.

DivideSides(ans(-1),5) // y=-1 Divide both sides by 5 to solve for y

MultiplySides(ans(-1),-3) // -3*y=3 Multiply both sides of the previous result by negative 3.

DivideSides(ans(-1),2) // x=4 Divide both sides by 2 to solve for x.``````
Current

Code : Tout sélectionner

``````eq1:=2*x+3*y=5; eq2:=x-y=5

eq2*2 // 2*(x-y)=10 Multiply both sides of the second equation by 2

simplify(ans(-1)) // 2*x-2*y=10

eq1-ans(-1) // 5*y=-5 Subtract the result from the first equation.

ans(-1)/5 // y=-1 Divide both sides by 5 to solve for y

ans(-1)*-3 // -3*y=3 Multiply both sides of the previous result by negative 3.

eq1+ans(-1) // 2*x=8 Add the result to the first equation.

ans(-1)/2 // x=4 Divide both sides by 2 to solve for x.``````
Source: https://www.wolfram.com/language/12/alg ... athematica

belanger
Messages : 52
Inscription : jeu. juil. 27, 2017 3:26 pm

### Re: New functions AddSides(), SubtractSides(), MultiplySides() and DivideSides()

These functions seem necessary on Mathematica, but not so much on Xcas.
If you add or multiply an equation by a number in Mathematica, then you get an equation
plus or times a number; it doesn't seem to get applied to each side separately.
eqn = 2*x + 3*y == 5
eqn + 3
returns
(2*x + 3*y == 5) + 3

AddSides, etc., in Mathematica is needed to do what Xcas already does when it adds a number to an equation.
I suppose the advantage to having these commands in Xcas would be the names, so student would explicitly note that they
operating on both sides of an equation.

Jay

compsystems
Messages : 534
Inscription : sam. févr. 04, 2017 11:34 pm
Localisation : Colombia
Contact :

### Re: New functions AddSides(), SubtractSides(), MultiplySides(), DivideSides() and ApplySides()

belanger a écrit :
sam. déc. 14, 2019 9:31 pm
I suppose the advantage to having these commands in Xcas would be the names, so student would explicitly note that they
operating on both sides of an equation.
Yes, a part of algebraic manipulation is balancing on both sides of the expression.

The following script emulates the commands of the following link

Code : Tout sélectionner

``````autosimplify(1)

ineq1:=a*x+b>0 // Manipulating inequalities is considerably more complex than equations, because multiplication and division may reverse the sense of the inequality. MultiplySides and DivideSides automatically handle this complexity.

ineq1-b // (a*x+b-b)>(-b) Subtract b from both sides.

// Divide both sides by a. Since the result depends on the sign of a
assume(a>0)
simplify(ans(-1)) // x>(-b/a)

assume(a<0)
simplify(ans(-1)) // (-b/a)>x

// If an equation as d+c*x=0 is added to an inequality as (a*x+b)>0, the result is an inequality
ineq1+(d+c*x=0) // (d+c*x+a*x+b)>0
simplify(ans(-1)) // (a*x+b+c*x+d)>0

// The equation manipulation functions reorder the sides of an inequality when necessary to combine them.
ineq1+(d+c*x<0) // (a*x+b)>(d+c*x)``````
Source: https://www.wolfram.com/language/12/alg ... athematica

Another important functional command is ApplySides()
ApplySides("exp", Log(x)= 2) // x=exp(2)

https://reference.wolfram.com/language/ ... Sides.html

parisse
Messages : 5336
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

### Re: New functions AddSides(), SubtractSides(), MultiplySides() and DivideSides()

These functionnalities already exist in Xcas, with a more natural notation for + - * /. subst does not solve the equation, but it's better for step by step operations. Therefore, I don't see why I should add new commandnames, perhaps you asked because you did not know about + - * / on equation feature.
By the way, I don't plan to add Mathematica compatibility for several reasons, the main being that it would require too much time.