2
$\begingroup$

I am trying to plot a function $ {\bf x}(t) = r(t)\hat{v} + {\bf b}(t) $, with unit vector $ \hat{v} $ and vector $ {\bf b}(t) $ given in spherical coordinates. For simplicity, assume that $ \hat{v} = (\sin\theta\cos\phi, \sin\theta\sin\phi, \cos\theta) $, and $ {\bf b}(t) = [t, \sin(a+t), \cos(b + at^2)] $, where $ a $ and $ b $ are constants. This is easy to plot, however, I want the angles $ \theta $ and $ \phi $ to satisfy an implicit equation, say, $ \cos\theta + a(\phi + b t)^2 + c = 0 $.

$\endgroup$
  • $\begingroup$ This is kind of confusing. Is $\mathbf x$ a function of both $t$ and $\hat v$? What is the function $a(t)$? Is it different from the constant $a$? Are they both different from the $a$ in your last equation? $\endgroup$ – Rahul Apr 10 '14 at 1:13
  • $\begingroup$ Sorry, that was a typo. It should have said $ r(t) $ instead of $ a(t) $. If it simplifies things, you can plot $ {\bf x}(t) $ as a function of $ \theta $ and $ \phi $ for fixed values of $ t $. $\endgroup$ – James Apr 10 '14 at 1:15
  • $\begingroup$ I guess you could define your desired surface as a 3D contour plot of $f(\theta,\phi,t) = 0$, transformed under the map $(\theta,\phi,t) \mapsto r(t)[\sin\theta\cos\phi,\sin\theta\sin\phi,\cos\theta]+\mathbf b(t)$. Unfortunately I don't know how to apply such a nonlinear transformation to a 3D plot. $\endgroup$ – Rahul Apr 10 '14 at 5:28
2
$\begingroup$

You can use an appropriately defined MeshFunction as per your constraint equation. For every t you should then get a line on the sphere. If you don't want the sphere to be visible you can change the opacity to zero in the relevant option. Here I've chosen the constants a, b, c so that the constraint equation has a solution:

 Manipulate[
 Module[{a = 1, b = -1, c = -2, r, AA, BB, constr, tolerance = 1},
  r[t_] := t;
  AA[θ_, ϕ_] := {Sin[θ] Cos[ϕ], Sin[θ] Sin[ϕ], Cos[θ]};
  BB[t_] := {t, Sin[a + t], Cos[b + a t^2]};
  constr = Function[{θ, ϕ}, Cos[θ] + a (ϕ + b t)^2 + c];
  ParametricPlot3D[r[t] AA[θ, ϕ] + BB[t],
   {θ, 0, 2 π},
   {ϕ, 0, π},
   MeshFunctions -> constr,
   Mesh -> {{0}},
   PlotRange -> {-10, 10},
   MeshStyle -> {Thick, Red},
   PlotStyle -> Opacity[0.7],
   PlotRange -> All]
  ], {t, -5, 5, .5}]

constrained

$\endgroup$
1
$\begingroup$

As you have one constraint equation, your surface $\vec{x}(\theta,\phi,t)$ is in fact parametrized by two parameters only. In this simple case you could solve $$ \cos\theta+a(\phi+bt)^2+c=0 $$ and get $$ \theta=\arccos(-a(\phi+bt)^2-c) $$ Then, by inserting it in $\vec{x}$ you see that $\vec{x}=\vec{x}(\phi,t)$, which can now be readily plotted.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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