Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

From a conic equation obtained from a dot product, I want to plot its 2D graph, while being able to manipulate the variable.

Manipulate[
   K = {Sin[t] Cos[p], Sin[t] Sin[p], Cos[t]};
   oP = {x, y, 1};
   noP = Assuming[Element[{x, y, z}, Reals], Simplify[Norm[oP]]];
   nK = Assuming[Element[{t, p, x, y, z}, Reals], Simplify[Norm[K]]];
   {(K.oP)^2 == (Cos[a]*nK*noP)^2},
   {a, Pi/16, Pi, Pi/16, ControlPlacement -> Left},
   {t, 0, \[Pi], \[Pi]/256, ControlPlacement -> Left},
   {p, 0, \[Pi], \[Pi]/256, ControlPlacement -> Left}
 ]

Mathematica graphics

I do get the correct equation, but I am unable to plot it in any way when I take it separately.

ParametricPlot[ 1 == (1 + x^2 + y^2) Cos[\[Pi]/16]^2, {x, -14, 14}, {y, -14, 14}]

show the axes, but not the graph.

Only when I try with the == function do I get the graph, which is not really useful... What should I change?

share|improve this question
    
You are looking for ContourPlot not ParametricPlot. –  Sjoerd C. de Vries Nov 3 '12 at 22:44
    
By the way, welcome to Mathematica.SE! Please consider registering your account so that any upvotes you get on this question are added to those you might get on future questions and answers. That way, over time you will be able to do more on the site (post graphics, edit things, etc). –  Sjoerd C. de Vries Nov 3 '12 at 22:45
    
or maybe RegionPlot ? –  b.gatessucks Nov 3 '12 at 22:46
    
Thanks! It does work. I'm new with Mathematica and still trying to figure out many things... Could you tell me if there a way also to have both the equation obtained and the graph in the same image? –  Renaud Nov 3 '12 at 22:56
    
See answer below –  Sjoerd C. de Vries Nov 3 '12 at 23:03
add comment

1 Answer

up vote 4 down vote accepted

Using lists you can show more stuff in Manipulate. You could use Column or Row for more pretty formatting.

Manipulate[K = {Sin[t] Cos[p], Sin[t] Sin[p], Cos[t]};
 oP = {x, y, 1};
 noP = Assuming[Element[{x, y, z}, Reals], Simplify[Norm[oP]]];
 nK = Assuming[Element[{t, p, x, y, z}, Reals], Simplify[Norm[K]]];

 Column[
   {
     {(K.oP)^2 == (Cos[a]*nK*noP)^2},
     ContourPlot[(K.oP)^2 == (Cos[a]*nK*noP)^2, {x, -14, 14}, {y, -14, 14}]
   }
  ],

 {a, Pi/16, Pi, Pi/16, ControlPlacement -> Left}, 
 {t, 0, \[Pi], \[Pi]/256, ControlPlacement -> Left}, 
 {p, 0, \[Pi], \[Pi]/256, ControlPlacement -> Left}
]

Mathematica graphics

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.