Using matlab/mathematica to solve a second order diff.eq.

  • Thread starter Thread starter astropi
  • Start date Start date
  • Tags Tags
    Second order
Click For Summary

Homework Help Overview

The discussion revolves around solving a second-order differential equation, specifically y'' + 3y' = 2t^4, using computational tools like MATLAB and Mathematica. The original poster expresses a desire to avoid manual calculations for finding coefficients in the particular solution.

Discussion Character

  • Exploratory, Problem interpretation, Assumption checking

Approaches and Questions Raised

  • Participants discuss the possibility of treating the differential equation as a system of first-order equations. There are inquiries about the use of MATLAB's ode45 routine and whether initial conditions are necessary for its application. Some participants express confusion regarding the use of dsolve for second-order equations and seek clarification on how to implement these tools effectively.

Discussion Status

The conversation is ongoing, with participants sharing their experiences and seeking specific guidance on using MATLAB and Mathematica. There is no explicit consensus on the best approach yet, but some productive suggestions have been made regarding the breakdown of the problem into first-order systems.

Contextual Notes

Participants note that the original poster has already solved the differential equation by hand and is primarily looking for assistance with the algebraic aspects using software tools. There is also mention of the limitations of MATLAB in handling higher-order systems directly.

astropi
Messages
47
Reaction score
0

Homework Statement


This is NOT a homework problem, but it is similar. Anyway, let's say we have:

y''+3y' = 2t^4

This is easy to solve by hand. For the particular solution you get:

Yp = At+Bt^2+Ct^3+Dt^4+Et^5

Now, to solve for the coefficients, you can solve them by hand, or you can use some sort of program. Myself, I tried using MATLAB but could not get it to work. So I am hoping someone with MATLAB experience can help me, since I do not want to do all this mundane work by hand!

Homework Equations



You have to take the derivative (1st and second) of Yp and then plug back into the original equation, then equate coefficients. Although it can be done by hand, surely there has to be a better way to do this with Mathematica or matlab?

The Attempt at a Solution



I tried using matlab, as I said, but could not get it to work. If someone has an idea, or wants to see my MATLAB code (which is only 4-5 lines) I would be happy to send it. Otherwise, if someone can help with either MATLAB or mathematica, please let me know. Thanks.
 
Physics news on Phys.org
I think you have to treat it as a system:

[tex] \begin{array}{rcl}<br /> y' & = & z \\<br /> z'+3z & = & 2t^{4}<br /> \end{array}[/tex]
 
hunt_mat said:
I think you have to treat it as a system:

[tex] \begin{array}{rcl}<br /> y' & = & z \\<br /> z'+3z & = & 2t^{4}<br /> \end{array}[/tex]

I don't follow you. How is this going to help me use Mathematica or Matlab? If you know how, please provide me with some actual code I could test out. Thanks.
 
|If you look in the help files, it's quite clear how to use the ode45 routine to solve a system. Matlab won't solve higher order systems, you have to break them down into first order systems.
 
hunt_mat said:
|If you look in the help files, it's quite clear how to use the ode45 routine to solve a system. Matlab won't solve higher order systems, you have to break them down into first order systems.

I'm a MATLAB newbie, so ode45 doesn't look very clear to me. Do you have to have initial conditions for ode45 to work, because in my example there are none. Also, I was fairly certain you can use dsolve to solve second order diff. eq. without much problem. At any rate, I'm not trying to solve the diff.eq. I already did that. I just want some program to do the algebra. Thanks.
 
Then use maple or matlab.
 
hunt_mat said:
Then use maple or matlab.

I have been trying matlab. I don't know maple, but I would be surprised if people haven't already done this with Mathematica and Matlab. Hopefully someone out there can help...
 

Similar threads

Replies
4
Views
2K
Replies
7
Views
2K
  • · Replies 9 ·
Replies
9
Views
2K
  • · Replies 18 ·
Replies
18
Views
4K
  • · Replies 5 ·
Replies
5
Views
4K
Replies
3
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 14 ·
Replies
14
Views
4K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 33 ·
2
Replies
33
Views
4K