title: Terminal Velocity using Differential Equation
body: <p>I am new to Juia lang and trying to solve the following differential equations to find the terminal velocity of a ball using Julia.</p>
  
  <p><strong>F = - m * g - 1/2 rho * v² Cd * A</strong></p>
  
  <p>This is the code that I wrote:</p>
  
  <pre><code># Termal velocity of a falling ball
  
  using DifferentialEquations
  using Plots
  
  g  = 9.8                # Accelaration of gravity
  p  = 1.2                # Density of air
  m  = 0.100              # A 100 g ball
  r  = 0.10               # 10 cm radius
  Cd = 0.5                # Drag coeficient for a small spherical object
  y0 = 1000.0             # Initial height of the body (1000 m)
  v0 = 10.0               # Initial velocity of the body (10 m/s^2, going up)
  A  = pi*r^2;            # Cross-section area of the body;
  
  u0 = [v0;y0]            # Initial Conditions
  tspan = (0.0,5.0)       # Time span to solve for
  p = [g;p;m;Cd;A]
  
  function Terminal_Velocity(du,u,p,t)
   du[1] = u[1]                                                      # velocity 
   du[2] = -1.0 * p[1] - 0.5 * (p[2]/p[3]) * (u[1]^2) * p[4] * p[5]  # acceleration
  end
  
  
  
  prob = ODEProblem(Terminal_Velocity,u0,tspan,p)
  sol = solve(prob)
  
  plot(sol,vars=(0,1)) 
  </code></pre>
  
  <p>I think the Problem is that I am giving y0 as the initial condition for the acceleration and not for the height. But I can do not understand the Syntax well enough yet. </p>
  
  <p>My starting point was this article : <a href="https://nbviewer.jupyter.org/github/JuliaLang/ODE.jl/blob/master/examples/Terminal_Velocity.ipynb" rel="nofollow noreferrer">https://nbviewer.jupyter.org/github/JuliaLang/ODE.jl/blob/master/examples/Terminal_Velocity.ipynb</a></p>
  
  <p>Thanks for your help in advance.</p>