Message Boards Message Boards

0
|
4431 Views
|
2 Replies
|
1 Total Likes
View groups...
Share
Share this post:
GROUPS:

Need help getting Plot to work on the standard equation for a circle

Posted 11 years ago
f[x_, y_] := x^2 + y^2 == 25

Plot[f[x, y], {x, -20, 20}, {y, -20, 20}, AxesLabel -> {x, y}]

Plot::nonopt: Options expected (instead of {y,-20,20}) beyond position 2 in Plot[f[x,y],{x,-20,20},{y,-20,20},AxesLabel->{x,y}]. An option must be a rule or a list of rules. >>

Ideally, after getting Plot to work, I would like to hand the same function to RevolutionPlot3D to generate a sphere.

Thanks.
POSTED BY: Siamak Shahbazi
2 Replies
Plot would work if you solve for y to make the function depend on just x.
Note that Plot wants single-valued functions, so to get the top and bottom halves the two solutions are both given.

Plot[{Sqrt[25 - x^2], -Sqrt[25 - x^2]}, {x, -20, 20},
AxesLabel -> {x, y},
AspectRatio -> Automatic]
POSTED BY: Bruce Miller
Posted 11 years ago
You need to use ContourPlot to plot curves given in implicit form.
i.e.
ContourPlot[x^2 + y^2 == 25, {x, -20, 20}, {y, -20, 20}, Axes -> True,
  AxesLabel -> {x, y}]
POSTED BY: Luca M
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract