Message Boards Message Boards

0
|
3868 Views
|
2 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Plot parabolic equations using modules?

Posted 6 years ago

I am writing Mathematica code on parabolic equations using modules. However, When I input Parabola [3, Pi / 3,3], I am not get the output. What is wrong?

Parabola[v0_, \[Theta]_, time_, options_] := 
 Module[{}, g = -9.8; v0x = v0*Cos[\[Theta]]; v0y = v0*Sin[\[Theta]];
  Vy[z_] := v0y + g*z;
  Sy[t_] := v0y*t + 1/2 g*t^2; Sx[t_] := v0x*t;
  Time = Solve[Vy[z] == 0, z];
  Maxtime = Time[[1, 1, 2]];
  Maxlength = Sx[2 Maxtime];
  Maxheight = Sy[Maxtime];
  Data1 = Table[{Sx[t], Sy[t]}, {t, 0, 2 Maxtime, Maxtime/20}];
  ParabolarPlot = 
   If[time < 2 Maxtime, 
    ListPlot[Data1, options, 
     Prolog -> {PointSize[0.03], Blue, Point[{Sx[time], Sy[time]}]}, 
     PlotStyle -> {GrayLevel[0], PointSize[0.005]}, 
     ImageSize -> {340, 140}, AspectRatio -> 1/3, 
     PlotRange -> {{0, 1.1 Maxlength}, {0, 1.1 Maxheight}}, 
     PlotLabel -> 
      StyleForm[
       "V0=" <> ToString[v0, StandardForm] <> "(m/s), Angle=" <> 
        ToString[TraditionalForm[\[Theta]]] <> "(rad),t=" <> 
        ToString[NumberForm[N[time], 3], StandardForm] <> "(sec)" <> 
        ",Position=" <> 
        ToString[NumberForm[N[{Sx[time], Sy[time]}], 3], 
         StandardForm], FontSize -> 9]], 
    Print["? ????? ??? ???? =" <> 
      ToString[2 Maxtime, TraditionalForm] <> "(sec)??? ???? ??."]]]
Attachments:
POSTED BY: Yoon Young Jin
2 Replies

You have made the options compulsory. Try this way:

Parabola[v0_, \[Theta]_, time_, options___]:=
POSTED BY: Gianluca Gorni
Posted 6 years ago

It is good to modify it as you have told me. Thank you !

POSTED BY: Yoon Young Jin
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract