Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
questions about the symbolic differential equation

Subject: questions about the symbolic differential equation

From: workaholic

Date: 18 Oct, 2010 20:12:47

Message: 1 of 3

consider the differential equation:

 dsolve('Dx = x^2 -x')

ans =

                    0
                    1
 -1/(exp(C3 + t) - 1)

I think it neglects another solution that is 1/( 1 + exp(t +c)), which
requires the value of x lies within [0,1]. Is there something wrong
with the algorithm?

Subject: questions about the symbolic differential equation

From: Nasser M. Abbasi

Date: 18 Oct, 2010 21:31:51

Message: 2 of 3

On 10/18/2010 1:12 PM, workaholic wrote:
> consider the differential equation:
>
> dsolve('Dx = x^2 -x')
>
> ans =
>
> 0
> 1
> -1/(exp(C3 + t) - 1)
>
> I think it neglects another solution that is 1/( 1 + exp(t +c)), which
> requires the value of x lies within [0,1]. Is there something wrong
> with the algorithm?

lets see: (first, this is I think what is called an autonomous first
order nonlinear ode or something like that, I am not good on remembering
names?)

Any way, lets try to solve it together to see if we get the same solution:

write it as dx/dt = x(t)^2 - x(t)

rearrange as (sep. variables)

             dx/(x^2-x) = dt
or
             dx/x^2 - dx/x = dt

integrate
            log(-1 + x) - log(x) = t + C

raise to exp and simplify

            (x-1)/x = exp(t+C)
or
             1-1/x = exp(t+C)
or
             1/x = 1-exp(t+C))
or
             x = 1/(1-exp(t+C))
or
             x = -1/(exp(t+C)-1)

So, there is only ONE solution that I see.

I do not know why matlab showed the first 2 solution you have there?

--Nasser

Subject: questions about the symbolic differential equation

From: Roger Stafford

Date: 19 Oct, 2010 04:37:03

Message: 3 of 3

workaholic <liuauto@gmail.com> wrote in message <a91a6a92-9a27-43ba-a25d-aa2b62a834b2@g18g2000yqk.googlegroups.com>...
> consider the differential equation:
>
> dsolve('Dx = x^2 -x')
>
> ans =
>
> 0
> 1
> -1/(exp(C3 + t) - 1)
>
> I think it neglects another solution that is 1/( 1 + exp(t +c)), which
> requires the value of x lies within [0,1]. Is there something wrong
> with the algorithm?
- - - - - - - - - - -
  Yes, 'dsolve' neglected the possibility that x could lie in the interval [0,1]. At the step

 int(1/(x-1) - 1/x) = t + C

it gave the solution

 log(x-1) - log(x) = t + C .

In reality there are three cases: 1) x > 1, 2) 0 < x < 1, and 3) x < 0. The three respective integrations should yield;

 log(x-1) - log(x) = log((x-1)/x) = t + C
 log(1-x) - log(x) = log((1-x)/x) = t + C
 log(1-x) - log(-x) = log((x-1)/x) = t + C

Thus cases 1) and 3) give rise to the same expression but case 2) is different. 1) and 3) lead to

 x = 1/(1-exp(t+C))

while 2) yields

 x = 1/(1+exp(t+C))

which, as you say, 'dsolve' missed. Both solutions as well as the x = 1 solution are subsumed in the single expression x = 1/(1+K*exp(t)). The x = 0 solution comes from letting K approach infinity.

  The reality is that for each of the separate ranges of x, there is only one family of solutions as described above, obtained by shifts left or right along the t axis. The two constant solutions are derived from extreme shifts left or right.

  Congratulations to 'dsolve' for providing for the extremes; raspberries for missing the entire solution family between 0 and 1. Take comfort - there is still a need for us mere human beings to straighten out the machines' errors.

Roger Stafford

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us