Graph ODEs in Mathematica: y''+2y'+2y & y''+3y'+2y

  • Context: Mathematica 
  • Thread starter Thread starter amcavoy
  • Start date Start date
  • Tags Tags
    Mathematica
Click For Summary

Discussion Overview

The discussion revolves around how to graph specific ordinary differential equations (ODEs) in Mathematica, particularly focusing on the equations y''+2y'+2y=\delta(t-\pi) and y''+3y'+2y=\delta(t-5)+u_{10}(t). Participants explore methods for solving these ODEs, including the use of Laplace transforms, and share their experiences with Mathematica's capabilities.

Discussion Character

  • Exploratory
  • Technical explanation
  • Mathematical reasoning

Main Points Raised

  • One participant requests guidance on graphing the specified ODEs in Mathematica.
  • Another participant questions the need for a solution before graphing the equations.
  • There is a suggestion to use Laplace transforms to solve the equations prior to graphing.
  • A participant shares their experience with using NDSolve in Mathematica, noting issues with initial conditions and the complexity of the expressions returned.
  • One participant expresses surprise at Mathematica's handling of the inverse Laplace transform and shares a method to simplify the output.
  • Another participant mentions that they solved the equations but found the results too complex to sketch by hand, thus seeking to visualize them in Mathematica.
  • A participant provides a specific Mathematica code snippet for plotting the solution of the first ODE with initial conditions set to zero.

Areas of Agreement / Disagreement

Participants do not reach a consensus on the best approach to graph the ODEs, with differing opinions on whether a solution is necessary before graphing and varying experiences with Mathematica's functionality.

Contextual Notes

Some participants mention specific initial conditions and the challenges they face with the complexity of the solutions, indicating that the discussion may depend on individual interpretations of the equations and their solutions.

Who May Find This Useful

This discussion may be useful for individuals interested in graphing ODEs using Mathematica, particularly those exploring the application of Laplace transforms in solving differential equations.

amcavoy
Messages
663
Reaction score
0
Could someone tell me how to graph the following ODE's in Mathematica?:

[tex]y''+2y'+2y=\delta\left(t-\pi\right)[/tex]

[tex]y''+3y'+2y=\delta\left(t-5\right)+u_{10}\left(t\right)[/tex]

Thanks.
 
Physics news on Phys.org
I don't understand what you want to graph?

Don't you need the solution first?
 
amcavoy said:
Could someone tell me how to graph the following ODE's in Mathematica?:
[tex]y''+2y'+2y=\delta\left(t-\pi\right)[/tex]
[tex]y''+3y'+2y=\delta\left(t-5\right)+u_{10}\left(t\right)[/tex]
Thanks.

Can you solve them using Laplace Transforms first? That is:

[tex]\mathcal{L}\left\{\delta(t-a)\right\}=e^{-as}[/tex]

and:

[tex]\mathcal{L}^{-1}\left\{f(s)\right\}=e^{-at}\mathcal{L}^{-1}\left\{f(s-a)\right\}[/tex]

Edit: I tried using NDSolve in Mathematica. Having a problem with it as the first equation usually has the initial conditions both set to zero with the unit pulse at pi.
 
Last edited:
saltydog said:
Can you solve them using Laplace Transforms first? That is:
[tex]\mathcal{L}\left\{\delta(t-a)\right\}=e^{-as}[/tex]
and:
[tex]\mathcal{L}^{-1}\left\{f(s)\right\}=e^{-at}\mathcal{L}^{-1}\left\{f(s-a)\right\}[/tex]
Edit: I tried using NDSolve in Mathematica. Having a problem with it as the first equation usually has the initial conditions both set to zero with the unit pulse at pi.


Well, I'm impressed. At Mathematica anyway. At first I thought it couldn't handle:

[tex]\text{InverseLaplaceTransform}\left[\frac{e^{-\pi s}}{s^2+2s+2}\right][/tex]

returning a complex expression but then I used:

[tex]\text{Simplify[ComplexExpand[InverseLaplaceTransform}\left[\frac{e^{-\pi s}}{s^2+2s+2}\right]]][/tex]

and it returned the correct value. Amcavoy, you gettin' all of this? Really would recommend to you to do all the work by hand first. Right? Just use the relations I gave above and you can invert that last expression by hand.

Set the initial conditions for the first one to 0. As far as the second one, that u10 just ain't happening for me.

Edit:
Oh great, suppose you need another relation:

[tex]\mathcal{L}^{-1}\left\{e^{-as}F(s)\right\}=f(t-a)u(t-a)[/tex]

where u(t) is the unit step function.
 
Last edited:
Yeah I did solve them (I had some more too), but they looked too messy for me to "sketch" by hand so I wanted to see what they looked like in Mathematica. Thanks for the help :)
 
amcavoy said:
Yeah I did solve them (I had some more too), but they looked too messy for me to "sketch" by hand so I wanted to see what they looked like in Mathematica. Thanks for the help :)

Well, this is the first one in Mathematica for y(0)=0, y'(0)=0:

Code:
f[t_] :=
      If[t ≤  Pi,
          Return[0];
          ,
          Return[Exp[-(t - Pi)] Sin[t - Pi]];
       ];
 Plot[f[x], {x, 0, 4 Pi}, PlotRange -> {{0, 4 Pi}, {-0.4, 0.4}}]

Edit: Jesus, don't even need the 'Module' part.
 
Last edited:

Similar threads

  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 13 ·
Replies
13
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K