3
$\begingroup$

I'm new (I started today) to Mathematica so

  1. Please forgive me if my code is inefficient/godawful and
  2. I realize my question has already sort of been asked (combining manipulate with "static" plot), but I can not make heads or tails of the answer provided to that question, as I am obviously not really familiar with Mathematica whatsoever, so here I go.

I am basically trying to use Superimpose a unit tanjent vector (tanjent vector being manipulated) onto a static 3D parametric plot, and I am not sure how to do so. When I attempted to use Show with the Manipulate graphic as one argument and the ParametricPlot3D as another argument it does not display them together and says "Could not display the two graphics together".

My Parametric equation is:

curve[u_] := {Cos[u]*u^.5, Sin[u]*u^.5, u*Sin[u]^2}

And the Parametric plot I attempt to Show it as with my manipulate graphic is:

ParametricPlot3D[curve[u], {u, 0, 20}]

My Manipulate graphic code is:

Manipulate[
Graphics3D[{Green, 
Arrow[{{Cos[a]*a^.5, Sin[a]*a^.5, 
  a*Sin[a]^2}, {Cos[a]*a^.5 + xPrime[a]/lengthOf[a], 
  Sin[a]*a^.5 + yPrime[a]/lengthOf[a], 
  a*Sin[a]^2 + zPrime[a]/lengthOf[a]}}]}, Axes -> True, 
PlotRange -> {{-4, 4}, {-4, 4}, {0, 20}}], {a, 0, 20}]

And the background code for Manipulate is:

xPrime[u_] := -(u^.5)*Sin[u] + .5*(u^-.5)*Cos[u]
yPrime[u_] := (u^.5)*Cos[u] + .5*(u^-.5)*Sin[u]
zPrime[u_] := 2*u*Sin[u]*Cos[u] + Sin[u]^2
lengthOf[u_] := ((xPrime[u])^2 + (yPrime[u])^2 + (zPrime[u])^2)^.5

It would be very helpful if someone could explain how to superimpose the two graphics, as I'll probably be doing more of this. Thank you in advance.

$\endgroup$
  • $\begingroup$ Welcome to Mathematica.SE! 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour and check the faqs! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! $\endgroup$ – user9660 Nov 26 '16 at 6:08
2
$\begingroup$

A problem is the fact that $a=0$ is not an acceptable value for $a$, as it leads to division by zero; for your purposes, any value very close to zero, but not zero, will do. Secondarily, it seems easiest to nest your Show expression inside the Manipulate.

Using your definitions:

Manipulate[
 Show[
   ParametricPlot3D[curve[u], {u, 0, 20}],
   Graphics3D[{Green, 
     Arrow[{{Cos[a]*a^.5, Sin[a]*a^.5, 
        a*Sin[a]^2}, {Cos[a]*a^.5 + xPrime[a]/lengthOf[a], 
        Sin[a]*a^.5 + yPrime[a]/lengthOf[a], 
        a*Sin[a]^2 + zPrime[a]/lengthOf[a]}}]
     }, Axes -> True, PlotRange -> {{-4, 4}, {-4, 4}, {0, 20}}
   ]
 ],
 {a, 0.01, 20}
]

Imgur

$\endgroup$
  • $\begingroup$ That seems to solve my problem perfectly, thank you very much MarcoB, and thank you for the welcome Louis. $\endgroup$ – TMathematica Nov 26 '16 at 17:48

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.