0
$\begingroup$

I want to find the solution $y_0(t)$ of the linear first-order ordinary differential equation

$$y'-(1/t)y= t \text{sin}(t)$$

satisfying the initial condition $y(\pi /2)=0$. I know how to do this analytically using the integrating factor and such, but how do I solve for this numerically (and what exactly does that mean anyway)?

Thanks for any input.

$\endgroup$
  • $\begingroup$ numerically means picking a scheme i.e. shooting method to solve the ode by numerically stepping through time to get a solution that matches the conditions? does any of what I just said make sense? $\endgroup$ – Chinny84 Mar 26 '15 at 16:53
  • $\begingroup$ See here: faculty.olin.edu/bstorey/Notes/DiffEq.pdf $\endgroup$ – jm324354 Mar 26 '15 at 16:55
  • $\begingroup$ so I am basically guessing the solution, what you said makes sense, but I still don't understand where to start. $\endgroup$ – Akaichan Mar 26 '15 at 16:55
  • $\begingroup$ see en.wikipedia.org/wiki/Runge%E2%80%93Kutta_methods $\endgroup$ – LutzL Mar 26 '15 at 17:29
1
$\begingroup$

$$y'-(1/t)y= t \text{sin}(t)$$

Let $y(t)=tz(t),y'(t)=z(t)+tz'(t)$, So: $$z+tz'-z=t\sin t\implies z'=\sin t\implies z=-\cos t+\color{grey}{\rm C}$$ So: $$y=\color{grey}{\rm C}t-t\cos t$$ Now: $$y(\pi/2)=\color{grey}{\rm C}\pi/2-(\pi/2)(0)=0\implies \color{grey}{\rm C}=0$$ So: $$y(t)=-t\cos t$$

$\endgroup$
  • $\begingroup$ I think @Akaichan is asking for a numerical solution. $\endgroup$ – KittyL Mar 27 '15 at 10:48
  • $\begingroup$ @KittyL he says "I want to find the solution y0(t) of the linear first-order ordinary differential equation" and if he knows the function he can get all values of y for any t! $\endgroup$ – RE60K Mar 27 '15 at 11:19
  • $\begingroup$ He also says "I know how to do this analytically using the integrating factor and such, but how do I solve for this numerically (and what exactly does that mean anyway)". So he knows the function and he can get all values of y. However he just wanted to know what it means by "solving it numerically". $\endgroup$ – KittyL Mar 27 '15 at 12:31
  • $\begingroup$ Oh @KittyL you were right. $\endgroup$ – RE60K Mar 27 '15 at 12:32
0
$\begingroup$

I do not understand your question. Is it like:

" I know the analytical solution and how to put in required boundary condition. How do I impose boundary conditions into a numerical solution, because I have nowhere to plug them in and myself verify / check up answer like in the analytical situation? "

If that is your question, the answer is:

You don't need to do all that. You choose RK4 or whatever method, simply plug in $ y(\pi/2) = 0 $ and press the RUN button.

Else I cannot say.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.