6
$\begingroup$

Bug introduced in version 11.0 and fixed in 11.1.


Consider the following reduced example:

test[r_, n_] = LaguerreL[n, 1/2, r^2];
FunctionExpand[f''[r] /. f -> Function[r, test[r, 0]]]

(2 r^2 Removed[ "$$Failure"] (4/(3 Sqrt[π]) + ( E^r^2 (-(3/2) + r^2) (1 - ( 4 ((E^-r^2 ((3 r^2)/2 + r^4))/Sqrt[r^2] + 3/4 Sqrt[π] (1 - (Sqrt[r^2] Erf[r])/r)))/( 3 Sqrt[π])))/(r^2)^(5/2)))/Sqrt[π]

Note the Removed[ "$$Failure"] term in the answer. This appears to result from attempt to FunctionExpand a term of LaguerreL[-2, 1/2, x]. But how does this term even appear in the first place? A simple change of the above code yields me 0:

FunctionExpand[f''[r] /. f -> Function[r, Evaluate@test[r, 0]]]

0

So it seems test isn't evaluated in original example, but is somehow differentiated... What's happening here?

$\endgroup$
7
  • $\begingroup$ I don't get any error when running your code (v10.0.1); it seems to work for me (well, it returns 0; i'm not sure if it's supposed to). Have you tried quitting the kernel? $\endgroup$
    – march
    Commented Nov 3, 2016 at 20:46
  • $\begingroup$ @march Even starting new Mathematica instance still gives me this result. I'm using v11.0. It does appear to work in versions 7 through 10. $\endgroup$
    – Ruslan
    Commented Nov 3, 2016 at 21:01
  • $\begingroup$ Strikes me as a bug then. $\endgroup$
    – march
    Commented Nov 3, 2016 at 21:33
  • $\begingroup$ No error under 10.4.1 for Linux x86 (64-bit). $\endgroup$
    – corey979
    Commented Nov 3, 2016 at 21:47
  • 1
    $\begingroup$ @bgodfrey et al This has been reported and will be fixed in a future release (quite likely the next one). $\endgroup$ Commented Nov 7, 2016 at 15:42

1 Answer 1

3
$\begingroup$

The problem here can be traced to an error in evaluating Pochhammer[-1, a], with a a rational (i.e., infinite precision) number. To begin, determine

f''[r] /. f -> Function[r, LaguerreL[0, 1/2, r^2]]
(* 4 r^2 LaguerreL[-2, 5/2, r^2] - 2 LaguerreL[-1, 3/2, r^2] *)

The second term, proportional to LaguerreL[-1, 3/2, r^2], is identically 0, as can be seen by applying FunctionExpand[] or FullSimplify[] to it. So, focus on LaguerreL[-2, 5/2, r^2], and replace 5/2 by a for now.

FunctionExpand[LaguerreL[-2, a, r^2]] // Simplify
(* ((r^2)^-a ((r^2)^a + E^r^2 (1 - a + r^2) Gamma[a] - 
   E^r^2 (1 - a + r^2) Gamma[a, r^2]) Pochhammer[-1, a])/Gamma[a] *)

which is proportional to Pochhammer[-1, a], and

Pochhammer[-1, 5/2]
(* Removed["$$Failure"]/(2 Sqrt[π]) *)

In fact, every rational number I have tried for a yields a result containing Removed["$$Failure"]. On the other hand,

Pochhammer[-1, 2.5]
(* -3.45466*10^-17 *)

and

Pochhammer[-1, SetPrecision[2.5, 30]]
(* 0.*10^-30 *)

Evidently, Pochhammer[-1, a] should be identically 0. As noted by Daniel Lichtblau, this bug is new to version 11. In 10.4.1, Pochhammer[-1, 5/2] evaluates to 0.

Incidentally, FunctionExpand[f''[r] /. f -> Function[r, Evaluate@test[r, 0]]] yields 0, as noted in the question, because Evaluate@test[r, 0] is identically 1, as it should be.

$\endgroup$
2
  • $\begingroup$ So, how I understand it: in the error case LaguerreL is never evaluated before being differentiated, and then, still unevaluated, it's expanded by FunctionExpand, and only then the evaluation takes place. This lets the problem with Pochhammer appear visible. Is my understanding correct? $\endgroup$
    – Ruslan
    Commented Nov 7, 2016 at 16:59
  • $\begingroup$ @Ruslan Apparently so. $\endgroup$
    – bbgodfrey
    Commented Nov 7, 2016 at 17:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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