# basic algebra with several variables-why won't it work?

Hi,

I'm trying to use Sage-Notebook as a basic calculator and want to do some basic algebra for two variables. However, it keeps giving me syntax error messages when I type in the below. What am I doing wrong?

x, y = var('x, y') solve([20(6400-x-2y)==0, 80(3200-x-y)==0], x, y)

Traceback (click to the left of this block for traceback) ... SyntaxError: invalid syntax

Thank you!

edit retag close merge delete

Sort by ยป oldest newest most voted

You are using "implicit multiplication" which Sage does not understand by default (you can turn it on if you want). You should change 2y above to 2*y and 80(3200-x-y) to 80*(3200-x-y), etc... Here is code that works:

x, y = var('x, y')
solve([20*(6400-x-2*y)==0, 80*(3200-x-y)==0], x, y)


Sage's output is:

[[x == 0, y == 3200]]


ps. Implicit multiplication can be turned on using: implicit_multiplication(True), see the preparser documentation.

more

Thanks for clearing that up for me :) Now I won't miss it!

( 2011-09-26 22:52:39 +0200 )edit