# How to take derivative of complex functions like Weierstrass Elliptic function?

**URL:** <https://discourse.julialang.org/t/how-to-take-derivative-of-complex-functions-like-weierstrass-elliptic-function/132591>\
**Category:** Specific Domains\
**Tags:** math\
**Created:** [September 23, 2025, 8:11am UTC](https://discourse.julialang.org/t/how-to-take-derivative-of-complex-functions-like-weierstrass-elliptic-function/132591 "2025-09-23T08:11:36Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![MathJulia](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mathjulia/32/224167_2.png) [@MathJulia](https://discourse.julialang.org/u/MathJulia)\
**Post date:** [September 23, 2025, 8:11am UTC](https://discourse.julialang.org/t/how-to-take-derivative-of-complex-functions-like-weierstrass-elliptic-function/132591/1 "2025-09-23T08:11:36Z")

</div>

I want to use Elliptic and modular functions as activation functions in neural networks. What packages should I use? I can’t install EllipticFunctions.jl because it returns error.  
How could I apply chain rule to optimize them.

---

<div class="post-metadata">

**Author:** ![empet](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/empet/32/221303_2.png) [@empet](https://discourse.julialang.org/u/empet)\
**Post date:** [September 23, 2025, 9:28am UTC](https://discourse.julialang.org/t/how-to-take-derivative-of-complex-functions-like-weierstrass-elliptic-function/132591/2 "2025-09-23T09:28:50Z")

</div>

Unfortunately, the author of the EllipticFunctions.jl package (stla, Stéphane Laurent) died in August 2024 and the package has not been updated to work with the latest Julia versions.

---

<div class="post-metadata">

**Author:** ![MathJulia](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mathjulia/32/224167_2.png) [@MathJulia](https://discourse.julialang.org/u/MathJulia)\
**Post date:** [September 23, 2025, 10:53am UTC](https://discourse.julialang.org/t/how-to-take-derivative-of-complex-functions-like-weierstrass-elliptic-function/132591/3 "2025-09-23T10:53:02Z")

</div>

Sorry. I didn’t know that. Is there any other package that I could use?

---

<div class="post-metadata">

**Author:** ![Oscar\_Smith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oscar_smith/32/25343_2.png) [@Oscar\_Smith](https://discourse.julialang.org/u/Oscar_Smith)\
**Post date:** [September 23, 2025, 1:35pm UTC](https://discourse.julialang.org/t/how-to-take-derivative-of-complex-functions-like-weierstrass-elliptic-function/132591/4 "2025-09-23T13:35:15Z")

</div>

What error are you seeing? It seems to work fine for me… It may not have been updated since 2024, but there shouldn’t be any updates required to work on newer Julia versions.

That said, we should probably move the repository to JuliaMath so it can receive bug fixes as needed.

---

<div class="post-metadata">

**Author:** ![empet](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/empet/32/221303_2.png) [@empet](https://discourse.julialang.org/u/empet)\
**Post date:** [September 23, 2025, 2:06pm UTC](https://discourse.julialang.org/t/how-to-take-derivative-of-complex-functions-like-weierstrass-elliptic-function/132591/5 "2025-09-23T14:06:14Z")

</div>

The OP said that EllipticFunctions.jl cannot be installed. I didn’t test it.

---

<div class="post-metadata">

**Author:** ![MathJulia](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mathjulia/32/224167_2.png) [@MathJulia](https://discourse.julialang.org/u/MathJulia)\
**Post date:** [September 23, 2025, 5:48pm UTC](https://discourse.julialang.org/t/how-to-take-derivative-of-complex-functions-like-weierstrass-elliptic-function/132591/6 "2025-09-23T17:48:34Z")

</div>

Thanks. I tried to isolate EllipticFunctions.jl from Bukdu.jl and solved my problem.

```julia-auto
julia> gradient(x -> real(thetaC(x, tau=0.5 + 1im)), 1.0)
(-0.8061618539015968,)

julia> gradient(x -> real(thetaC(x, tau=0.5 + 1im)), 0.5)
(-0.4433516470405768,)

```

I’m also greatful for Laurent’s incredible library.
