# Kernel crash solving ODE (Murphy #50), version 11.0.1 on windows

This ODE (#50 from Murphy's ODE collection book) causes kernel crash each time

Here is the code

ClearAll[y, x]
DSolve[ y'[x] == Cos[2 x] + (Sin[2 x] + y[x]) y[x], y[x], x]


Screen shot below. Should this be tagged a bug? Does this happen on other platforms? I am using windows 7. I tried it on 10.4, and it also crashes there.

But on version 9.0, it does not crash, but it can't solve it:

Maple can solve it, but solution is complicated using HeunC special functions which Mathematica do not have

But Book also gives one simple solution y(x)=tan(x), which is easily verified to be true by Mathematica. (the other solution it gives is little more complicated).

eq = Hold [D[y[x], x] == Cos[2 x] + (Sin[2 x] + y[x]) y[x]];
Simplify[ReleaseHold[eq /. y[x] -> Tan[x]]]


Why does Mathematica kernel crash on this ODE?

Update:

Send bug report to Wolfram support, CASE:3806616 .

fyi, the book contains 2315 ODE's, which will take me long time to type and run. The current test report if you are interested is here. But it currently contains small number of ODE's from the book, will add more with time.

• Linux v11, get's stuck, but doesn't crash. – Feyre Dec 23 '16 at 20:21
• The code crashes v10.3.1 and v11.0.0, both on Windows 64-bit – JungHwan Min Dec 23 '16 at 20:44
• @Feyre what do you mean by 'stuck'? No solution or evaluation taking too long? For me, the code seems to crash the kernel 2-3 minutes after its evaluation. – JungHwan Min Dec 23 '16 at 20:46
• @JungHwanMin I let it run for 10m, without result, I'm considering letting it run for an hour just to see if anything happens. It should be noted I have 16gb of RAM, which is still more than most today, which might have to do with it. – Feyre Dec 23 '16 at 20:56
• I would go head and send a report to support@wolfram.com so that they can investigate and look address this. – user6014 Dec 23 '16 at 21:22

## 1 Answer

A bit too long for a comment. I think the hang is happening within Integrate:

Block[{Integrate},
DSolve[y'[x] == Cos[2 x] + (Sin[2 x] + y[x]) y[x], y[x], x] /. {
Integrate -> Inactive[Integrate]}
]


# Edit

Here's the solution using withTimedIntegrate (as Micheal E2 pointed out in the comments):

withTimedIntegrate[DSolve[y'[x] == Cos[2 x] + (Sin[2 x] + y[x]) y[x], y[x], x], 1]


And just for fun, here's a way to solve this ODE:

• Substitute y[x] == v'[x]/v[x] to get

v''[x] - Sin[2x]v'[x] + Cos[2x]v[x] == 0

• Next substitute Cos[x] == t to get

(t^2 - 1)v''[t] + (2t^3 - t)v'[t] + (1 - 2t^2)v[t] == 0

• Then substitute v[t] == t w[t] to get

t(t^2 - 1)w''[t] + (2t^4 + t^2 - 2)w'[t] == 0

• Substitute f[t] = w'[t] to get the first order separable equation

t(t^2 - 1)f'[t] + (2t^4 + t^2 - 2)f[t] == 0

• This equation is easily solved, and the solution is

{{f[t] -> (E^-t^2 C[1])/(t^2 Sqrt[1 - t^2])}}

• One can then perform all the back substitutions to get the final answer, which is where some nasty integrals will come into play.

• "This equation is easily solved", MMA doesn't seem to think so. – Feyre Dec 23 '16 at 22:08
• withTimedIntegrate[DSolve[..], 1] gives a slightly nicer result, with only the intractable integral left in the answer. (+1) – Michael E2 Dec 23 '16 at 22:16
• @Feyre I should've tested before I said that... MMA get's tripped up on a hard integral. I've edited my post to get to a solution that is easier to solve. – Chip Hurst Dec 23 '16 at 22:26
• @MichaelE2, thanks for pointing me to withTimedIntegrate! – Chip Hurst Dec 23 '16 at 22:27