Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I am trying to solve a linear second order ODE using DSolve which involves an arbitrary integer m. DSolve gives me a solution when I set m to a particular integer (I have tried several, including negative/positive, even/odd, and 0). When I try to use the assumption m ∈ Integers and ask DSolve to solve this ODE for an arbitrary integer m, it does not work. Here is the input:

$Assumptions = m ∈ Integers
testk = 
  0 == -16 c m^2 Cos[x] k[x] - c (-7 Sin[x] + Sin[3x]) k'[x] 
       + Cos[x] Sin[x]^2 (m^2 (3 + 4 m Cos[x] + Cos[2 x]) Tan[x/2]^(2 m) + 4 c k''[x])

DSolve[ testk, k[x], x]
DSolve[ 0 == -16 c m^2 Cos[x] k[x] - c (-7 Sin[x] + Sin[3 x]) k'[x] 
              + Cos[x] Sin[x]^2 (m^2 (3 + 4 m Cos[x] + Cos[2 x]) Tan[x/2]^(2 m)
              + 4 c k''[x], k[x], x]

Update: I have realized that the problem is that DSolve does not apply any of the global assumptions. Does anyone know how I can make DSolve apply the assumption that m ∈ Integers? I have tried using Assuming[,] to set the assumptions locally but that did not work either.

share|improve this question
I do not think DSolve uses/accepts user assumptions. This was my understanding all along. Unless something changed in newer version of M. –  Nasser 9 hours ago

1 Answer 1

Not sure if this will help, but you can transform your ODE to have rational coefficients by subbing $t = \cos x$, which gives

$k'(x)=-\sqrt{1-t^2} k'(t), \quad k''(x)=(1-t^2)k''(t)-t k'(t), \;\; \text{ and } \;\; x=\cos ^{-1}(t)$:

testk=-16 c m^2 Cos[x] k[x]-c (-7 Sin[x]+Sin[3x]) k'[x]+Cos[x] Sin[x]^2 (m^2 (3+4 m Cos[x]+Cos[2 x]) Tan[x/2]^(2 m)+4 c k''[x]);


simped = Simplify[FunctionExpand[testk/.$fromTrig],-1<t<1&&m\[Element]Integers];

Collect[(1+t)^m PowerExpand[simped], {k[t],k'[t],k''[t]}]==0
-2 m^2 (1-t)^m t (-1+t^2) (1+2 m t+t^2)-16 c m^2 t (1+t)^m k[t] + 
  8 c (1+t)^m (-1+t^2) k'[t]+4 c t (1+t)^m (-1+t^2)^2 k''[t] == 0
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.