Ask Your Question
0

how do i plot a parabola in the x=2 plane?

asked 2020-02-04 23:19:29 +0100

sydneydego gravatar image

updated 2020-02-04 23:42:00 +0100

vdelecroix gravatar image

I apologize, for I am very new to sage. Here is what I input; the error was that y was not defined.

f(x)=x^2
P=implicit_plot3d(lambda x,y,z:x-2,(-2,2),(-2,2),(-2,8))
plot(f)+plot3d(P)
edit retag flag offensive close merge delete

Comments

You can use var('y') to define y as a variable, and similarly for z.

John Palmieri gravatar imageJohn Palmieri ( 2020-02-05 01:28:50 +0100 )edit

2 Answers

Sort by ยป oldest newest most voted
1

answered 2020-02-04 23:46:05 +0100

vdelecroix gravatar image

First of all, P is in itself a graphics object. Writing plot3d(P) does not make much sense.

Secondly, f is a one-variable function so that plot(f) is a 2 dimensional picture (that works). But then the addition plot(f)+plot3d(P) is trying to concatenate a 2-dimensional and a 3-dimensional picture that looks weird.

Now, to draw a curve in 3d you can for example use parametric_plot3d.

edit flag offensive delete link more
1

answered 2020-02-05 02:41:51 +0100

dazedANDconfused gravatar image

To get your plot using the parametric_plot3d command that vdelecroix suggested, you could try:

u = var('u')
parametric_plot3d([2,u,u^2],(u,-2,2))

The result, running in a SageCellServer is shown: image description

edit flag offensive delete link more

Comments

Note that the command var('u') defines u: you should be able to use var('u') rather than u = var('u'). Unfortunately many of the examples in the Sage documentation needlessly use the longer version.

John Palmieri gravatar imageJohn Palmieri ( 2020-02-05 07:47:36 +0100 )edit

Good point. It's a habit I struggle to break.

dazedANDconfused gravatar imagedazedANDconfused ( 2020-02-05 20:11:18 +0100 )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: 2020-02-04 23:19:29 +0100

Seen: 906 times

Last updated: Feb 05 '20