Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

H* Project 2, Ghadendra Bhandari*L

H* Trajectory of Canonball*L

In[49]:=

ClearAll@"Global`*"D;
Clear@DerivativeD;
Remove@"Global`*"D;
H* SI units assumed *L
g = 9.8;
H* drag coefficient @bD = @Force velocity^2D *L
gamma = 0.25;
d = 0.15;
m = 13.8;
lambda = 10 000;
c = gamma d ^ 2 ;
vter = Sqrt@m g cD;
H* interval of time to produce a numerical solution for *L
Tsol = 15 000;
H* time interval for plotting the solutions HTTsolL *L
T = 35;
v0 = 300;
theta = 50 180 Pi;
vx0 = v0 Cos@thetaD;
vy0 = v0 Sin@thetaD;
H* Differential equation for atmospheric variation*L
eqx = Nx ''@tD == - c Exp@- Ny@tD lambdaD Sqrt@Nx '@tD ^ 2 + Ny '@tD ^ 2D Nx '@tD m;
eqy = Ny ''@tD == - g - c Exp@- Ny@tD lambdaD Sqrt@Nx '@tD ^ 2 + Ny '@tD ^ 2D Ny '@tD m;
sol1 = NDSolve@8eqx, eqy, Nx '@0D == vx0, Ny '@0D == vy0, Nx@0D == 0, Ny@0D == 0<,
8Nx, Ny<, 8t, 0, Tsol<D;

<< PlotLegends`
ParametricPlot@8Evaluate@8Nx@tD, Ny@tD<D . sol1, Evaluate@vx0 t, vy0 t - g t ^ 2 2D,
Evaluate@Nx@TsolD . sol1, - Abs@vy0 t - g t ^ 2 2DD<, 8t, 0, T<,
ImageSize Large, AspectRatio 1, AxesLabel 8"x HmL", "y HmL"<,
PlotLabel SequenceForm@"Cannonball's trajectory during the first ", T, "s"D,
PlotLegend -> 8"Quadratic drag - Atmospheric", "In vacuum",
"max x possible with quadratic drag"<, LegendPosition 81.1, - 0.5<,
LegendSize 81.6, 0.8<, PlotRange 880, 14 000<, 8- 2500, 3000<<D
H*Let's plot the Atmospheric and vertical components
of velocity and see the affect of the drag force*L
Print@"After 30 s the horizontal component of velocity reduces down to ",
Nx '@30D . sol1, " ms"D

Printed by Wolfram Mathematica Student Edition

Project 2.nb

Plot@Nx '@tD . sol1, 8t, 0, T<, ImageSize Large,


AspectRatio 1, AxesLabel 8"t HsL", "vx HmsL"<, PlotLabel
SequenceForm@"Cannonball's x component of velocity during
PlotRange 880, .5 T<, 80, 1.2 vx0<<D
Plot@8Ny '@tD . sol1, - vter<, 8t, 0, T<, ImageSize Large,
AspectRatio 1, AxesLabel 8"t HsL", "vy HmsL"<, PlotLabel
SequenceForm@"Cannonball's y component of velocity during
PlotRange 880, .5 T<, 8- 1.2 vter, 1.2 vy0<<D

the first ", T, "s"D,

the first ", T, "s"D,

Cannonball's trajectory during the first 35s


y HmL
3000

2000

Quadratic drag - Atmospheric


1000
Out[69]=

In vacuum
0
2000

4000

6000

8000

10 000

12 000

x HmL
14 000
max x possible with quadratic drag

-1000

-2000

After 30 s the horizontal component of velocity reduces down to 847.1735< ms

Printed by Wolfram Mathematica Student Edition

Project 2.nb

Cannonball's x component of velocity during the first 35s


vx HmsL

200

150

Out[71]=

100

50

t HsL
5

10

Printed by Wolfram Mathematica Student Edition

15

Project 2.nb

Cannonball's y component of velocity during the first 35s


vy HmsL

200

100

Out[72]=

t HsL

0
5

10

15

-100

Result: 1. The effect of air resistance is to slow the horizontal motion.


2. The canonball reaches its high point sooner than it would in a vacuum.

Printed by Wolfram Mathematica Student Edition

You might also like