Results 1 to 13 of 13
Like Tree4Thanks
  • 1 Post By HallsofIvy
  • 1 Post By topsquark
  • 1 Post By Melody2
  • 1 Post By jguzman

Math Help - Help solving a 1st order ODE

  1. #1
    Newbie
    Joined
    Nov 2013
    From
    Austria
    Posts
    18
    Thanks
    2

    Question Help solving a 1st order ODE

    I'm trying to solve analytically the following simple first order differential equation:

    {dx \over dt} = \frac{(1-x)}{\tau} - Ux

    for \tau and U being constants. In principle, this differential equation is linear, right? However, the only thing I could think at the moment is to try to write it differently to approximate to the following expression:

    {dx(t) \over dt} +p(t)x = q(t)

    that has a general solution of the form:

    x(t) = \frac{\int e^{\int p(t)dt} q(t)dt + C}{e^{\int p(t) dt}}

    For that, what I did so far:

    1. Reorganize the formula by multiplying everything by \tau:

    \tau {dx \over dt} = (1-x)- Ux \tau

    2. Group the terms involving the unknown:

    \tau {dx \over dt} = 1 -x(1 + U \tau)

    3. Reorganizing we can write as:

    \tau {dx \over dt} + x(1 + U \tau) = 1

    4. Dividing by \tau

    {dx \over dt} + x\frac{(1 + U \tau)}{\tau} = 1/\tau

    This gives me p(x) = (1+U)/\tau, and q(x) = 1/\tau which are constants, and not functions.

    Is this the right way to proceed or should I try another method?

    Thanks for your help
    Follow Math Help Forum on Facebook and Google+

  2. #2
    MHF Contributor

    Joined
    Apr 2005
    Posts
    14,973
    Thanks
    1121

    Re: Help solving a 1st order ODE

    Yes, that is a linear equation but it is also "separable" and I think that is an easier approach.

    \frac{dx}{dt}= \frac{1- x}{\tau}- Ux= \frac{1- x- \tau Ux}{\tau}

    Separate the variables: \tau \dfrac{dx}{1- (1+\tau U)x}= \dfrac{dt}{\tau}

    and each side can be integrated (on the left let y= 1- (1+ \tau U)x).
    Thanks from jguzman
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Newbie
    Joined
    Nov 2013
    From
    Austria
    Posts
    18
    Thanks
    2

    Re: Help solving a 1st order ODE

    Wov! Thanks!

    I first tried to do it with by separation of variables, but I wasn't able to separate the equation into 2 expressions:

    From your separated expression:

    \frac{dx}{1-(1+\tau U)x}= \frac{dt}{\tau}

    Let be y = 1-(1+\tau U)x,
    then dy= -(1+U\tau)dx,

    both expressions that we substitute in the differential equation:

    \frac{dy}{y (-U\tau - 1)}= \frac{dt}{\tau}

    Reorganize the negative symbol:

    \frac{dy}{y (U\tau + 1)}= -\frac{dt}{\tau}

    and moving the constants to the left side:

    \frac{dy}{y}= -\frac{ (U\tau + 1)}{\tau} dt

    then solving for y:

    \log(y) = -\frac{ (U\tau + 1)}{\tau} t

    and applying exponentiation to both sides...

    y= \exp{(-\frac{ (U\tau + 1) t}{\tau})}

    I'm not very sure this is the right answer....
    Last edited by jguzman; November 25th 2013 at 05:54 AM.
    Follow Math Help Forum on Facebook and Google+

  4. #4
    Member
    Joined
    Nov 2013
    From
    Australia
    Posts
    176
    Thanks
    36

    Re: Help solving a 1st order ODE

    I really don't know if I am allowed to do all this but I gave new found LaTeX a work out anyway.


    \begin{align*}\frac{dx}{dt}=&\frac{1-x}{r}-Ux\\\frac{dx}{dt}=&\frac{(1-x)-Urx}{r}\\\frac{dt}{dx}=&\frac{r}{1-x-Urx}\\\frac{dt}{dx}=&\frac{r}{1-x(1+Ur)}\\t=&r\times \int \frac{1}{1-x(1+Ur)}dx\\t=&r\times \frac{ln(1-x(1+Ur))}{-(Ur+1)}+k\;\;\text{where k is a constant}\\t=&\frac{-r}{Ur+1}\times ln(1-(Ur+1)x)+k\\\frac{(t-k)(Ur+1)}{-r}=&ln(1-(Ur+1)x)\\e^\frac{(k-t)(Ur+1)}{r}=&1-(Ur+1)x\\\frac{e^{\frac{(k-t)(Ur+1)}{r}}-1}{-(Ur+1)}=&x\\x=&\frac{1-e^{\frac{(k-t)(Ur+1)}{r}}}{Ur+1}\end{align*}

    Am I allowed to do this?
    Follow Math Help Forum on Facebook and Google+

  5. #5
    Newbie
    Joined
    Nov 2013
    From
    Austria
    Posts
    18
    Thanks
    2

    Arrow Re: Help solving a 1st order ODE

    Hey Melody2!!!

    Unless I'm doing something wrong, your solution

    x(t) = \frac{1- \exp(\frac{(K-t) (U \tau + 1)}{\tau}))}{(U \tau + 1)}

    is not correct.

    I've just tested whether the solution of that my CAS provide give the same return values as your equation with the same parameters (K=1, U=0.8 and tau=2) for some values(for example for t=1 and t=5), and they're different. Strange enough, the steady-state conditions match.

    See details here

    my solution above doesn't work either.
    Follow Math Help Forum on Facebook and Google+

  6. #6
    Forum Admin topsquark's Avatar
    Joined
    Jan 2006
    From
    Wellsville, NY
    Posts
    9,664
    Thanks
    298
    Awards
    1

    Re: Help solving a 1st order ODE

    Quote Originally Posted by jguzman View Post
    Wov! Thanks!

    I first tried to do it with by separation of variables, but I wasn't able to separate the equation into 2 expressions:

    From your separated expression:

    \frac{dx}{1-(1+\tau U)x}= \frac{dt}{\tau}

    Let be y = 1-(1+\tau U)x,
    then dy= -(1+U\tau)dx,

    both expressions that we substitute in the differential equation:

    \frac{dy}{y (-U\tau - 1)}= \frac{dt}{\tau}

    Reorganize the negative symbol:

    \frac{dy}{y (U\tau + 1)}= -\frac{dt}{\tau}

    and moving the constants to the left side:

    \frac{dy}{y}= -\frac{ (U\tau + 1)}{\tau} dt

    then solving for y:

    \log(y) = -\frac{ (U\tau + 1)}{\tau} t

    and applying exponentiation to both sides...

    y= \exp{(-\frac{ (U\tau + 1) t}{\tau})}

    I'm not very sure this is the right answer....
    This is almost correct. The solution is
    x = A e^{- \left ( 1 + \tau U)t/ \tau} \right )

    (You forgot to put it in terms of x and also the constant of integration.)

    -Dan
    Thanks from jguzman
    Follow Math Help Forum on Facebook and Google+

  7. #7
    Newbie
    Joined
    Nov 2013
    From
    Austria
    Posts
    18
    Thanks
    2

    Re: Help solving a 1st order ODE

    Hi
    Quote Originally Posted by topsquark View Post
    This is almost correct. The solution is
    x = A e^{- \left ( 1 + \tau U)t/ \tau} \right )
    -Dan
    Actually, I'm not very sure about that, for 2 reasons:

    1) Your equation differs from the one that results from the symbolic integration computed with software (see here)

    2) More importantly, note that the solution of the differential equation in steady-state depends on U and \tau, since

    {dx \over dt}= 0,

    then \frac{(1-x)}{\tau}-Ux =0,

    operating and organizing we have
    (1-x) = Ux\tau,
     1 - x - Ux\tau = 0,
      x + Ux\tau = 1,

    solving for x:
    x= \frac{1}{(1+U\tau)},

    when your equation tends to infinity, the value of x tends to zero, because e^{-\infty}=0


    Now I know that the solution is like this:

    x(t)=\frac{{\left(U \tau + e^{\left(U t +\frac{t}{\tau}\right)}\right)} e^{\left(-U t\right)}}{U \tau e^{\frac{t}{\tau}} + e^{\frac{t}{\tau}}}

    But do not know how to get there... or to get a more simple expression
    Last edited by jguzman; November 25th 2013 at 11:01 AM.
    Follow Math Help Forum on Facebook and Google+

  8. #8
    Forum Admin topsquark's Avatar
    Joined
    Jan 2006
    From
    Wellsville, NY
    Posts
    9,664
    Thanks
    298
    Awards
    1

    Re: Help solving a 1st order ODE

    Perhaps this will help: The A in my equation is a constant that depends on U and tau.

    -Dan
    Follow Math Help Forum on Facebook and Google+

  9. #9
    Newbie
    Joined
    Nov 2013
    From
    Austria
    Posts
    18
    Thanks
    2

    Re: Help solving a 1st order ODE

    Quote Originally Posted by topsquark View Post
    This is almost correct. The solution is
    x = A e^{- \left ( 1 + \tau U)t/ \tau} \right )

    (You forgot to put it in terms of x and also the constant of integration.)

    -Dan
    I think it will help me to try to solve it again:

    From my (correct?) expression:
    Quote Originally Posted by jguzman View Post

    \frac{dy}{y}= -\frac{ (U\tau + 1)}{\tau} dt
    We apply integration to the previous expression:

    \int \frac{dy}{y}= -\frac{ (U\tau + 1)}{\tau} \int dt,

    and solve that integral, we obtain:

    \log{y}= -\frac{ (U\tau + 1)}{\tau} t + A,

    being A the integration constant. Now we have to apply exponential to both sides. In this the step I'm not very sure if the exponential of the left hand side is correct (I assumed that exponential of a sum is not the same as the sum of the exponentials).

    y= \exp \Big(-\frac{ (U\tau + 1)t}{\tau} + A\Big),

    Since we know that y = 1 - (1+U\tau)x we can write:

     1 - (1+U\tau)x = \exp \Big(-\frac{ (U\tau + 1)t}{\tau} + A\Big),

    reorganizing everything:

     - (1+U\tau)x = \exp \Big(-\frac{ (U\tau + 1)t}{\tau} + A\Big) - 1 ,

      (1+U\tau)x = 1 - \exp \Big(-\frac{ (U\tau + 1)t}{\tau} + A\Big) ,

    which results in this monster:

      x(t) = \frac{1 - \exp \Big(-\frac{ (U\tau + 1)t}{\tau} + A\Big)}{(1+U\tau)}

    I missed something...
    Last edited by jguzman; November 26th 2013 at 11:41 PM.
    Follow Math Help Forum on Facebook and Google+

  10. #10
    Member
    Joined
    Nov 2013
    From
    Australia
    Posts
    176
    Thanks
    36

    Re: Help solving a 1st order ODE

    I believe that this last answer is exactly the same as my answer

    Your A equals my (Ur+1)k/r They are both just constants.
    Thanks from jguzman
    Follow Math Help Forum on Facebook and Google+

  11. #11
    Member
    Joined
    Nov 2013
    From
    Australia
    Posts
    176
    Thanks
    36

    Re: Help solving a 1st order ODE

    Quote Originally Posted by jguzman View Post
    Hey Melody2!!!

    I've just tested whether the solution of that my CAS provide give the same return values as your equation with the same parameters (K=1, U=0.8 and tau=2) for some values(for example for t=1 and t=5), and they're different. Strange enough, the steady-state conditions match.
    Hi jguzman,
    My knowledge has holes in it and I actually didn't understand what you meant by steady-state. I can see that as t gets bigger f(t) appears to be or approach the same constant. Maybe 0.4 I assume that that is what you meant.
    I am also interested in the Sage code that you used. Is that program an internet freeby?

    Melody.
    Last edited by Melody2; November 27th 2013 at 02:54 AM.
    Follow Math Help Forum on Facebook and Google+

  12. #12
    Newbie
    Joined
    Nov 2013
    From
    Austria
    Posts
    18
    Thanks
    2

    Re: Help solving a 1st order ODE

    Hi Melody!

    Quote Originally Posted by Melody2 View Post
    Hi jguzman,
    My knowledge has holes in it and I actually didn't understand what you meant by steady-state. I can see that as t gets bigger f(t) appears to be or approach the same constant. Maybe 0.4 I assume that that is what you meant.
    That's exactly what I meant by steady-state. The differential equation has an steady-state if the function x(t) does not change anymore with the independent variable (in my case t). In that case, the rate of change of x(t) is zero, therefore the differential equation is zero. The value that I obtained in the steady state dependended on both \tau and U. The relationship is:

    x(\infty) = \frac{1}{1+U\tau}

    For the numerical computations I performed, I set U=0.8 and \tau=2, so we have an steady-state of 0.38

    Both yours and mysolution have the same steady state, so I guess they only differ in the way the constants are defined. The definition of the constants is important in my case because I'm trying to model a biophysical system.

    Quote Originally Posted by Melody2 View Post
    I am also interested in the Sage code that you used. Is that program an internet freeby?

    Melody.
    Yes, Sage is free. In principle you can use it in your computer, via a cloud or in Internet via the link I sent you (this allows you to share pieces of code with colleagues, as I did here).

    I will send you a link via a private message and some examples, ok?
    Thanks from Melody2
    Follow Math Help Forum on Facebook and Google+

  13. #13
    Member
    Joined
    Nov 2013
    From
    Australia
    Posts
    176
    Thanks
    36

    Re: Help solving a 1st order ODE

    Thanks very much for your thoughtful answer
    and
    I would like the link.
    Thanks
    Melody.
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Solving 1st order DE
    Posted in the Differential Equations Forum
    Replies: 4
    Last Post: August 18th 2013, 04:14 AM
  2. 3rd-order to first order ODE and solving
    Posted in the Differential Equations Forum
    Replies: 0
    Last Post: December 1st 2010, 12:04 PM
  3. Solving a first order DE
    Posted in the Differential Equations Forum
    Replies: 1
    Last Post: September 6th 2009, 08:15 AM
  4. Need help solving some 2nd order DEs
    Posted in the Differential Equations Forum
    Replies: 2
    Last Post: August 14th 2009, 01:48 PM
  5. Solving this second order?
    Posted in the Calculus Forum
    Replies: 4
    Last Post: February 15th 2008, 10:40 PM

Search Tags


/mathhelpforum @mathhelpforum