Thread Subject: Analytical solution of an ODE

Subject: Analytical solution of an ODE

From: Pete

Date: 1 Sep, 2010 22:39:05

Message: 1 of 9

Please forgive a crude and basic question, but how could I solve the following in MATLAB?

d^2y/dx^2 = k*sqrt(1+(dy/dx)^2), x(0) = 0, dy/dx(0) = 0

I had a look at dsolve and tried the following:
y = dsolve('D2y = k*sqrt(1+dy^2)','y(0)=0','Dy(0)=0','x')

and got:
y = 1/2*k*(1+dy^2)^(1/2)*x^2

Am I anywhere even close to being on the right lines?

Subject: Analytical solution of an ODE

From: Pete

Date: 2 Sep, 2010 00:33:07

Message: 2 of 9

Guys..........I'm no mathematician or Matlabber and I've done my best..........you'd be helping me win a bet at work if you can help me out with this............if anyone could take a minute it would make my week.



"Pete" <petematlab@gmail.com> wrote in message <i5mkm8$g8r$1@fred.mathworks.com>...
> Please forgive a crude and basic question, but how could I solve the following in MATLAB?
>
> d^2y/dx^2 = k*sqrt(1+(dy/dx)^2), x(0) = 0, dy/dx(0) = 0
>
> I had a look at dsolve and tried the following:
> y = dsolve('D2y = k*sqrt(1+dy^2)','y(0)=0','Dy(0)=0','x')
>
> and got:
> y = 1/2*k*(1+dy^2)^(1/2)*x^2
>
> Am I anywhere even close to being on the right lines?

Subject: Analytical solution of an ODE

From: Pete

Date: 2 Sep, 2010 00:52:04

Message: 3 of 9

How about this?
y = dsolve('D2y = k*sqrt(1+Dy^2)','y(0)=0','Dy(0)=0','x')

Answer:
y =
 -1/k*cosh(x*k)+1/k
  1/k*cosh(x*k)-1/k

Have I got it?


------------------------------------------------

"Pete" <petematlab@gmail.com> wrote in message <i5mkm8$g8r$1@fred.mathworks.com>...
> Please forgive a crude and basic question, but how could I solve the following in MATLAB?
>
> d^2y/dx^2 = k*sqrt(1+(dy/dx)^2), x(0) = 0, dy/dx(0) = 0
>
> I had a look at dsolve and tried the following:
> y = dsolve('D2y = k*sqrt(1+dy^2)','y(0)=0','Dy(0)=0','x')
>
> and got:
> y = 1/2*k*(1+dy^2)^(1/2)*x^2
>
> Am I anywhere even close to being on the right lines?

Subject: Analytical solution of an ODE

From: Ross W

Date: 2 Sep, 2010 02:17:06

Message: 4 of 9

"Pete" <petematlab@gmail.com> wrote in message <i5msfk$28p$1@fred.mathworks.com>...
> How about this?
> y = dsolve('D2y = k*sqrt(1+Dy^2)','y(0)=0','Dy(0)=0','x')
>
> Answer:
> y =
> -1/k*cosh(x*k)+1/k
> 1/k*cosh(x*k)-1/k
>
> Have I got it?
>
>
> ------------------------------------------------
>
> "Pete" <petematlab@gmail.com> wrote in message <i5mkm8$g8r$1@fred.mathworks.com>...
> > Please forgive a crude and basic question, but how could I solve the following in MATLAB?
> >
> > d^2y/dx^2 = k*sqrt(1+(dy/dx)^2), x(0) = 0, dy/dx(0) = 0
> >
> > I had a look at dsolve and tried the following:
> > y = dsolve('D2y = k*sqrt(1+dy^2)','y(0)=0','Dy(0)=0','x')
> >
> > and got:
> > y = 1/2*k*(1+dy^2)^(1/2)*x^2
> >
> > Am I anywhere even close to being on the right lines?

Hi

I don't use the symbolic math tool so can't help with that.

But the answer you get is the same as what I get if I integrate your equation twice the old-fashioned pen and paper way (assuming that your x(0)=0 is a typo and you really mean y(x=0)=0)

Ross

Subject: Analytical solution of an ODE

From: Pete

Date: 2 Sep, 2010 02:42:05

Message: 5 of 9

Thanks Ross. Yes, that was indeed a typo in the first post - it was y(0) = 0 and dy/dx(0) = 0.
And congratulations on your pen and paper skills.

Subject: Analytical solution of an ODE

From: Ross W

Date: 2 Sep, 2010 03:32:04

Message: 6 of 9

"Pete" <petematlab@gmail.com> wrote in message <i5n2tt$o4u$1@fred.mathworks.com>...
> Thanks Ross. Yes, that was indeed a typo in the first post - it was y(0) = 0 and dy/dx(0) = 0.
> And congratulations on your pen and paper skills.

It's just an indication that I developed those skills before there were computers to help me with the problem ;-)

Subject: Analytical solution of an ODE

From: Torsten Hennig

Date: 2 Sep, 2010 06:54:04

Message: 7 of 9

> How about this?
> y = dsolve('D2y =
> k*sqrt(1+Dy^2)','y(0)=0','Dy(0)=0','x')
>
> Answer:
> y =
> -1/k*cosh(x*k)+1/k
> 1/k*cosh(x*k)-1/k
>
> Have I got it?
>
>

Inserting the "solutions" into your differential
equation, only the second one from above is correct.

Best wishes
Torsten.

Subject: Analytical solution of an ODE

From: Ross W

Date: 3 Sep, 2010 01:17:06

Message: 8 of 9

Torsten Hennig <Torsten.Hennig@umsicht.fhg.de> wrote in message <510791724.152843.1283410474690.JavaMail.root@gallium.mathforum.org>...
> > How about this?
> > y = dsolve('D2y =
> > k*sqrt(1+Dy^2)','y(0)=0','Dy(0)=0','x')
> >
> > Answer:
> > y =
> > -1/k*cosh(x*k)+1/k
> > 1/k*cosh(x*k)-1/k
> >
> > Have I got it?
> >
> >
>
> Inserting the "solutions" into your differential
> equation, only the second one from above is correct.
>
> Best wishes
> Torsten.

Hmmm, I think that depends on what sqrt() means. If it's the positive or negative square root, then couldn't there be two solutions?

d2y/dx2=k sqrt(1+dy/dx^2) %the original equation
let z = dy/dx % a substitution to help me
then dz/dx = k sqrt(1+z^2) %insert my substitution in the equation
(dz/dx)^2=k^2 (1+z^2) %square both sides of equation

and then it seems to me that +/-z are both solutions, which tells me that +/-y are both solutions.

Ross

Subject: Analytical solution of an ODE

From: Torsten Hennig

Date: 3 Sep, 2010 08:24:35

Message: 9 of 9

> Torsten Hennig <Torsten.Hennig@umsicht.fhg.de> wrote
> in message
> <510791724.152843.1283410474690.JavaMail.root@gallium.
> mathforum.org>...
> > > How about this?
> > > y = dsolve('D2y =
> > > k*sqrt(1+Dy^2)','y(0)=0','Dy(0)=0','x')
> > >
> > > Answer:
> > > y =
> > > -1/k*cosh(x*k)+1/k
> > > 1/k*cosh(x*k)-1/k
> > >
> > > Have I got it?
> > >
> > >
> >
> > Inserting the "solutions" into your differential
> > equation, only the second one from above is
> correct.
> >
> > Best wishes
> > Torsten.
>
> Hmmm, I think that depends on what sqrt() means. If
> it's the positive or negative square root, then
> couldn't there be two solutions?
>
> d2y/dx2=k sqrt(1+dy/dx^2) %the original equation
> let z = dy/dx % a substitution
> to help me
> then dz/dx = k sqrt(1+z^2) %insert my substitution
> in the equation
> (dz/dx)^2=k^2 (1+z^2) %square both sides of
> equation
>
> and then it seems to me that +/-z are both solutions,
> which tells me that +/-y are both solutions.
>
> Ross

For the square root to be a function, we must decide
which branch we take - either the principle branch or
the other one. If you decide to take the principle branch,
the second solution from above is the correct one ;
if you decide to take the other branch (which is possible, but unusual), the first solution from above
is the correct one - but never both of them.

Best wishes
Torsten.

Tags for this Thread

Everyone's Tags:

ode

Add a New Tag:

Separated by commas
Ex.: root locus, bode

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.

Tag Activity for This Thread
Tag Applied By Date/Time
ode Pete 1 Sep, 2010 18:44:05
rssFeed for this Thread

Contact us at files@mathworks.com