Group Abstract Group Abstract

Message Boards Message Boards

0
|
8.6K Views
|
4 Replies
|
1 Total Like
View groups...
Share
Share this post:

[?] Solve a path for the flight of a ball?

Posted 8 years ago

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.

POSTED BY: Puck Planje
4 Replies
Posted 8 years ago

Let's start with

fd[v_] :=-?d*Abs[v]^2*Normalize[v]
fl[v_] := ?l*Abs[v]^2*l
fl[v_] := -m*g*{0, 1}
f[t_] := fd[v]+fd[v]+fd[v]

Do you perhaps mean something more like

fd[v_] :=-?d*Abs[v]^2*Normalize[v]
fl[v_] := ?l*Abs[v]^2*l
fg[v_] := -m*g*{0, 1}
f[t_] := fd[v]+fl[v]+fg[v]

But that definition of f[t] doesn't seem right either. Maybe you mean

f[v_]:=fd[v]+fl[v]+fg[v]

but I'm not sure that is right either.

Next let's look at a[t]

In[20]:= a[t_] := f[t]/m
         a[t]

Out[20]= {0., -9.81}

and that value is unchanged if I try a[0] or a[5] or a[1000].

Next let's look at what you are going to give to DSolve

In[21]:= {D[r, {t, 2}] == a[t], x[0] == 0, y[0] == 0, v[0] == 60}

Out[21]= {0 == {0., -9.81}, x[0] == 0, y[0] == 0, 0[0] == 60}

That doesn't look like a differential equation.

Can you use this to try to fix some problems before you try to give it to DSolve?

POSTED BY: Bill Simpson
Posted 8 years ago

Thank you all for the help! I was finally able to solve the problem. For any future reader who is encountering the same problem I will leave my code below.

ClearGlobal[] := (ClearAll["Global`*"]; Clear[Derivatives];);
ClearGlobal[]

cl := 0.3
m := 0.050
rball := 0.02
cd := 0.3
\[Rho] := 1.225
g := 9.81
v0 := 60

area := Pi*rball^2
\[Alpha]d := (1/2)*\[Rho]*area*cd
\[Alpha]l := (1/2)*\[Rho]*area*cl
\[Theta] := Pi/3

v1 := v0*{Cos[\[Theta]], Sin[\[Theta]]} 
v[t_] := r'[t]

fd[t_] := -\[Alpha]d*Norm[v[t]]^2*Normalize[v[t]]
fl[t_] := \[Alpha]l*Norm[v[t]]^2*RotationMatrix[Pi/2].Normalize[v[t]]
fg[t_] := -m*g*{0, 1}
f[t_] := fd[t]+fl[t]+fg[t]

a[t_] := f[t]/m

sol = NDSolve[{r''[t] == a[t], r[0]=={0,0}, v[0]==v1}, r[t], {t,0,10}];

ParametricPlot[Evaluate[r[t] /. First[%], {t, 0, 10}]]
POSTED BY: Puck Planje

I am not quite sure what exactly you want to do. But notice that "Rotate" does not rotate your vector but produces a Graphics Primitive. So using this you won't get a meaningful equation. See the very end of the notebook attached.

And you define fl[ v_ ] twice. I am sure you meant to give a third function fg for the gravity - term.

I tried DSolve, but that, at least in my version (Mma 7) failed. So I used NDSolve for a numerical integration to obtain the path of the ball.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard
Be respectful. Review our Community Guidelines to understand your role and responsibilities. Community Terms of Use