Ask Your Question
0

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

asked 2011-09-26 12:12:19 -0500

Hun gravatar image

updated 2011-09-26 13:56:11 -0500

benjaminfjones gravatar image

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 flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
2

answered 2011-09-26 13:55:48 -0500

benjaminfjones gravatar image

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.

edit flag offensive delete link more

Comments

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

Hun gravatar imageHun ( 2011-09-26 15:52:39 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2011-09-26 12:12:19 -0500

Seen: 125 times

Last updated: Sep 26 '11