Calculus tells us that the differentiation of the integral of a function should be itself, but at least in one case Mathematica answers NO. I feel very confused. The new figure seems to bifurcate at one real root downward.
The story is that I try to integrate a function including a Jacobi elliptic function, then the strange thing happens. When I plot the figure of the integral, I found the slope sign does not agree with the sign of the integrand, that is, the original function. I cannot figure out what is wrong with Mathematica or if there is something tricky about elliptic functions and elliptic integrals? The original function and its integral by Mathematica software are shown as follows:
$$\text{mini}(m)= x_1 + \frac{x_2-x_1}{1-\frac{x_2-x_4}{x_1-x_4}\text{sn}^2\left[\frac{m-m_b}{\xi},k\right]}.$$ where $\xi=\frac{4}{i\sqrt{\left(x_2-x_3\right)\left(x_1-x_4\right)}}$ and the Jacobi modulus $m=k^2=\frac{\left(x_1-x_3\right)\left(x_2-x_4\right)}{\left(x_2-x_3\right)\left(x_1-x_4\right)}$, where $x_1=-2.73205$, $x_2=0.732051$, $x_3=1 - i$ and $x_4=1+i$. The constant $m_b$ can be calculated as $m_b=\xi F\left[i \text{arcsinh}\left(\sqrt{-\frac{(0.5 - x_2)(x_1 - x_4)}{(0.5 - x_1)(x_2 - x_4)}}\right),k\right]=0.988254$. Now we can plot the figure for the function $\text{mini}(m)$ with $-10<m<10$ as follows:
$$\int \text{mini}(m) \ \text{d}m = x_1 m - \frac{\xi\left(x_1-x_2\right)\Pi\left[n,\frac{m-m_b}{\xi},k\right]\text{dn}\left[\frac{m-m_b}{\xi},k\right]}{\sqrt{1-k^2\text{sn}^2\left[\frac{m-m_b}{\xi},k\right]}}.$$ where the elliptic characteristic $n=\frac{x_2-x_4}{x_1-x_4}$. Now we can plot the figure for the integral of the function $\text{mini}(m)$ with $-10<m<10$ as follows:
After calculating the numerical differentiation and plotting the figure by Mathematica, the figure shown below is not consistent with the original funcion $\text{mini}(m)$. But this third figure is consistent with the figure of the second one. It seems to show that Mathematica failed to calculate the correct integral of the original function $\text{mini}(m)$.
For the reference, my Mathematica code is attached as follows:
mini[m_] := (x1 x2 - x2 x4 - x1 x2 JacobiSN[1/4 I (m - mb) Sqrt[(x2 - x3) (x1 - x4)], ((x1 - x3) (x2 - x4))/((x2 - x3) (x1 - x4))]^2 + x1 x4 JacobiSN[
1/4 I (m - mb) Sqrt[(x2 - x3) (x1 - x4)], ((x1 - x3) (x2 - x4))/((x2 - x3) (x1 - x4))]^2)/((-x2 + x4) (-(x1/(x2 - x4)) + x4/(x2 - x4) + JacobiSN[1/4 I (m - mb) Sqrt[(x2 - x3) (x1 - x4)], ((x1 - x3) (x2 - x4))/((x2 - x3) (x1 - x4))]^2))
intmini[m_] := Integrate[mini[m], m]
intmini[m]
x1 = Root[#1^4 - 4*#1^2/1 + 8*#1/1 - 8*0.5 &, 1]
x2 = Root[#1^4 - 4*#1^2/1 + 8*#1/1 - 8*0.5 &, 2]
x3 = Root[#1^4 - 4*#1^2/1 + 8*#1/1 - 8*0.5 &, 3]
x4 = Root[#1^4 - 4*#1^2/1 + 8*#1/1 - 8*0.5 &, 4]
mb = -((4 I EllipticF[I*ArcSinh[Sqrt[-(((0.5 - x2)*(x1 - x4))/((0.5 - x1)*(x2 - x4)))]], ((x1 - x3)*(x2 - x4))/((x2 - x3)*(x1 - x4))])/Sqrt[(x2 - x3)*(x1 - x4)])
Plot[Re[mini[m]], {m, -10, 10}]
Plot[(m - mb) x1 + (4 I (x1 - x2) EllipticPi[(x2 - x4)/(x1 - x4), JacobiAmplitude[1/4 I (m - mb) Sqrt[(x2 - x3) (x1 - x4)], ((x1 - x3) (x2 - x4))/((x2 - x3) (x1 - x4))], ((x1 - x3) (x2 - x4))/((x2 - x3) (x1 - x4))] JacobiDN[1/4 I (m - mb) Sqrt[(x2 - x3) (x1 - x4)], ((x1 - x3) (x2 - x4))/((x2 - x3) (x1 - x4))])/(Sqrt[(x2 - x3) (x1 - x4)] Sqrt[1 + ((x1 - x3) (x2 - x4) JacobiSN[1/4 I (m - mb) Sqrt[(x2 - x3) (x1 - x4)], ((x1 - x3) (x2 - x4))/((x2 - x3) (x1 - x4))]^2)/((-x2 + x3) (x1 - x4))]), {m, -10, 10}]
Needs["NumericalCalculus`"]
Plot[Re[ND[(m - mb) x1 + (4 I (x1 - x2) EllipticPi[(x2 - x4)/(x1 - x4), JacobiAmplitude[1/4 I (m - mb) Sqrt[(x2 - x3) (x1 - x4)], ((x1 - x3) (x2 - x4))/((x2 - x3) (x1 - x4))], ((x1 - x3) (x2 - x4))/((x2 - x3) (x1 - x4))] JacobiDN[1/4 I (m - mb) Sqrt[(x2 - x3) (x1 - x4)], ((x1 - x3) (x2 - x4))/((x2 - x3) (x1 - x4))])/(Sqrt[(x2 - x3) (x1 - x4)] Sqrt[1 + ((x1 - x3) (x2 - x4) JacobiSN[1/4 I (m - mb) Sqrt[(x2 - x3) (x1 - x4)], ((x1 - x3) (x2 - x4))/((x2 - x3) (x1 - x4))]^2)/((-x2 + x3) (x1 - x4))]), m, p]], {p, -10, 10}]
Again, I would like to comment that the first plot is for the figure of the original function, that is, the integrand $\text{mini}(m)$. The second the plot is for the figure of its integral. The third one is for the figure of the differentiation of the integral. The third figure is expected to be the same as the first one, but it is different. The signs in the third figure agrees with the signs in the second figure of the integral. It seems to tell us that Mathematica gives a wrong integral for the function including elliptic functions, like the original function I used. I am not sure how to calculate a correct integral of my original function. Welcome any useful suggestions and helps in Math and Mathematica!
PS: I would like to add one additional comment. In my case here, the elliptic modulus m and Jacobi amplitude are both complex numbers, not real numbers. I am wondering if there is any general theory of elliptic functions and elliptic integrals beyond the real elliptic modulus and real Jacobi amplitude?