New issue 214 by harmer.m...@googlemail.com: Derivative of Jacobi Theta
http://code.google.com/p/mpmath/issues/detail?id=214
What steps will reproduce the problem?
1. Evaluate the derivative of the Jacobi theta
jtheta(1, 0, exp(j*pi*tau), 1)
across the line Real(tau) = -1 or Real (tau) = 1 in the upper half
plane. It appears to have
a discontinuity here.
What is the expected output? What do you see instead?
There should not be a discontinuity.
What version of the product are you using? On what operating system?
On OSX 10.6, python 2.6.1, mpmath 0.14.
Please provide any additional information below.
Thanks for all the good work. I see you are implementing a q-factorial,
is this appearing in the current version? I still cannot get mpmath to
plot stuff,
if you point me to a site to help with this I would be grateful.
Thanks again for the good work.
Cheers,
Mark
Hi Mark,
I can't find a problem with the latest version (0.17), although I don't
remember any recent changes being made to the theta functions.
Can you be more specific, i.e. can you provide a point where the function
value seems to be wrong?
If I understood the problem correctly, the following should show a
discontinuity, but it looks fine to me:
plot(lambda t: jtheta(1, 0, exp(j*pi*(1+t*j)), 1), [0,5])
If you can't get mpmath plotting to work, it's probably an issue with
matplotlib. Your best bet would be to try the matplotlib support channels.
If matplotlib works but mpmath plotting doesn't, please provide more
details.
q-factorials are available in the latest version.
Hi Fredrik,
Try
plot(lambda t: jtheta(1, 0, exp(j*pi*(1+t+j)), 1), -0.2,0.2])
(it is across the line Real (tau)=1, not along it), although I didn't
notice the problem (if indeed there is one) this way. Rather I was trying
to evaluate functions of the Dedekind eta function at certain points and
kept getting weird answers.
Mark
Yes, there is a discontinuity. However, I tried plotting the function in
Mathematica, and it shows the same thing.
This doesn't seem unreasonable: the definition of theta_1 as a q-series
involves a fractional power of q, so there should be a branch cut
discontinuity somewhere.
The function can't figure out that the argument is an exponential (just as
if you evaluate log(exp(x)), it doesn't generally give x).
You probably have to rewrite the formula you are using somehow to avoid
this.
Comment #4 on issue 214 by fredrik....@gmail.com: Derivative of Jacobi Theta
http://code.google.com/p/mpmath/issues/detail?id=214
The most user-friendly solution, of course, would be to let you type
jtheta(1, 0, tau=t, nd=1) and have the implementation choose branches so as
to make the function continuous.
Patches are welcome :)
I am afraid I disagree for the following reasons:
> This doesn't seem unreasonable: the definition of theta_1 as a q-series
> involves a fractional power of q, so >there should be a branch cut
> discontinuity somewhere.
1. The Jacobi theta function is only defined for 'tau' in the upper half
plane -- the branch cut, if you insist on considering it, should be on the
real axis. Alternatively jtheta is only defined for the nome |q|<1.
2. As I noted in the original query there are discontinuities across
Real(tau) = 1 and Real(tau) = -1, in fact across (all) the lines Real(tau)
is odd (ok, I didn't check all the lines). To quote Oscar Wilde 'To have
one discontinuity may be regarded as a misfortune; to have two looks like
carelessness; to describe an infinite number as a feature can only be
pulled off by microsoft'.
3. The function I consider in my example (jtheta(1, 0, exp(j*pi*(1+t+j)),
1)) is exactly the Dedekind eta function (cubed). This definitely does not
have any discontinuities in the upper half plane.
The good news is there is no need to consider an implementation that allows
the user to select a branch (a messy and (point 1.) unnecessary process).
The other good news is that I guess point 2. indicates where the bug is: I
would guess that jtheta only evaluates inside -1<Real(tau)<1 and then maps
the result to the rest of the upper half plane using the periodicity of
jtheta(tau). It is this mapping to the rest of the upper half plane that is
broken, at least for the derivative of jtheta.
> plotting the function in Mathematica, and it shows the same thing.
Then, IMHO Mathematica have a bug.