0
$\begingroup$

I want to solve the following differential equation:

eq=N*D[q[x],{x,2}]-(6x-x^2)*D[q[x],{x,1}]-s*q[x]==-1
DSolve[eq, q[x],x] 

But I get no solution. If I change the (6x-x^2) coefficient by 6x or 6/x I get a solution, so I was wondering if Mathematica cannot solve this or if there is no closed form solution at all.

Thanks in advance!

$\endgroup$
6
  • $\begingroup$ Maple 2021 can solve.Solution by HeunT function. $\endgroup$ May 6 at 13:46
  • $\begingroup$ There is a solution in V12.2. Note N is a protected symbol, which should not be used as a variable/parameter. (See #4 mathematica.stackexchange.com/a/18395) $\endgroup$
    – Michael E2
    May 6 at 13:51
  • $\begingroup$ In fact, Methematica 12.2 returns the input. Maple 2021 answers $$ q\! \left(x\right)=\mathrm{HeunT}\! \left(-\frac{3^{\frac{2}{3}} s}{n^{\frac{1}{3}}},3,-\frac{9 \,3^{\frac{1}{3}}}{n^{\frac{2}{3}}},-\frac{3^{\frac{2}{3}} \left(x-3\right)}{3 n^{\frac{1}{3}}}\right) \textit{_}\mathit{C2}+{\mathrm e}^{-\frac{x^{2} \left(x-9\right)}{3 n}} \mathrm{HeunT}\! \left(-\frac{3^{\frac{2}{3}} s}{n^{\frac{1}{3}}},-3,-\frac{9 \,3^{\frac{1}{3}}}{n^{\frac{2}{3}}},\frac{3^{\frac{2}{3}} \left(x-3\right)}{3 n^{\frac{1}{3}}}\right) \textit{_}\mathit{C1}+\frac{1}{s}$$, but $\endgroup$
    – user64494
    May 6 at 13:57
  • $\begingroup$ the HeunT function is a special function for the notation of the solutions of certain ODEs. $\endgroup$
    – user64494
    May 6 at 14:00
  • $\begingroup$ In fact, V12.2.0.0/MacOS returns a (somewhat obvious) differential root (from a fresh kernel). Seems to me that should happen in earlier versions, at least recent ones. I get the same in V12.0.0.0, too. I cannot test earlier versions. $\endgroup$
    – Michael E2
    May 6 at 14:11
1
$\begingroup$
$Version

(* "12.2.0 for Mac OS X x86 (64-bit) (December 12, 2020)" *)

Clear["Global`*"]

eqn = {
   n*q''[x] - (6 x - x^2)*q'[x] - s*q[x] == -1,
   q[0] == q0, q'[0] == qp0};

The solution is given as a DifferentialRoot

(sol[q0_, qp0_, n_, s_] = DSolve[eqn, q, x][[1]])

enter image description here

% // InputForm

enter image description here

To numerically evaluate the solution, the initial conditions and all variables must be given values:

(q[1.0] /. sol[0, 1, 2, 1/2])

(* 1.37193 *)

Or using ParametricNDSolve for a numeric solution

soln = ParametricNDSolve[eqn, q, {x, 0, 2},
  {q0, qp0, n, s}]

q[0, 1, 2, 1/2][1.0] /. soln

(* 1.37193 *)

Manipulate[
 Plot3D[
  Evaluate[q[q0, qp0, 2, s][x] /. soln],
  {x, 0, 2}, {n, -3, 3},
  AxesLabel -> (Style[#, 12, Bold] & /@ {x, n, q})],
 {{q0, 0, "q[0]"}, -1, 1, 0.05,
  Appearance -> "Labeled"},
 {{qp0, 0.35, "q'[0]"}, -1, 1, 0.05,
  Appearance -> "Labeled"},
 {{s, 0.5}, -5, 5, 0.5,
  Appearance -> "Labeled"}]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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