Difficulty with NDSolve (and DSolve)
- To: mathgroup at smc.vnet.net
- Subject: [mg106125] Difficulty with NDSolve (and DSolve)
- From: KK <kknatarajan at yahoo.com>
- Date: Sat, 2 Jan 2010 05:04:58 -0500 (EST)
Hi,
I am trying to numerically solve a differential equation. However, I
am encountering difficulty with Mathematica in generating valid
numerical solutions even for a special case of that equation.
The differential equation for the special case is:
F'[x] == - (2-F[x])^2/(1-2 x + x F[x]) and
F[1]==1.
These equations are defined for x in (0,1). Moreover, for my context,
I am only interested in solutions with F[x] in the range <1.
Even before I used Mathematica, I had computed the solution to the
differential equation as the solution to the following : x (2-F[x]) -
Log[2-F[x]]==1. For any given x in (0,1), there are two values of F
[x] that satifsy the equation. One of them is always less than 1, and
the other is F[x]= 2 + (ProductLog[E^(I (I + \[Pi])) x])/x which is
always greater than 1. For example, when x=0.85, the solutions are F
[x]=0.2979 and F[x]=1.32407. As mentioned earlier, I am only
interested in the first solution.
Both DSolve and NDSolve seem to provide only the second solution and
not the first one. When using DSolve, it gives out a warning that
there may be multiple solutions but that's about it. Is there an
option or something that I can set with NDSolve (or even DSolve) to
generate the solutions of interest to me?
Below is the relevant set of Mathematica code and the corresponding
outputs. I would greatly appreciate your help in this regard.
Thanks,
KK
------------------
In[1]:= DSolve[{ -((-2 + F[x])^2/(1 - 2 x + x F[x])) == F'[x],
F[1] == 1}, F[x], x]
During evaluation of In[1]:= InverseFunction::ifun: Inverse functions
are being used. Values may be lost for multivalued inverses. >>
During evaluation of In[1]:= Solve::ifun: Inverse functions are being
used by Solve, so some solutions may not be found; use Reduce for
complete solution information. >>
During evaluation of In[1]:= Solve::ifun: Inverse functions are being
used by Solve, so some solutions may not be found; use Reduce for
complete solution information. >>
Out[1]= {{F[x] -> (2 x + ProductLog[E^(I (I + \[Pi])) x])/x}}
------------------
(*Sample solution*)
In[2]:= Solve[(1 == (x (2 - F[x]) - Log[2 - F[x]] /. F[x] -> F) /.
x -> 0.9), F]
During evaluation of In[2]:= InverseFunction::ifun: Inverse functions
are being used. Values may be lost for multivalued inverses. >>
During evaluation of In[2]:= Solve::ifun: Inverse functions are being
used by Solve, so some solutions may not be found; use Reduce for
complete solution information. >>
Out[2]= {{F -> 0.297987}, {F -> 1.32407}}
--------------------
(*Please note I am using F[0.9999]=1 as the initial condition in the
NDSolve below. \
Otherwise, I end up with a warning that "Infinite expression 1/0. \
encountered. I had also used the same initial condition with DSolve \
and the results were similar.*)
In[3]:= NumSol =
NDSolve[{ -((-2 + F[x])^2/(1 - 2 x + x F[x])) == F'[x], F[.9999] ==
1}, F, {x, 0, 1}]
During evaluation of In[3]:= NDSolve::ndsz: At x ==
0.9999000049911249`, step size is effectively zero; singularity or
stiff system suspected. >>
Out[156]= {{F -> \!\(\*
TagBox[
RowBox[{"InterpolatingFunction", "[",
RowBox[{
RowBox[{"{",
RowBox[{"{",
RowBox[{"0.`", ",", "0.9999000049911249`"}], "}"}], "}"}],
",", "\<\"<>\"\>"}], "]"}],
False,
Editable->False]\)}}
---
(* I have omitted the plot here but it generates only the second
result*)
In[157]:= Plot[{Evaluate[F[x] /. NumSol]}, {x, .33, 1}]
-----------------------
- Follow-Ups:
- Re: Difficulty with NDSolve (and DSolve)
- From: danl@wolfram.com
- Re: Difficulty with NDSolve (and DSolve)
- From: Mark McClure <mcmcclur@unca.edu>
- Re: Difficulty with NDSolve (and DSolve)