0
$\begingroup$

I have the vector V = {2, y z^2, 3 y + z}

I wanted to get a 3d parametric plot of V using: x[t] = Sin[t^2]; y[t] = t^2 - Cos[t]; z[t] = Sinh[t] - Cos[t]. So I did:

ParametricPlot3D[{2 x, y z^2, 3 y + z}, {t, 0, 2 Pi}, PlotStyle -> Thick, AxesLabel -> {"x", "y", "z"}]

I am unsure what to take for the fx argument inside ParametricPlot3d as x=2 inside V. I decided to go for what I did as shown above. And I do not get a graph at all.

$\endgroup$
4
  • $\begingroup$ use Evaluate@{2 x[t], y[t] z[t]^2, 3 y[t] + z[t]} instead of {2 x, y z^2, 3 y + z}? $\endgroup$
    – kglr
    Commented Aug 30, 2020 at 13:49
  • $\begingroup$ As ParametricPlot3D[ { fx, fy, fz},{u,umin,umax} ] takes this general form, can you tell me if by taking 2x for fx I did the right thing? Or should I have left it as 2 inside ParametricPlot3D? I also used Evaluate inside PP3D but plot is still empty. $\endgroup$
    – Kurapika
    Commented Aug 30, 2020 at 13:54
  • $\begingroup$ Block[{x = Sin[t^2], y = t^2 - Cos[t], z = Sinh[t] - Cos[t], V = {2 x, y z^2, 3 y + z}}, ParametricPlot3D[V, {t, 0, 2 Pi}, PlotStyle -> Thick, AxesLabel -> {"x", "y", "z"}]] $\endgroup$
    – cvgmt
    Commented Aug 30, 2020 at 13:58
  • $\begingroup$ Btw one thing I am confused about is if the x-variable is a constant like 2 here inside V where V = {2, y z^2, 3 y + z} then does it affect ParametricPlot3D or do i have to always parameterize any constant for plotting in this regard? $\endgroup$
    – Kurapika
    Commented Aug 30, 2020 at 14:30

2 Answers 2

0
$\begingroup$

Since your function V[t] uses x[t],y[t],z[t] (okay x is not used but anyways) I would define them first using this code:

x[t_] = Sin[t^2];
y[t_] = t^2 - Cos[t];
z[t_] = Sinh[t] - Cos[t]; 

Now you can define V[t] itself

V[t_] = {2, y[t]*z[t]^2, 3*y[t] + z[t]};

We can now use ParametricPlot3D :

ParametricPlot3D[
   V[t], 
   {t, 0, 2 Pi}, 
   PlotStyle -> Thick, 
   AxesLabel -> {"x", "y", "z"},
   PlotRange -> {{-Pi, Pi}, {-Pi, Pi}, {-Pi, Pi}}
]

Now you will get plot which looks quite awkward because Mathematica chooses the plotRange on its own so I added PlotRange to make a more pleasing looking plot:

enter image description here

You might need to adjust the values in the PlotRange to your desire.

$\endgroup$
1
  • $\begingroup$ Yes, it worked, was my plot command then not working because I did not define the functions? That's the difference I am seeing. Another thing I want to ask is that if I want to calculate the divergence of this vector V[t] then would Div[V[t], {x[t], y[t], z[t]}] work although this just returns me the divergence*V - not any actual expression or value. Is it possible or should the original V expression V = {2, y z^2, 3 y + z} be only evaluated for divergence? $\endgroup$
    – Kurapika
    Commented Aug 30, 2020 at 16:46
0
$\begingroup$
Clear["Global`*"]

x[t] = Sin[t^2]; y[t] = t^2 - Cos[t]; z[t] = Sinh[t] - Cos[t];

The functions must include their arguments and since the functions are literally only defined for the symbol t you must Evaluate them prior to t being assigned any numeric values.

ParametricPlot3D[Evaluate@{2 x[t], y[t] z[t]^2, 3 y[t] + z[t]},
 {t, 0, 2 Pi},
 PlotStyle -> Thick,
 AxesLabel -> {"x", "y", "z"},
 BoxRatios -> {1, 1, 1}]

enter image description here

The usual way to define functions is with a pattern as the argument

Clear["Global`*"]

x[t_] = Sin[t^2]; y[t_] = t^2 - Cos[t]; z[t_] = Sinh[t] - Cos[t];

In this case the Evaluate is not needed.

ParametricPlot3D[
 {2 x[t], y[t] z[t]^2, 3 y[t] + z[t]}, {t, 0, 2 Pi},
 PlotStyle -> Thick,
 AxesLabel -> {"x", "y", "z"},
 BoxRatios -> {1, 1, 1}]

< same image >

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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