# I need help solving an ODE for a range

I've got an ODE which gives me the proper form of a solution:

ode = 0 == -(c + A*t)^2 + D[r[t], t]^2;
sol = DSolve[{ode}, r[t], t]


The solution is:

{{r[t] -> (-c)*t - (A*t^2)/2 + C[1]}, {r[t] -> c*t + (A*t^2)/2 + C[1]}}


However, I need a solution for a definite integral rather than the indefinite form. e.g.:

c*(t0 - t1)*(A*(t0 + t1))/2


The Mathematica help describes a form of DSolve that has a range argument, but I can't seem to get it to work:

sol = DSolve[{ode}, r[t], {t, t0, t1}]


DSolve::alliv: The function r[t] was specified without dependence on all the independent variables. Each function must depend on all the independent variables.

What am I doing wrong? How do I get DSolve to give me the definite integral solution?

ode = 0 == -(c + A*t)^2 + D[r[t], t]^2;
sol = DSolve[{ode}, r, t]

(r[t1] - r[t0] /. sol[[1]])

(*   c t0 + (A t0^2)/2 - c t1 - (A t1^2)/2   *)


This is the same as

sol2 = Solve[ode, r'[t]]

Integrate[r'[t] /. sol2[[1]], {t, t0, t1}]

(*   c t0 + (A t0^2)/2 - c t1 - (A t1^2)/2   *)

Integrate[r'[t], {t, t0, t1}]

(*   -r[t0] + r[t1]   *)


Do the same for the second solution.

• Thank you. That does it. If it's not too much to ask: how do you remove the constant of integration? I know that r[0]=0 and r'[0]=0, but I can't seem to get the syntax right for DSolve. Commented May 6, 2020 at 13:18
• you can do Solve[(r[0] /. sol) == 0, C[1]]  which yields C[1]->0 or directly sol11 = DSolve[{ode, r[0] == 0}, r, t]  . But if you want r'[0]==0, (r'[0] /. sol)  yields {-c, c}  that means the c has to be zero. Commented May 6, 2020 at 13:25
• I thought I could use r[0]==0 also, but I keep getting DSolve::deqn: Equation or list of equations expected instead of True in the first argument {0==-(c+A t)^2+(r^\[Prime])[t]^2,True} That's the exact same trouble I'm having with the syntax. Commented May 6, 2020 at 13:28
• Having a diff equation of first order, you get only one constant of integration, since you integrate only once. That means, you can only impose the one condition r[0]==0 that is one order lower than the order of diff equation. Commented May 6, 2020 at 13:33