Results 1 to 4 of 4

Math Help - Matlab dsolve and 'by hand' discrepancies - second order ODE

  1. #1
    Newbie
    Joined
    Dec 2009
    Posts
    13

    Matlab dsolve and 'by hand' discrepancies - second order ODE

    Hi

    I've recently starting using Matlab and am trying to verify all work that I do by hand using it.

    y'' + 4y' + 3y = 5e^-3x

    By hand I get

    y = A/e^x + B/e^3x - 5x/(2e^3x)

    but with dsolve, there's an extra term ...

    dsolve('D2y + 4*Dy + 3*y = 5*exp(-x*3)','x')

    ans = C5/exp(x) - (5*x)/(2*exp(3*x)) - 5/(4*exp(3*x)) + C6/exp(3*x)

    I can't work out what is going on - the ODE is simple to solve by hand so have I made a silly mistake in the matlab implementation?

    Thanks for having a look!

    Iota
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Grand Panjandrum
    Joined
    Nov 2005
    From
    someplace
    Posts
    14,972
    Thanks
    4
    Quote Originally Posted by iota View Post
    Hi

    I've recently starting using Matlab and am trying to verify all work that I do by hand using it.

    y'' + 4y' + 3y = 5e^-3x

    By hand I get

    y = A/e^x + B/e^3x - 5x/(2e^3x)

    but with dsolve, there's an extra term ...

    dsolve('D2y + 4*Dy + 3*y = 5*exp(-x*3)','x')

    ans = C5/exp(x) - (5*x)/(2*exp(3*x)) - 5/(4*exp(3*x)) + C6/exp(3*x)

    I can't work out what is going on - the ODE is simple to solve by hand so have I made a silly mistake in the matlab implementation?

    Thanks for having a look!

    Iota
    Both solutions are correct, you can combine the last two terms in the Matlab solution to get your solution.

    Quite why M. can't sort this out I don't know.

    CB
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Newbie
    Joined
    Dec 2009
    Posts
    13
    Quote Originally Posted by CaptainBlack View Post
    Both solutions are correct, you can combine the last two terms in the Matlab solution to get your solution.

    Quite why M. can't sort this out I don't know.

    CB
    Thanks CB - of course, it's just a constant term!

    Even if I had noticed that I would have still been a little confused. What is really interesting me now though is the underlying algorithm used by M. Where would it have got that value, separate from the other constant term, from? I will try to do some searching about. Would be interesting to see how other symbolic solvers behave.

    Cheers!

    i
    Follow Math Help Forum on Facebook and Google+

  4. #4
    Grand Panjandrum
    Joined
    Nov 2005
    From
    someplace
    Posts
    14,972
    Thanks
    4
    Quote Originally Posted by iota View Post
    Thanks CB - of course, it's just a constant term!

    Even if I had noticed that I would have still been a little confused. What is really interesting me now though is the underlying algorithm used by M. Where would it have got that value, separate from the other constant term, from? I will try to do some searching about. Would be interesting to see how other symbolic solvers behave.

    Cheers!

    i
    It will be due to its way of finding a particular integral, and I suspect it then does not realise it can combine similar terms one with a numeric constant coefficient and the other with a symbolic constant coefficient.

    CB
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. DSolve Mathematica version 7
    Posted in the Math Software Forum
    Replies: 0
    Last Post: December 9th 2010, 03:07 PM
  2. Replies: 1
    Last Post: December 4th 2010, 10:06 PM
  3. Replies: 4
    Last Post: May 12th 2010, 10:02 PM
  4. problem using dsolve in matlab
    Posted in the Math Software Forum
    Replies: 0
    Last Post: June 1st 2009, 11:09 AM
  5. Matlab 2nd order methods
    Posted in the Calculus Forum
    Replies: 1
    Last Post: December 2nd 2008, 09:13 AM

Search Tags


/mathhelpforum @mathhelpforum