# Elliptic functions of complex argument

**URL:** <https://discourse.julialang.org/t/elliptic-functions-of-complex-argument/51876>\
**Category:** Numerics\
**Created:** [December 15, 2020, 2:48pm UTC](https://discourse.julialang.org/t/elliptic-functions-of-complex-argument/51876 "2020-12-15T14:48:34Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gregstrq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gregstrq/32/20620_2.png) [@Gregstrq](https://discourse.julialang.org/u/Gregstrq)\
**Post date:** [December 15, 2020, 2:48pm UTC](https://discourse.julialang.org/t/elliptic-functions-of-complex-argument/51876/1 "2020-12-15T14:48:34Z")

</div>

Does anyone know a good package where Elliptic functions are implemented for complex values of the argument? May be some C or Fortran package that can be easily called from Julia?

I know that there is the package [Elliptic](https://github.com/nolta/Elliptic.jl/), however the elliptic functions there are defined only for real arguments.

---

<div class="post-metadata">

**Author:** ![dlfivefifty](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dlfivefifty/32/1959_2.png) [@dlfivefifty](https://discourse.julialang.org/u/dlfivefifty)\
**Post date:** [December 15, 2020, 3:05pm UTC](https://discourse.julialang.org/t/elliptic-functions-of-complex-argument/51876/2 "2020-12-15T15:05:00Z")

</div>

It’s not quite what you want but you can compute elliptic _integrals_ in the complex plane:

[https://github.com/JuliaApproximation/SingularIntegralEquations.jl/blob/master/examples/ellipticintegral.jl](https://github.com/JuliaApproximation/SingularIntegralEquations.jl/blob/master/examples/ellipticintegral.jl)

Keen to hear about elliptic functions. DLMF suggests using theta functions:

[https://dlmf.nist.gov/22.20](https://dlmf.nist.gov/22.20)

---

<div class="post-metadata">

**Author:** ![Gregstrq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gregstrq/32/20620_2.png) [@Gregstrq](https://discourse.julialang.org/u/Gregstrq)\
**Post date:** [December 15, 2020, 3:23pm UTC](https://discourse.julialang.org/t/elliptic-functions-of-complex-argument/51876/3 "2020-12-15T15:23:29Z")

</div>

It seems that there is an opened [PR](https://github.com/JuliaMath/SpecialFunctions.jl/pull/79) in [SpecialFunctions](https://github.com/JuliaMath/SpecialFunctions.jl) which deals with this problem but for some obscure reason is not merged yet.

---

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [December 15, 2020, 3:40pm UTC](https://discourse.julialang.org/t/elliptic-functions-of-complex-argument/51876/4 "2020-12-15T15:40:48Z")

</div>

See ArbNumerics.jl

---

<div class="post-metadata">

**Author:** ![Gregstrq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gregstrq/32/20620_2.png) [@Gregstrq](https://discourse.julialang.org/u/Gregstrq)\
**Post date:** [December 15, 2020, 3:52pm UTC](https://discourse.julialang.org/t/elliptic-functions-of-complex-argument/51876/5 "2020-12-15T15:52:57Z")

</div>

Interesting. The problem is that I need Jacobi elliptic functions, and the package exports only Weierstrass elliptic function. I know that you can express Jacobi elliptic functions in terms of Weierstrass function, however, I am not sure this is the most efficient way from the computational standpoint.

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [December 15, 2020, 4:00pm UTC](https://discourse.julialang.org/t/elliptic-functions-of-complex-argument/51876/6 "2020-12-15T16:00:25Z")

</div>

> [@Gregstrq](#):
>
> It seems that there is an opened [PR](https://github.com/JuliaMath/SpecialFunctions.jl/pull/79) in [SpecialFunctions](https://github.com/JuliaMath/SpecialFunctions.jl) which deals with this problem but for some obscure reason is not merged yet.

In general PRs don’t get merged when there are open review comments that haven’t been addressed…

---

<div class="post-metadata">

**Author:** ![dlfivefifty](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dlfivefifty/32/1959_2.png) [@dlfivefifty](https://discourse.julialang.org/u/dlfivefifty)\
**Post date:** [December 15, 2020, 10:41pm UTC](https://discourse.julialang.org/t/elliptic-functions-of-complex-argument/51876/7 "2020-12-15T22:41:48Z")

</div>

Expanding on that: SpecialFunctions.jl gets a lot of half-baked PRs, and it’s a package with no specific “owner”, many people have merge permission but I don’t think anyone feels confident in merging a PR. Unless it’s 💯 . And it’s not clear that it should be home to all special functions.

So a better thing to do is move that PR to its own package EllipticFunctions.jl

---

<div class="post-metadata">

**Author:** ![ettersi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ettersi/32/6829_2.png) [@ettersi](https://discourse.julialang.org/u/ettersi)\
**Post date:** [December 16, 2020, 4:02pm UTC](https://discourse.julialang.org/t/elliptic-functions-of-complex-argument/51876/8 "2020-12-16T16:02:35Z")

</div>

The history of the aforementioned PR is as follows: I needed the Jacobi elliptic functions for a project but couldn’t find a suitable Julia package, so I decided to implement them myself and was hoping to make my code available to as wide an audience as possible by getting it into SpecialFunctions.jl. @simonbyrne then pointed out a number of issues in my code (thanks again for that, I learnt a lot!), and I believe all but the ones mentioned in [this comment](https://github.com/JuliaMath/SpecialFunctions.jl/pull/79#issuecomment-659298500) have been resolved. I’d be happy to give a hand resolving the remaining issues, but I no longer need these elliptic functions myself and so I had a hard time finding a justification for spending more time on this. Also, some of the remaining issues require community consensus.

I’m indifferent whether the final code ends up in SpecialFunctions.jl or a separate package, but I do hope that whatever solution we pick can merge the various Julia implementations of elliptic functions into a single package. For reference, these are the three codes that I am aware of:

- [https://github.com/JuliaMath/SpecialFunctions.jl/pull/135/](https://github.com/JuliaMath/SpecialFunctions.jl/pull/135/) by @Sumegh-git
- [https://github.com/nolta/Elliptic.jl](https://github.com/nolta/Elliptic.jl) by @nolta
- [https://github.com/JuliaMath/SpecialFunctions.jl/pull/79](https://github.com/JuliaMath/SpecialFunctions.jl/pull/79) by myself

---

<div class="post-metadata">

**Author:** ![PeterSimon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petersimon/32/25193_2.png) [@PeterSimon](https://discourse.julialang.org/u/PeterSimon)\
**Post date:** [May 23, 2023, 8:42pm UTC](https://discourse.julialang.org/t/elliptic-functions-of-complex-argument/51876/9 "2023-05-23T20:42:52Z")

</div>

For people finding this topic, there is now [GitHub - stla/EllipticFunctions.jl: Jacobi theta functions](https://github.com/stla/EllipticFunctions.jl) which has extensive coverage of Jacobi elliptic functions and related functions and which allows complex arguments. It is not (yet) in the general registry.
