# How can I use the results returned by DSolve in further computations?

As a neophyte, I'm trying to manipulate the result of a differential equation but I have no idea how to do so.

Here is the equation:

v'[t] + (k v[t]/m) == g


I know how to find the solution, which is given by:

soln = DSolve[{v'[t] + (k/m) v[t] == g, v[0] == 0}, v[t], t]


But after that I am lost. Can someone tell me what should I do if I want to use the results returned by DSolve in further computations?

• I transcribed the code from your screenshots into your question, please look over it to make sure it's correct. Typically you use soln by using it for a replacement. For example, to find v[t] at t == 6, you'd type v[6] /. soln (/. is a shorthand for ReplaceAll). – eyorble Feb 23 '19 at 0:55
• In what way are you seeking to manipulate the solution? – Edmund Feb 23 '19 at 1:09
• Note the manipulate tag is for questions about the use of the function Manipulate[]. If that's what you have in mind, you should clarify and indicate how you want to use the solution in it. – Michael E2 Feb 23 '19 at 2:07

What exactly you mean by manipulate?

Nevertheless, here are some common examples users ask about further use of DSolve output.

Eq = v'[t] + (k v[t]/m) == g

soln = v[t] /. DSolve[{Eq, v[0] == 0}, v[t], t][[1]]


$$\frac{(E^{(-((k t)/m))} (-1 + E^{((k t)/m))} g m)}{k}$$

The solution is assigned to soln, now you can use it for further manipulations. For example,

Table[{t, soln /. {g -> 9.8, k -> 1, m -> 1}}, {t, 0, 10}]


or

Plot[soln /. {g -> 9.8, k -> 1, m -> 1}, {t, 0, 10}]

• Thanks! I was thinking of something like that but my teacher told me to use Manipulate, probably to vary the value of g,m and k and see what happens. – GalloMathematico Feb 24 '19 at 13:33
• @GalloMathematico OK! But it was not clear from your question. – zhk Feb 24 '19 at 13:34

Here' my standard workflow for a simple ODE exercise:

eqnExample1 =
x'[t] == 6 - (6/1000 x[t]) (*NB x'[t]*)
initValExample1 = x[0] == 0
solExample1 = DSolve[{eqnExample1, {initValExample1}}, x[t], t]
solExample1Function[t_] = solExample1[[1, 1, 2]] (* note = NOT := *)
Plot[{500, solExample1Function[t]}, {t, 0, 200}]
Solve[solExample1Function[t] == 500, t, Reals][[1, 1, 2]] /.
C[1] -> 1 // N
Print["Note the function is concave down so should approach a \
limiting value:"]
Limit[solExample1Function[t], t -> Infinity]


but i'm merely an egg at both mma and ODEs...