5
$\begingroup$

I am using Mathematica 11.0.1.0. I have the following simple code

ClearAll["Global`*"]

L[f_] := Laplacian[f, {r, \[Theta], z}, "Cylindrical"]

B[f_] := Laplacian[
  Laplacian[f, {r, \[Theta], z}, "Cylindrical"], {r, \[Theta], z}, 
  "Cylindrical"]

f = Subscript[A, 1] z^3 + 
    Inactive[Sum][(Subscript[P, i] Sinh[Subscript[\[Alpha], i] z] + 
    Subscript[Q, i] z Cosh[Subscript[\[Alpha], i] z]) BesselJ[0, 
    Subscript[\[Alpha], i] r], {i, 1, n}]

L[f]

(* 6 z Subscript[A, 1] *)

B[f]

(* 0 *)

The result that Mathematica is giving for the Laplacian is wrong. The true answer is

$$ 6A_1z + \sum_{i=1}^{n}2 Q_i \alpha_i \sinh(\alpha_iz) J_0(\alpha_i r)$$

However, when I remove the sum the true result can be obtained

f = Subscript[A, 1] z^3 + (Subscript[P, i] Sinh[Subscript[\[Alpha], i] z] + 
    Subscript[Q, i] z Cosh[Subscript[\[Alpha], i] z]) BesselJ[0, 
    Subscript[\[Alpha], i] r]

L[f] // FunctionExpand

(* 6 z Subscript[A, 1] + 
2 BesselJ[0, r Subscript[\[Alpha], i]] Sinh[
z Subscript[\[Alpha], i]] Subscript[Q, i] Subscript[\[Alpha], i] *)

B[f] // FunctionExpand

(* 0 *)

Can anyone help me with this and say what is going on here?

$\endgroup$
9
  • 2
    $\begingroup$ Can't reproduce your results in 11.1. However, it spits out some complicated outputs along with some error messages. I'm able to get the correct answers (not fully simplified) by replacing Inactive[Sum] with Sum. $\endgroup$ – W.Mason Mar 27 '17 at 12:29
  • $\begingroup$ I would suggest not using Sum at all. $\endgroup$ – W.Mason Mar 27 '17 at 13:01
  • $\begingroup$ @W.Mason: I am using 11.0 so I should do some updates maybe! :) $\endgroup$ – Hosein Rahnama Mar 27 '17 at 13:08
  • $\begingroup$ @W.Mason: See the updated question. I figured it out that how to obtain the correct result. It seems to be a bug in Mathematica 11! $\endgroup$ – Hosein Rahnama Mar 27 '17 at 13:52
  • $\begingroup$ Well, of course it works when you remove the Sum. It could be a bug with Inactive[Sum] in Mathematica, but Sum alone in 11.1 works OK (hard to simplify the answer unless I remove Sum). I think Sum should altogether be avoided in such calculations, at least until these problems are fixed. $\endgroup$ – W.Mason Mar 27 '17 at 14:22
6
$\begingroup$

This is a bug, plain and simple. If you use Sum instead of Inactive[Sum], it works in both 11.0 and 11.1.

I'm pretty sure I know what was the bug in 11.0 and that I fixed that particular bug in 11.1. Unfortunately, there now seems to be a bad interaction with our new indexed-differentiation code which is producing a different wrong answer in 11.1. I will investigate and try to fix this for 11.2. If I come up with any more general workarounds, I will post them here.

$\endgroup$
1
  • $\begingroup$ (+1) Thanks for the attention. :) I reported this bug. :) $\endgroup$ – Hosein Rahnama Apr 3 '17 at 19:54

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.