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.
AddSides(eq1,ans(-1)) // 2*x=8 Add the result to the first equation.
DivideSides(ans(-1),2) // x=4 Divide both sides by 2 to solve for x.
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.