# Plotting the Jacobi Elliptic functions

I have a function

$$f(x) = a_2 + (a_3 - a_2)\text{cn}^2\left(\frac{\sqrt{a_3 - a_1}}{\sqrt2};m \right)$$

Where $$m$$ is the modulus, given by $$m = (a_3-a_2)/(a_3-a_1)$$.

How can I plot this function in Mathematica? I tried but can't get past an error.

m = (a3 - a2)/(a3 - a1)
f[a] = a2*(a3 - a2) JacobiCN[Sqrt[a3 - a1]/Sqrt, m];
Plot[f[a], {m, 0, 1}]

• Welcome to MSE. Please edit your question and add the code you have tried. Mar 10, 2022 at 21:31
• Welcome to Mathematica SE. To get started:1) take the introductory tour now,2) when you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge,3) remember to accept the answer, if any, that solves your problem, by clicking checkmark sign,4) give help too, by answering questions in your areas of expertise.
– user49048
Mar 10, 2022 at 21:32
• Please post the right code about your function f. Mar 11, 2022 at 0:57
• just passing by to stress that what @cvgmt asks is important
– user49048
Mar 11, 2022 at 1:52

Firstly you call something a function of $$x$$, $$f(x)$$, but there is no $$x$$-dependence.

The way to code your function is the following

f[a1_, a2_, a3_] :=
a2 + (a3 - a2) JacobiCN[Sqrt[(a3 - a1)/2], Mod[a3 - a2, a3 - a1]]^2


So, you have a function of the a1, a2 and a3. I am assuming the simple range 0 to 1 for all three of those.

In order to plot it for various values you can try the following:

Manipulate[
ContourPlot[f[a1, a2, a3], {a1, 0, 1}, {a2, 0, 1},
ColorFunction -> "Rainbow"], {a3, 0, 1}] Another way to plot is the following:

Plot3D[Evaluate@Table[f[a1, a2, a3], {a1, {0, 1, 0.1}}], {a2, 0,
1}, {a3, 0, 1}, PlotStyle -> {Red, Green, Blue}] And another way to plot the function

Manipulate[
Plot3D[f[a1, a2, a3], {a1, 0, 2}, {a2, -1, 2},
Mesh -> Full], {a3, -2, 3}] • Nice, how would I plot those symbolically, i.e., without passing values? Mar 10, 2022 at 21:45
• @jimbob97 not really sure what you mean. How would you plot something without assigning values to the coordinates? If you are worried about the ranges, you can of course increase them, or maybe I misunderstood
– user49048
Mar 10, 2022 at 21:47
• @jimbob97 I made it more concrete with a second way of plotting and also showing how the first plot behaves in a notebook. perhaps you can have a look at the updated version.
– user49048
Mar 10, 2022 at 21:53
• @jimbob97 In your code, {m, 0, 1} mean that 0<=(a3 - a2)/(a3 - a1)<=1 instead of 0<=a1<=1, 0<=a2<=1,0<=a3<=1, please clarify this. Mar 11, 2022 at 0:12
• @cvgmt you should also keep in mind that m is Mod. at least this is what was written in the OP and that's why I passed it like this in this answer.
– user49048
Mar 11, 2022 at 0:18