1
$\begingroup$

I want to plot the integral $$I(\phi) = \int_0^{\phi} \frac{\mathrm{d} \theta}{\sqrt{1 +\sin(\theta)^2}}$$

In Mathematica notation, it is a case of an elliptic integral of the first kind with $m=-1$,

$F(\phi| m) = \int_0^{\theta} \frac{\mathrm{d} \theta}{\sqrt{1-m \sin(\theta)^2}}$, so I have $I(\phi) = F(\phi| -1)$.

In Maple notation, it is a case of an elliptic integral of the first kind with $k = i$,

$F(\sin(\phi), k) = \int_0^{\theta} \frac{\mathrm{d} \theta}{\sqrt{1-k^2 \sin(\theta)^2}}$, so I have $I(\phi) = F(\sin(\phi), i)$.

Upon plotting $I(\phi)$ and $F(\phi| -1)$ in Mathematica I find perfect agreement.

Upon plotting $I(\phi)$ (in red) and $F(\sin(\phi), i)$ (in green) in Maple I get the result below:

Maple output

How can such a difference arise?

EDIT:

Code for Mathematica:

F1 = Integrate[1/Sqrt[1 + Sin[p]^2], {p, 0, phi}]
F2 = EllipticF[phi, -1]

Code for Maple:

F1:= int(1/sqrt(1+sin(theta)^2), theta=0..phi)
F2:= EllipticF(sin(phi), I)
$\endgroup$

closed as off-topic by Michael E2, QuantumDot, RunnyKine, MarcoB, user9660 Apr 18 '16 at 4:26

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question cannot be answered without additional information. Questions on problems in code must describe the specific problem and include valid code to reproduce it. Any data used for programming examples should be embedded in the question or code to generate the (fake) data must be included." – Michael E2, QuantumDot, RunnyKine, MarcoB, Community
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    $\begingroup$ People here generally like users to post code as Mathematica code instead of images or TeX, so they can copy-paste it. It makes it convenient for them and more likely you will get someone to help you. $\endgroup$ – user9660 Apr 17 '16 at 17:24
  • 1
    $\begingroup$ (1) It seems the question may be properly be about the behavior of Maple, which is off-topic on this site. (2) The green graph looks like Re@EllipticF[ArcSin[Sin@\[Theta]], I] -- as Louis implies, no one can be sure about the problem with your code, if you don't share it. $\endgroup$ – Michael E2 Apr 17 '16 at 17:41
  • $\begingroup$ I edited to give my code. Thanks for your help! $\endgroup$ – Nigel1 Apr 17 '16 at 17:53
  • 2
    $\begingroup$ I don't have/know Maple, but from the Maple doc. here, it seems that Maple's EllipticF[z, k] is equivalent to EllipticF[ArcSin[z], k^2] in Mathematica, in which case the problem is due to the periodicity of sine and the branch cuts of arc sine. $\endgroup$ – Michael E2 Apr 17 '16 at 18:26
  • 2
    $\begingroup$ The main problem, as Michael notes, is that Maple and Mathematica are using different argument conventions. In particular, Maple's EllipticF() is in fact directly equivalent to Mathematica's InverseJacobiSN[]. EllipticF[] uses a different argument convention, and is built so as not to have unneeded branch cuts. $\endgroup$ – J. M. is away Apr 20 '16 at 0:39
4
$\begingroup$

In Mathematica notation

$Assumptions = ϕ ∈ Reals

F[ϕ_, m_] := 
Integrate[1/Sqrt[1 - m Sin[θ]^2], {θ, 0, ϕ}]

Plot[F[ϕ, -1], {ϕ, - Pi,  π}, PlotStyle -> Red]

enter image description here

In Maple notation

F[\[Phi]_, k_] := 
Integrate[1/Sqrt[1 - k^2 Sin[\[Theta]]^2], {\[Theta], 0, \[Phi]}]

Plot[F[\[Phi], I], {\[Phi], -2 Pi, 2 \[Pi]}]

enter image description here

In maple

enter image description here

$\endgroup$
  • $\begingroup$ And when you plot $F(\sin(\phi),i)$ in Maple what do you get? I get the strange plot in the question. $\endgroup$ – Nigel1 Apr 17 '16 at 17:35
  • 1
    $\begingroup$ @Nigel1 same result, I edit my answer $\endgroup$ – vito Apr 17 '16 at 17:55
  • $\begingroup$ Thanks - but when you compare it to "built in" Maple EllipticK function with code: EllipticF(sin(phi), I) do you reproduce my plot in question or the Mathematica result? $\endgroup$ – Nigel1 Apr 17 '16 at 18:00

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