1

I have came across a second order as well as second degree differential equation in study of cosmic inflation. The full equations is quite messy so let me give a prototye:

A(x) y''(x)^2 + B(x) y(x) + C(x) = 0, y'(0) = a, y(0) = b

What I usually do in this type of cases is to ask Mathematica to solve it. And she usually solve it. But, sometimes mathematica show some error, for instance "singularity or stiffness at x=d". Now, I am trying to solve them in some basic language ( read python ). But, the way we solve 2nd order differential equation is not applicable here, i.e., writing it as two first order differential equations. Can any one provide me with an algorithm for solving the problem and/or direct me to the literature where I can learn more about the methods.

Thanks in advance.

user3666197
  • 1
  • 6
  • 50
  • 92
Archimedes
  • 365
  • 3
  • 15
  • 1
    Possible duplicate of [Differential Equations in Python](https://stackoverflow.com/questions/5847201/differential-equations-in-python) – Rajan Chauhan Aug 01 '17 at 11:37
  • mh, take a look at scipy or sympy. I wouldn't hope for much though, I think their solvers are first derivative only. Or see if scilab/gnu octave can do it – Jonas K Aug 01 '17 at 11:38
  • 1
    Why can't you fold the x^2 term into A(x) and solve that? https://www.wolframalpha.com/input/?i=A(x)y%27%27+%2B+B(x)y%27+%2B+C(x)y+%3D+0 – duffymo Aug 01 '17 at 11:42
  • 2
    I think you might be asking this in the wrong place. You're asking for a general algorithm to solve second order differential equations, which is it's own whole ball of issues in mathematics. I would recommend asking for help in the mathematics section of stack exchange. – Jake Conkerton-Darby Aug 01 '17 at 11:54
  • @JakeConkerton-Darby, you are right! – Archimedes Aug 01 '17 at 12:43
  • If you're open to R, try the [`deSolve`](https://cran.r-project.org/web/packages/deSolve/index.html) and [`ReacTran`](https://cran.r-project.org/web/packages/ReacTran/index.html) packages. – Dan Aug 02 '17 at 17:17
  • @Lyngbakr, I would like to explore them in due time. At this moment, my knowledge of programming language is limited to Python and Mathematica! – Archimedes Aug 02 '17 at 19:47
  • In the case where Mathematica fails, can you find out $A(x)$ and $y''(x)$ around $x=d$? There might be a genuine singularity. -- As another idea, take the derivative of this equation to get the highest derivative in degree one so that the usual approach to solving works. – Lutz Lehmann Aug 03 '17 at 19:32
  • @LutzL, thanks for the idea. But I don't get how plot of $A(x)$ and $y''(x)$ will tell me about the singularity. Can you please elaborate. Maybe in an answer. – Archimedes Aug 03 '17 at 20:04

1 Answers1

0

I believe that "Newmarks Method" is an applicalbe method for numerical integration of second order ODE's.

https://en.wikipedia.org/wiki/Newmark-beta_method

FooAnon
  • 566
  • 1
  • 4
  • 11