Ask Your Question
1

Plotting a line

asked 7 years ago

pmg gravatar image

I have

x,y = var('x y')

f = (2x + 3y == 0)

How do I plot it

plot(f) gives the error:

Traceback (click to the left of this block for traceback) ... ValueError: Variable 'y' not found

And since it complained about y, why didn't it complain about x? Also, where would I find the docs for this question?

And yes, I am a beginner at sage

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
1

answered 7 years ago

tmonteil gravatar image

The plot will work if you provide a function:

sage: x = SR.var('x')
sage: f = -2*x/3
sage: plot(f,-1,1)

In your case, f is an equation, so you need to use implicit_plot as follows:

sage: x,y = SR.var('x y')
sage: f = (2*x + 3*y == 0)
sage: implicit_plot(f,(-1,1),(-1,1))
Preview: (hide)
link

Your Answer

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

Add Answer

Question Tools

1 follower

Stats

Asked: 7 years ago

Seen: 323 times

Last updated: Nov 08 '17