first post here :)
So i have a problem to solve projectile motion with drag when drag is linear and quadratic
This is my first take
m x''[t] == -k x'[t]
m y''[t] == -m g - k y'[t]
Movement =
DSolve[{m x''[t] == -k x'[t], m y''[t] == -m g - k y'[t], x[0] == 0,
y[0] == 0, x'[0] == Vo Cos[\[Alpha]],
y'[0] == Vo Sin[\[Alpha]]}, {x[t], y[t]}, t]
Data = {m -> 1, Vo -> 20, g -> 9.81, k -> 0.5, \[Alpha] -> \[Pi]/6,
tt -> 2}
ParametricPlot[{x[t] /.Movement, y[t] /. Movement} /. Data, {t, 0,
tt /. Data}]
It gives a nice graph but im not sure if i made the right assumption for drag-that i can just put it like x'[t] and y[t] in the x and y axis .
This is my second take with
v=sqrt[x1'[t]^2 +y1'[t]^2]
m x1''[t] == -k Sqrt[x1'[t]^2 + y1'[t]^2]
m y1''[t] == -m g - k Sqrt[x1'[t]^2 + y1'[t]^2]
Data2 = {m -> .1, Vo -> 10, g -> 9.81,
k -> 0.001, \[Alpha] -> \[Pi]/6, ttt -> 2}
Movement2 =
NDSolve[{m x1''[t] == -k Sqrt[x1'[t]^2 + y1'[t]^2],
m y1''[t] == -m g - k Sqrt[x1'[t]^2 + y1'[t]^2], x1[0] == 0,
y1[0] == 0, x1'[0] == Vo Cos[\[Alpha]],
y1'[0] == Vo Sin[\[Alpha]]} /. Data2, {x1, y1}, {t, 0, 100}]
Plot[{x1[t] /. Movement2, y1[t] /. Movement2}, {t, 0, 2}]
This gives me a solution but when i plot it i dont know what am i reading. How do i combine the solution from NDSolve (x and y ) to get a single line trajectory.(tried parametric plot,didnt work) Also witch one of these 2 takes is right ?
Edit:Fixed and found the solution for linear drag,now when i enter for quadratig im getting trouble with singularity in NDSolve .
Data = {m -> 1, Vo -> 20, g -> 9.81, k -> 0.5, \[Alpha] -> \[Pi]/6,
tt -> 2}
Movement3 =
NDSolve[{m x1''[t] == -k x1'[t]^2, m y1''[t] == -m g - k y1'[t]^2,
x1[0] == 0, y1[0] == 0, x1'[0] == Vo Cos[\[Alpha]],
y1'[0] == Vo Sin[\[Alpha]]} /. Data, {x1, y1}, {t, 0, 100},
Method -> {"ExplicitRungeKutta", "DifferenceOrder" -> 4},
WorkingPrecision -> 50, AccuracyGoal -> 15, PrecisionGoal -> 15,
MaxSteps -> 20000]
gr2 = ParametricPlot[{x1[t], y1[t]} /. Movement2, {t, 0, 1}]
I keep getting a singularity that changes as i change the paramateres.Can i fix this somehow? At around 1.217 it hits the ground but when i go beyond that (lets say {t,0,2}) the graph goes bonkers.
And when i try DSolve i get a nicer solution but i have imaginary numbers,how do i plot this solution?
Movement3 =
DSolve[{m x1''[t] == -k x1'[t]^2, m y1''[t] == -m g - k y1'[t]^2,
x1[0] == 0, y1[0] == 0, x1'[0] == Vo Cos[\[Alpha]],
y1'[0] == Vo Sin[\[Alpha]]}, {y1[t], x1[t]}, t]
ParametricPlot[{x1[t], y1[t]} /. Movement2, {t, 0, 2}]
$\endgroup$k
. Why you expect that the two output should be the same ? $\endgroup$