# How to invert an Elliptic function where the elliptic nome is a function of an independent variable?

I have a Jacobian elliptic function as a function of two independent variables $$x$$ and $$y$$. The elliptic parameter $$m=m(y)$$, $$0 \leq m \leq 1$$, is also a function of the variable $$y$$, and thus the elliptic nome $$q=q(m)=q(m(y))$$ also depends on $$y$$.

For example, I define:

$$h(y) = \ln \left(\frac{5+\sin y}{2- \cos y}\right)$$

and take $$q$$ such that $$q = -\frac{\pi^{2}}{h(y)}$$. My elliptic function is

$$f(x,y)=sn\left(\frac{2K(m)x}{h(y)},m\right),$$

where $$sn$$ is the Jacobian elliptic function and $$K(m)=K(m(y))$$ is the complete elliptic integral of the first kind, and $$x \in \mathbb{R}$$.

What I want is to rewrite $$f(x,y)$$ in terms of $$x$$ and $$m$$, instead of $$y$$, (and suitably normalise it) so that I could then make a contour plot of $$f(x,m)$$ for some level set of $$f$$. The problem is that I don't know how to get $$Mathematica$$ to invert the elliptic nome so that $$y$$ is expressed in terms of $$m$$.

My code is:

h[y_] := Log[(5 + Sin[y])/(2 - Cos[y])]

f[x_, y_] := (JacobiSN[2*EllipticK[InverseEllipticNomeQ[Exp[-(Pi)^2/h[y]]]]*x/h[y], InverseEllipticNomeQ[Exp[-(Pi)^2/h[y]]]])

ContourPlot[f[x, y] == 0, {x, 0, 10}, {y, 0, 2*Pi}]


But this is not what I need.

When I run the code I wrote above, the contour plot gives me a whole $$\textit{set}$$ of level curves of $$f$$, because as it stands, for any fixed $$y$$, the period of $$f$$ depends on $$y$$ (since the period of elliptic functions is expressed through $$K(m)$$, and $$y$$ runs through the interval $$[0, 2\pi]$$.
Fixing $$y = y^{*}$$ for a few random values $$y^{*}$$ reveals that the the graph of $$f(x, y^{*})$$ has just one root in its appropriate period determined by $$h(y)$$.
What I want is to show that this is true for all set of values $$0 \leq y \leq 2\pi$$, from looking at the contour plot. As it stands, this is not clear. However, my expectation is that if I normalise $$f$$ properly, and use $$m$$ instead of $$y$$, as the independent variable with $$0\leq m \leq 1$$, the contour plot should give me just one level curve, which proves the above.
• If I solve the equation $w=h(y)$ for $y$, I get a complicated expression with a choice of branches for the square root and the arctangent in the result. You might want to think about which branch is most appropriate for what you want to do. – J. M. will be back soon Jun 7 '16 at 16:07
• The $h(y)$ above is just a hypothetical example, my real $h$ is even more complicated. What I want is $0 \leq y \leq 2\pi$. So you suggest that I start by resolving the expression for $y$ first (say using the Inverse Function commmand)? @J.M. – Alex Jun 7 '16 at 16:14
• "my real $h$ is even more complicated" tells me that you'll have to resort to a numerical method (i.e. FindRoot[]) in the worst case; as you know, most transcendental equations do not lend themselves to simple solutions. But wait, if $h(y)=-\frac{\pi^2}{q(m)}$, why not make that replacement everywhere you can? – J. M. will be back soon Jun 7 '16 at 16:16