# Solve second order non linear differential equation

4 views (last 30 days)

Show older comments

I need to solve F'' + F^2 -1/2pi = 0

Boundary conditons

F(0) = 0;

F(inf) = 1

I am new to using the ode solver in matlab and am not sure how to make it solve a non-linear SECOND order equation. Any suggestion would be appreciated.

##### 0 Comments

### Accepted Answer

Sulaymon Eshkabilov
on 9 Nov 2021

##### 3 Comments

John D'Errico
on 9 Nov 2021

I don't think the bvpsolver can handle an infinite domain, since it uses collocation.

### More Answers (1)

John D'Errico
on 9 Nov 2021

You will not be able to use bvp4c directly, since it will use collocation. That will fail on an infinite domain.

One option might be to use a finite domain, but one that is relatively large. So [0,Xmax] where Xmax is sufficiently far out that the solve has a chance to finish in a reasonable time, yet not that far out that numerical problems exist.

I did try dsolve, and it fails to find a solution, but that is not unexpected. My next suggestion is to use a transformation of the domain into a bounded domain. For example, you might try a transformation like

y = atan(x)

This maps the domain [0,inf] into [0,pi/2], which may be surprisingly a good idea, considering the equation at hand. You can see some ideas here on a similar problem:

But certainly other links exist where people explain how to transform such a problem into a finite domain.

### See Also

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!