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 the following differential equation:

delta = -(1/r D[#, r] + D[#, {r, 2}] - # l^2/r^2) &;
DSolve[delta[
    g[r]] + (B l + B^2 r^2/4) g[r] == en g[
    r], g[r], r]

The solution proposed by Mathematica is okay yet one can find an alternative, less complex representation with Whittaker functions. Is it possible to force Mathematica to use a certain type of function as a solution of a differential equation? We do not impose any boundary conditions.

In this specific problem one can always use a transformation rule for the confluent hypergeometric function, for instance

rule = HypergeometricU[a_, b_, z_] -> 
  E^(z/2) z^(-b/2) WhittakerW[b/2 - a, (b - 1)/2, z];

but this is just a workaround. Perhaps there is a more elegant way.

Edit

For instance, consider the harmonic oscillator equation

DSolve[-y''[x] == y[x], y[x], x]
{{y[x] -> C[1] Cos[x] + C[2] Sin[x]}}

Is it possible to force a solution with exponential functions? Of course, the replacement rule can be used but perhaps there is a deeper solution.

{{y[x] -> C[1] Exp[I x] + C[2] Exp[-I x]}}

It would be great if Mathematica could provide a list of exemplary solutions (but this is just wishful thinking:-).

share|improve this question
1  
Side comment: even FullSimplify[DSolve[…], TransformationFunctions -> {Automatic, # /. rule &}] doesn't return solution with WhittakkerW. (Though I personally don't have any experience with this option.) –  Akater May 8 at 15:49
    
Righ, this doesn't work (sorry, I have no time to check why, gotta go in a sec). If you tried applying my rule to the output of DSolve, then there should be a substitution. –  Gregory Rut May 8 at 16:20
1  
@GregoryRut This might be an interesting question, however you should explain more clearly what you expect to get. This rule works fine and it might be easily demeonstrated that's true, however the system finds a combination of LaguerreL and WhittakerW more complicated than combnations of hypergeometric functions with Pochhammer. –  Artes May 8 at 16:31
1  
@GregoryRut You still haven't posed precisely your question. Appropriate initial condition in principle can provide an adequate function (solution). However if you don't want specify initial conditions you could evaluate e.g. Collect[TrigToExp[C[1] Cos[x] + C[2] Sin[x]], E^(I x)], but in general it depends on case by case basis. –  Artes May 9 at 10:45
1  
AFAIK there is no way to specify preferred functions for the output of DSolve. Your "workaround" of explicitly applying the desired transformation rule is probably the best solution. –  Simon Woods May 9 at 12:43

1 Answer 1

I am not sure if this would be what you want, but using ComplexityFunction well as TransformationFunctioncan get you somewhere.

cf[expr_] := 100 Count[expr, _HypergeometricU, {0, Infinity}] + LeafCount[expr]
tf[expr_] := expr /. HypergeometricU[a_, b_, z_] :>
              E^(z/2) z^(-b/2) WhittakerW[b/2 - a, (b - 1)/2, z]

FullSimplify[sol, ComplexityFunction -> cf, 
 TransformationFunctions -> {Automatic, tf}]

(* (2^(l/2) (r^2)^((
 1 + l)/2) (Sqrt[2] E^((B r^2)/4)
     C[2] LaguerreL[-((B + en)/(2 B)), l, -((B r^2)/2)] + 
   2^((2 + l)/2) (-B r^2)^(1/2 (-1 - l))
     C[1] WhittakerW[1/2 (-(en/B) + l), l/2, -((B r^2)/2)]))/r *)

You need to make HypergeometricU[a,b,z] more "complex" than E^(z/2) z^(-b/2) WhittakerW[b/2 - a, (b - 1)/2, z] in order to force FullSimplify to consider "moving" in that direction.

share|improve this answer

Your Answer

 
discard

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.