# What is wrong in my set of differential equations of a projectile throw?

I aim for using these differential equations to get y[t],x[t] and max range of projectile. I don't know if my physics is wrong or the code is wrong

  DSolve[
{
y' == v0*Sin[a],
y == 0,
m*y''[t] == -m*g,
m*x''[t] == 0,
x == 0,
x' = v0*Cos[a]
},
{x, y}, {t, 0, 20}]


You had a syntax error. It should be == and not =. It is also better to break things out and write the ODEs on separate lines, and the ICs on separate lines, than to combine them - much easier to read and maintain. And since you are using DSolve, there is no need to fix the time span:

ClearAll[x,y,t,a,m,v0]

ode  = { m*y''[t] == -m*g,
m*x''[t] == 0 }

ic   = {y' == v0*Sin[a],
y  == 0,
x  == 0,
x' == v0*Cos[a]}

DSolve[ {ode, ic },  {x[t],y[t]},  t] If you had done the above, you would have more easily spotted the syntax error also.

• and a max range of projectile: Maximize[{1/2 (-g t^2 + 2 t v0 Sin[a]), Sin[a] > 0, v0 > 0, g > 0, t > 0}, t] Dec 21 '17 at 15:28
• @MariuszIwaniuk I dont understand the output. Wouldn't finding y==0 be better? Dec 21 '17 at 15:37
• @Ralnor. Sure yes.:) Dec 21 '17 at 15:46