First time here? Check out the FAQ!

Ask Your Question
1

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

asked 13 years ago

Hun gravatar image

updated 13 years ago

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!

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
2

answered 13 years ago

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.

Preview: (hide)
link

Comments

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

Hun gravatar imageHun ( 13 years ago )

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: 13 years ago

Seen: 423 times

Last updated: Sep 26 '11