0

I am an new user of Mathematica and learning basics so please guide me

I tried to use this code

Animate[Plot[x^2/a^2 - y^2/b^2 == 1, {x, 0, 2}, {y, 0, 2}], 
  {a, 1, 3}, 
  {b, 1, 3}]

but I got this error message:

Plot::nonopt: Options expected (instead of {y,0,2}) beyond position 3 in Plot[x^2/FEa$$116^2-y^2/FEb$$116^2==1,{x,0,2},{y,0,2}]. An option must be a rule or a list of rules. >>

All I want to do is to animate a hyperbole with its asymptotes.

m_goldberg
  • 107,779
  • 16
  • 103
  • 257
Hash
  • 103
  • 3

1 Answers1

3
Animate[ContourPlot[x^2/a^2 - y^2/b^2 == 1, {x, -6, 6}, {y, -6, 6}, 
  PerformanceGoal -> "Quality"], {a, 1, 5}, {b, 1, 5}]

OR

Manipulate[ContourPlot[x^2/a^2 - y^2/b^2 == 1, {x, -6, 6}, {y, -6, 6}, 
  PerformanceGoal -> "Quality"], {a, 1, 5}, {b, 1, 5}]

If you want the plots with the asymptotes, use the following:

Animate[ContourPlot[{x^2/a^2 - y^2/b^2 == 1, a y + b x == 0, 
   a y - b x == 0}, {x, -5, 5}, {y, -5, 5}, PerformanceGoal -> "Quality"], {a, 1, 5}, {b, 1, 5}]

OR

Manipulate[ContourPlot[{x^2/a^2 - y^2/b^2 == 1, a y + b x == 0, 
   a y - b x == 0}, {x, -5, 5}, {y, -5, 5}, PerformanceGoal -> "Quality"], {a, 1, 5}, {b, 1, 5}]
RunnyKine
  • 33,088
  • 3
  • 109
  • 176