<span><span lang="en"><span>This function simulates a parabolic shot from the origin and does not take into account the friction of the air.</span></span></span><br><br><span><span lang="en"><span># Script to calculate <span>the most important info</span> about the parabolic<br># shot without friction and in International System of Units</span></span></span><br><span><span lang="en"><span># </span></span></span><span><span lang="en"><span><span lang="en"><span><span>i</span>f you want to use another system of units only change the value</span></span></span></span></span><br><span><span lang="en"><span><span lang="en"><span># of g and the <span>units in the p<span>rints<span> and legends</span></span></span></span></span><br><br># Inputs of the function are:<br># a) initial velocity vo<br># b) shot angle alfa<br><br># Parameter<br># <span>c</span>) gravity acceleration g = 9.81 m/s^2<br><br># The outputs of the function are:<br># T_1: ascending time<br># T_2: descending time<br>#   H: maximum height<br>#   Tt: total time<br>#   L: maximum horizontal range<br><br><br>parabolic &lt;- function(vo, alfa){<br>  <br>    g &lt;- 9.81<br> an &lt;- round((2*pi*alfa)/360,2)<br>  T_1 &lt;- round(vo*sin(an)/g,2)<br>    H &lt;- round((vo^2)*(sin(an)^2)/(2*g),2)<br>  T_2 &lt;- round(vo*sin(an)/g,2)<br>  T_t &lt;- round(2*vo*sin(an)/g,2)<br>    L &lt;- round(vo^2*sin(2*an)/g,2)<br>  <br>  print(&quot;Ascending time&quot;);print(paste(T_1,&quot;s&quot;))<br>  print(&quot;Maximum height&quot;);print(paste(H,&quot;m&quot;))<br>  print(&quot;Descending time&quot;);print(paste(T_2, &quot;s&quot;))<br>  print(&quot;Total time&quot;);print(paste(T_t,&quot;s&quot;))<br>  print(&quot;Max. horizontal range&quot;);print(paste(L,&quot;m&quot;))<br>  <br>  y &lt;- vector()<br>  p &lt;- seq(0.0, round(L), round(L)/100)<br>  <br>  for(i in 0:length(p)){<br>    y[i] &lt;- (tan(an)*p[i])-((g/((2*vo^2)*cos(an)^2))*p[i]^2)<br>   }<br>  <br>  plot(p, y, xlab=&quot;X&quot;, ylab=&quot;Y&quot;, type = &quot;o&quot;, col = &quot;red&quot;, axes=F)<br>  axis(1, at = seq(0,L,L/10),labels=seq(0,L,L/10),<br>       cex.axis=0.7)<br>  axis(2, at = seq(0,H,H/100),labels=seq(0,H,H/100),<br>       cex.axis=0.7)<br>  legend(L/4, H/3, legend = c(paste(&quot;vo =&quot;, vo, &quot;m/s&quot;),<br>                paste(&quot;alfa =&quot;, alfa,&quot;degrees&quot;),<br>                paste(&quot;Ascending time&quot;, paste(T_1,&quot;s&quot;)),<br>                paste(&quot;Maximum height&quot;, paste(H,&quot;m&quot;)),<br>                paste(&quot;Descending time&quot;, paste(T_2, &quot;s&quot;)),<br>                paste(&quot;Total time&quot;, paste(T_t,&quot;s&quot;)),<br>                paste(&quot;Max. horizontal range&quot;, paste(L,&quot;m&quot;))),<br>         cex=0.7, bg = par(&quot;bg&quot;))<br>  title(main = &quot;Parabolic Shot&quot;, sub = &quot;From Origin &amp; Frictionless&quot;)<br><br>}</span></span></span><br><span><span lang="en"><span><br></span></span></span><span><br><span lang="en"><span>We test the function with a shot of 100 m / s of initial velocity and 45 degrees:</span></span></span><br><span><span lang="en"><span></span></span></span><br><span><span lang="en"><span><br>parabolic(100,45)</span></span></span><br><br><div><a href="https://4.bp.blogspot.com/-jLFhBBRq64A/WJD-4hE_8oI/AAAAAAAACv8/hC3B8oHNaVElNX6_ht4F-EoAMPz1UYc_ACLcB/s1600/Parabolic.png"></a></div><span><span lang="en"><span><span lang="en"><span>In a following post we will do the simulation but with the effect of the air friction</span></span>.</span></span></span><br><br><span><span lang="en"><span><span lang="en"><span>If you want to use the function in another system of units, you only have to change the value of the acceleration of gravity g.</span></span> </span></span></span><br><br><span><span lang="en"><span>Get the script in:</span></span></span><br><span><span lang="en"><span><a target="_blank" rel="nofollow" href="https://github.com/pakinja/Data-R-Value/tree/master/Parabolic_Shot_Full">https://github.com/pakinja/Data-R-Value</a> </span></span></span><br><br><br>