Message Boards Message Boards

Plot parabolic equations using modules?

GROUPS:

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
Answer
1 month ago

You have made the options compulsory. Try this way:

Parabola[v0_, \[Theta]_, time_, options___]:=
POSTED BY: Gianluca Gorni
Answer
1 month ago

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

POSTED BY: Yoon Young Jin
Answer
1 month ago

Group Abstract Group Abstract