Message Boards Message Boards

0
|
10321 Views
|
4 Replies
|
3 Total Likes
View groups...
Share
Share this post:

Initial Value Problem Questions

Here is my effort to find the solution of $$\frac{dy}{dt}=\frac{2\sqrt{y}-2y}{t},\quad y(-1)=1$$ Note that this equation is in normal form, $y'=f(t,y)$, where $$f(t,y)=\frac{2\sqrt{y}-2y}{t}.$$ I believe this function $f(t,y)$ is continuous on $\{(t,y): y\ge 0\text{ and } t\ne 0\}$. Furthermore, the partial derivative with respect to $y$ is: $$\frac{\partial f}{\partial y}=\frac{\dfrac{1}{\sqrt{y}}-2}{t}$$ Checking with Mathematica:

In[1]:= D[(2 Sqrt[y] - 2 y)/t, y]

Out[1]= (-2 + 1/Sqrt[y])/t

Note that $\partial f/\partial y$ is continuous on $\{(t,y): y> 0\text{ and } t\ne 0\}$. Hence, both $f$ and $\partial f/\partial y$ are continuous on $D=\{(t,y): y> 0\text{ and } t\ne 0\}$. Therefore, by the existence and uniqueness theorem, we can form a rectangular region around the point $(-1,1)$ that lies within the region $D$. Thus, there should only be one solution of the initial value problem passing through the point $(-1,1)$, which is the initial condition $y(-1)=1$.

First, note that $y(t)=1$ is clearly a solution of this initial value problem. Now, let's try to find a solution using Mathematica.

In[2]:= sol = 
 DSolve[{y'[t] == (2 Sqrt[y[t]] - 2 y[t])/t, y[-1] == 1}, y[t], t]

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. >>

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]= {{y[t] -> (2 + t)^2/t^2}}

If we create a vector plot, then plot both solutions found, we'll see a problem.

SetOptions[VectorPlot, VectorScale -> {0.03, Automatic, None}, 
  VectorStyle -> {Arrowheads[0], Gray}];
vf = VectorPlot[{1, (2 Sqrt[y] - 2 y)/t}, {t, -4, 4}, {y, -1, 3}, 
   Axes -> True];

Now we create plots of the two answers.

p1 = Plot[1, {t, -4, 4}];
p2 = Plot[y[t] /. sol, {t, -4, 4}];
Show[vf, p1, p2]

Here is the image:

enter image description here

Note that the solutions intersect at the point $(-1,1)$, contradicting the existence and uniqueness theorem.

Now, in this first case, Mathematica failed to give one of the solutions, sending me an inappropriate solution, or at least it seems so to me. Now, a second case.

In[8]:= sol2 = 
 DSolve[{y'[t] == (2 Sqrt[y[t]] - 2 y[t])/t, y[-1] == 1/2}, y[t], t]

During evaluation of In[8]:= 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[8]:= Solve::ifun: Inverse functions are being used by Solve, so some solutions may not be found; use Reduce for complete solution information. >>

{{y[t] -> (Sqrt[2 (3 - 2 Sqrt[2])] + 2 t)^2/(
       4 t^2)}, {y[t] -> (Sqrt[2 (3 + 2 Sqrt[2])] + 2 t)^2/(4 t^2)}}

And the plot:

p3 = Plot[{y[t] /. sol2[[1]], y[t] /. sol2[[2]]}, {t, -4, 4}];
Show[vf, p3]

enter image description here

Again, two solutions intersecting at the point $(-1,1/2)$, which should not happen. What I need to know here is this: Is there an easy way in Mathematica to know which of the two selections to choose and to determine over what interval it should be plotted. Here is what I tried:

p4 = Plot[y[t] /. sol2[[1]], {t, -4, -0.292893}];
Show[vf, p4]

And the output.

enter image description here

But I need to learn a lot more if I am going to be helpful to my students, all of whom will be beginners in Mathematica.

POSTED BY: David Arnold
4 Replies

Absolutely amazing answer. You are the first ever to show me a concrete example of how to use the Reduce command.

POSTED BY: David Arnold
Posted 10 years ago

Hi David,

I believe the problem here is that Mathematica offered a solution that is in fact not valid at the point (-1,1) which was a defined initial condition. So there is no contradiction of the uniqueness theorem. You will see below (and I attach the notebook) that the solution found is valid only for t <= -2 or t > 0. I find it a bit odd that Mathematica did in fact provide a solution that does not include the initial conditions.

(* equation *)
eq = y'[t] == (2 Sqrt[y[t]] - 2 y[t])/t

(* solution *)
sol = DSolve[{eq, y[-1] == 1}, y, t] // First

(* it verifies, but with restrictions *)
Reduce[eq /. sol, t, Reals]

(* t\[LessEqual]-2||t>0 *)

(* look at LHS and RHS over a range *)
backsub = eq /. sol

lhs = backsub[[1]]

rhs = backsub[[2]]

(* we see that this is NOT a solution at (-1,1) *)
Plot[{lhs, rhs}, {t, -3, 3}, PlotLegends -> {"LHS", "RHS"}]

enter image description here

Attachments:
POSTED BY: David Keith

No, my fault. I've tried to edit everything, changing all the x's to t's.

POSTED BY: David Arnold
Posted 10 years ago

Hi David,

I'm confused. In the text lead in you give dy/dt as a function of y and x, with an initial condition for y. Since you use dy/dt, and y depends on a scalar initial condition, y must be y[t], but what is x? Is this a constant in an ordinary diffeq?

In In[177] below, dy/dt becomes dy/dx. Now there is only one independent variable which is x, and an ordinary diffeq?

Am I missing something?

Best,

David

POSTED BY: David Keith
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract