This worksheet describes the trajectories of a particle subject to gravity and also an air drag proportional to the square of the velocity, and in the contrary direction.
The calculations below will use the input constants, g, b, v0, which should have their numerical values entered later on in the calculations, after the formulae have already been created:
> alias(v=v(t));
> difeq:=diff(v,t)+g+b*v*abs(v);
> dsolve(difeq,v);
> alpha:=sqrt(g*b);
Recast this tells me that v may be rewritten as
follows, where it is more convenient to refer to it with a new symbol.
Therefore, I call it ww=ww(t), and use v0 to replace the role of the
constant of integration, _C1, so that delta will be defined in terms of
v0=(alpha/b)*tan(alpha*delta),
where alpha is used to denote
the sqrt(g*b).
>
ww:=t->if t<0 then I else if t<=delta then (alpha/b)*tan(alpha*(delta-t)) else (alpha/b)*tanh(alpha*(delta-t)) fi fi;
>
;
>
delta:=(1/alpha)*arctan(b*v0/alpha);
I then also want the displacement, where I start so
that x begins at x0 = 0.
>
xx:=t->if t<=delta then -(1/b)*ln((cos(alpha*delta)/cos(alpha*(delta-t)))) else -(1/b)*ln((cos(alpha*delta)*cosh(alpha*(t-delta)))) fi;
We also set out the no-drag options, i.e., the
situation where there is only gravity acting:
>
wno:=t->v0-g*t; xno:=t->v0*t-(g/2)*t^2;
Finally we can input the desired numerical values
for the parameters:
>
g:=9.8; b:=1/40;v0:=20;
>
plot([ww,wno],0..6,title=`velocity versus time`,labels=[t,vel]);
>
plot([xx,xno],0..5,title=`height versus time`,labels=[t,h]);