# NDSolve How do I insert another boundry condition

So I'm new to programming and I am trying to solve a very simple differential equation (i can do this by hand but the thing is i can't program it), the equation is a'[t] == - 0.0118, with the boundary conditions a==3 and I want to know a=?, how do I insert this (a=?) into the code, this is my short code.

Sol = NDSolve[{a'[t] == -0.0118 , a == 3 }, a, {t, 0, 180}]
Plot[Sol, {t, 0, 180}]


It doesn't show anything in the plot

Thanks a lot, any type of help will be appreciated

## 1 Answer

You are practically there already. Observe that you are plotting the solution in the way you wrote the code. What you actually want to do, is to plot the function a[t] evaluated on the solution of the NDSolve

So, we have

Sol = NDSolve[{a'[t] == -0.0118, a == 3}, a, {t, 0, 180}]
Plot[a[t] /. Sol, {t, 0, 180}]


This is the main thing that you want to notice: a[t] /. Sol

By that logic you can use

a[t] /. Sol /. t -> 180


to read the value at the point you want.

• Thank you so much, but what does /. mean? – Sosa Feb 22 at 22:14
• Hi, it is the way to tell mathematica to apply a rule or a list o rules on an expression. You can find more details here mathematica.stackexchange.com/questions/113306/… or you can just evaluate ?/. in a mathematica notebook to learn more – DiSp0sablE_H3r0 Feb 23 at 7:30
• @Sosa, whenever you encounter a mysterious symbol in Mathematica code, highlight it in the notebook you are using, and press F1. – J. M.'s ennui Feb 25 at 6:36