Hello all,
I've run into a problem while I was trying to solve a path for the flight of a ball with lift force and drag. Sadly, even after searching the forums and reading the most common beginner mistakes post I still haven't found the issue. I fear it has to do with my defining of functions and use of DSolve, but I find the issue. Here is my code:
ClearGlobal[] := (ClearAll["Global`*"]; Clear[Derivative];);
ClearGlobal[]
(* First I start off by defining a few initial values. I hope the correct way to define these is with the ":=". *)
cl := 0.3
m := 0.050
rball := 0.02
g := 9.81
vi := 60
cd := 0.3
\[Rho] := 1.225
g := 9.81
(* Here are some numerical calculations that have to be done. Again, I think the ":=" Is needed. *)
area := Pi*rball^2
\[Alpha]d := (1/2)*\[Rho]*area*cd
\[Alpha]l := (1/2)*\[Rho]*area*cl
(* Here I define the position of the ball as 'r'. It's position as the time-derivative of r.
And finally a vector that is dependant on v's direction in order to orient the lifting force due to spindrift.
*)
r[x_, y_] := {x, y}
v := D[r, t]
l := Normalize[Rotate[v, Pi/2]]
(* Here are the supplied equations for the problem. The drag and lift forces are proportional to a constant and the velocity, with a direction given by l and normalizing v. *)
fd[v_] :=-\[Alpha]d*Abs[v]^2*Normalize[v]
fl[v_] := \[Alpha]l*Abs[v]^2*l
fl[v_] := -m*g*{0, 1}
(* This is the total force on the ball in flight. *)
f[t_] := fd[v]+fd[v]+fd[v]
(* This is a fuction for the acceleration, which i want to solve using the acceleration given by taking the second derivative of r. *)
a[t_] := f[t]/m
(* Here I try to solve for x and y using these initial values. *)
DSolve[{D[r, {t, 2}] == a[t], x[0]==0, y[0]==0, v[0]==60}, x[t], {t,0,10}]
(* And now, as you can see it doesn't recognize the functions, but just outputs that it is true. I'm quite sure there is a problem with my defining of functions or the setup of my Dsolve. *)
Any help for this newbie would be greatly appreciated, as I couldn't find it myself.