Solving ODEs: 2 Problems for Beginners

  • Thread starter Thread starter *Alice*
  • Start date Start date
  • Tags Tags
    Odes
*Alice*
Messages
26
Reaction score
0
:-p Hi all,

I'm new here and was wondering whether anyone could give me a hint on the following two problems about ODEs (oh...and also, can anyone tell me where can I find this formula editor?):

Problem 1

find the solution for
dy/dx + y = y^2 (cosx - sinx)

try substitution: f = y^n
so: dy/dx = 1/(n*y^(n-1)) * df/dx

so ODE becomes

df/dx + ny = ny^(n+1)(cosx - sinx)

let n = (-1)

df/dx - y = sinx - cosx

Integrating factor

k(x) = e^(-x)

so
y = Integral (k(x) * P(x)) / k(x) , where P(x) = sinx -cosx

giving:
y = [Integral (e^(-x) (sinx - cos))] / e^(-x)

here I got stuck, as I don't know how to integrate this


Problem 2

(lny - x) dy/dx - ylny =0


try : z = lny

giving: d*dz/dx = dy/dx

substituting in ODE:

(z-x)y*dz/dx - yz = 0

where y = e^z (>=0)

don't know how to go on from here!



THANKS SO MUCH FOR YOUR HELP!
:smile:
 
Physics news on Phys.org
*Alice* said:
y = [Integral (e^(-x) (sinx - cos))] / e^(-x)
here I got stuck, as I don't know how to integrate this
The way to do this is with integration by parts, but there is a trick. I'll take the first part of the integral:
\int e^{-x}\sin{x}dx=-e^{-x}\sin{x}-\int -e^{-x}\cos{x}dx
=-e^{-x}\sin{x}+(-e^{-x}\cos{x} - \int (-e^x)(-\sin{x})dx)
=-e^{-x}\sin{x} - e^{-x}\cos{x} -\int e^{-x}\sin{x}dx
So it looks like we're back where we started, but notice the minus sign in front of the integral. This allows us to add the integral to both sides of the equation:
\int e^{-x}\sin{x}dx=-e^{-x}\sin{x} - e^{-x}\cos{x} -\int e^x\sin{x}dx
2\int e^{-x}\sin{x}dx=-e^{-x}\sin{x} - e^{-x}\cos{x}
Or
\int e^{-x}\sin{x}dx=\frac{-1}{2}[e^{-x}\sin{x} + e^{-x}\cos{x}]
*Alice* said:
(oh...and also, can anyone tell me where can I find this formula editor?)
Just type (tex)formula(/tex) to get your formula to appear. Just replace ( and ) with [ and ]. To see how to write the formulas just click on any formula you see and a window will pop up showing what code was used to generate it. I will look at the rest of the problems in a minute.
 
*Alice* said:
Problem 1

find the solution for
dy/dx + y = y^2 (cosx - sinx)

try substitution: f = y^n
so: dy/dx = 1/(n*y^(n-1)) * df/dx

so ODE becomes

df/dx + ny = ny^(n+1)(cosx - sinx)
No, it doesn't! It becomes
dy/dx+ ny^n= ny^(n+1)(cosx- sinx)
Taking n= -1 gives
dy/dx+ n/y= sinx- cosx which is still non-linear.

Problem 2

(lny - x) dy/dx - ylny =0


try : z = lny

giving: d*dz/dx = dy/dx

substituting in ODE:

(z-x)y*dz/dx - yz = 0
Now that's correct! Rewrite that last equation as
(z-x)dz- zdx= 0. that's an exact equation.
 
HallsofIvy said:
No, it doesn't! It becomes
dy/dx+ ny^n= ny^(n+1)(cosx- sinx)
Taking n= -1 gives
dy/dx+ n/y= sinx- cosx which is still non-linear.
Oops, didn't catch that. What about the substitution y=ef
 
Now that's correct! Rewrite that last equation as
(z-x)dz- zdx= 0. that's an exact equation.

hmmm...that's what I've come up with before. My problem here: How can I solve it as it is not separable?
 
*Alice* said:
hmmm...that's what I've come up with before. My problem here: How can I solve it as it is not separable?
It is an exact equation. Suppose you have a function f(z,x). Then by the chain rule df=\frac{\partial f}{\partial z}dz+\frac{\partial f}{\partial x}dx. Then suppose you have a diff eq of the form M(x,z)dz+N(x,z)dx=0. If you can find a function f(z,x) such that \frac{\partial f}{\partial z}=M(x,z) and \frac{\partial f}{\partial x}=N(x,z), then you have that df=0, or f=constant as the solution to your equation.
 
*Alice* said:
hmmm...that's what I've come up with before. My problem here: How can I solve it as it is not separable?

Well it's exact. Same dif:

(z-x)dz-zdx=0

is:

zdz-xdz-zdx=0

or by rearranging:

xdz+zdx=zdz

right?

That then is just:

d(xz)=zdz

Now turn the crank (integrate it). Tell you what, after that, solve:

(ln(y)-x)y^{'}-yln(y)=0,\quad y(0)=2

obtain an explicit expression for y(x) and then plot it from 0 to 2 (just a suggestion):smile:
 
Thanks for this.

If you integrate (z-x)y' - yz = 0

I don't understand how you obtain

(lny - x)y' - ylny =0

and from there how to find y
 
*Alice* said:
Thanks for this.
If you integrate (z-x)y' - yz = 0
I don't understand how you obtain
(lny - x)y' - ylny =0
and from there how to find y
You don't, that was the original equation. He's saying you should integrate
d(xz)=zdz
to find the solution to this. Once you integrate, just sub in lny for z to solve for y. Then use the initial condition to solve for the unknown constant of integration.
 
  • #10
*Alice* said:
Thanks for this.
If you integrate (z-x)y' - yz = 0
I don't understand how you obtain
(lny - x)y' - ylny =0
and from there how to find y

Know what, maybe you're a bit confussed.

(lny - x)y' - ylny =0

is the differential equation. Solving it we obtain a function y(x). Now, if you take the derivative of y(x), substitute y(x), it's derivative, ln(y(x)) into the ODE, then the LHS will equal zero. That means y(x) satisfied the ODE. Integrating:

(z-x)y^{'}-yz=0

or rather:

d(xz))=zdz

is just an intermediate step. It's

\int d(xz)=\int zd(z)

which is just:

xz=\frac{z^2}{2}+c

right?

So since I did that one, you integrate this one:

y^{''}d\left(y^{''}\right)=-2(y^{'})^2d\left(y^{'}\right)

Same dif right just a bit more intimidating looking but I bet you can do it.:smile:
 
  • #11
Hey Alice, just in case you're stumped on this:

y^{''}d\left(y^{''}\right)=-2\left(y^{'}\right)^2d\left(y^{'}\right)

is really just:

wdw=-2u^2du

right?

Integrating:

\int wdw=-2\int u^2du

gives:

\frac{w^2}{2}=-2/3u^3+c

See, same dif so the one with all the derivatives is just:

\frac{\left(y^{''}\right)^2}{2}=-2/3\left(y^{'}\right)^3+c

Don't get discouraged if you didn't see this. I see problems in here all the time I can't solve.

Oh yea, for the IVP above I got:

y(x)=Exp\left[\frac{2x+\sqrt{(2x)^2-4k}}{2}\right],\;k=-1/4(2ln2)^2
 
Last edited:
  • #12
Thanks everyone! Part a, btw worked by substituting y= z^(-1)
 
Back
Top