3
$\begingroup$

I want to calculate the following limit:

Limit[(a2 EllipticTheta[3, -((π (l + d0 g t))/(2 l)), 
    E^(-((d0 π^2 t)/l^2))])/(2 Abs[l]) + (
  a2 EllipticTheta[3, (π (l - d0 g t))/(2 l), 
    E^(-((d0 π^2 t)/l^2))])/(2 Abs[l]) + (
  a1 Sqrt[(d0 t)/l^2]
    EllipticTheta[3, -((d0 g π t)/(2 l)), 
    E^(-((d0 π^2 t)/l^2))])/Sqrt[d0 t], l -> Infinity]

Mathematica gives an output of zero. However, if I put g=0; before using Limit, the output is not zero anymore! Also when I run the following piece of code:

a1 = 1;
a2 = 1;
g = 1.5;
d0 = 1;
t = 0.001;
Plot[(a2 EllipticTheta[3, -((π (l + d0 g t))/(2 l)), 
    E^(-((d0 π^2 t)/l^2))])/(2 Abs[l]) + (
  a2 EllipticTheta[3, (π (l - d0 g t))/(2 l), 
    E^(-((d0 π^2 t)/l^2))])/(2 Abs[l]) + (
  a1 Sqrt[(d0 t)/l^2]
    EllipticTheta[3, -((d0 g π t)/(2 l)), 
    E^(-((d0 π^2 t)/l^2))])/Sqrt[d0 t], {l, 100, 1000}]

The output is not zero and doesn't go to zero as l increases. Can any one explain why Mathematica gives an incorrect output here? Can anyone help me to get the correct outcome of the Limit function?

$\endgroup$
5
  • 1
    $\begingroup$ Are you certain it's wrong? If you check the limits of EllipticTheta function arguments, you see all values of EllipticTheta in your equation converging to zero. (Consider Limit[EllipticTheta[3, Pi/2, x], x -> 1, Direction -> 1] and friends.) Numerics of Plot behaving the way they do is an entirely different question. $\endgroup$
    – kirma
    Commented Sep 15, 2018 at 14:29
  • $\begingroup$ Yes I am. Because if you put g=0; the output of Limit function is not zero anymore @kirma $\endgroup$ Commented Sep 15, 2018 at 14:38
  • $\begingroup$ Hmm, interesting. This is not the case in your plot, though. I have to leave this, be it numerics or symbolics, to others. $\endgroup$
    – kirma
    Commented Sep 15, 2018 at 14:58
  • $\begingroup$ I think Limit should generate conditions for its output if you add GenerateConditions -> True option to it - but it doesn't. $\endgroup$
    – kirma
    Commented Sep 15, 2018 at 15:18
  • $\begingroup$ Where did this expression come from? $\endgroup$ Commented Sep 29, 2018 at 15:44

2 Answers 2

2
$\begingroup$

Looking at the definition of EllipticTheta from the documentation:

$$\vartheta _3(u,q)=1+2 \sum _n^{\infty } q^{n^2} \cos (2 n u)$$

it is clear that $\vartheta_3(0, 1)$ diverges. Your problematic term is:

term = EllipticTheta[3, -((d0 g π t)/(2 l)), E^(-((d0 π^2 t)/l^2))]

EllipticTheta[3, -((d0 g π t)/(2 l)), E^(-((d0 π^2 t)/l^2))]

Let $l = 1/s$ and replace the arguments with the small $s$ approximations:

term /. l->1/Series[s, {s, 0, 1}] //TeXForm

$\vartheta _3\left(-\frac{1}{2} s (\pi \operatorname{d0} g t)+O\left(s^2\right),1-\pi ^2 \operatorname{d0} s^2 t+O\left(s^3\right)\right)$

which is of the form:

EllipticTheta[3, -b s, 1 - a s^2]

When $b=0$, Mathematica knows about the asymptotic behavior of this function as $s \to 0$:

Assuming[a>0, Series[EllipticTheta[3, 0, 1 - a s^2], {s, 0, 0}]] //TeXForm

$\frac{\sqrt{\pi } (-1)^{\left\lfloor -\frac{\arg (s)}{\pi }\right\rfloor } e^{-i \pi \left\lfloor \frac{3}{4}-\frac{\arg \left(-a s^2\right)}{2 \pi }\right\rfloor }}{\sqrt{a} s}$

However, when the second argument also depends on $s$, there appears to be a bug:

Series[EllipticTheta[3, -b s, 1 - a s^2], {s, 0, 0}, Assumptions->a>0] //TeXForm

$\vartheta _3(0,1)+O\left(s^1\right)$

There is an internal function that is designed to handle EllipticTheta series, but it doesn't seem to be used. We can work around the above issue by using it directly. First, let's reproduce the known result above:

Assuming[a>0, System`SeriesDump`ThetaFunction[3, 0, 1-a s^2, s, 0, 0]] //TeXForm

$\frac{\sqrt{\pi } (-1)^{\left\lfloor -\frac{\arg (s)}{\pi }\right\rfloor } e^{-i \pi \left\lfloor \frac{3}{4}-\frac{\arg \left(-a s^2\right)}{2 \pi }\right\rfloor }}{\sqrt{a} s}$

Now, let's try it on the second example:

series = Assuming[
    a>0 && b>0,
    System`SeriesDump`ThetaFunction[3, -b s, 1-a s^2, s, 0, 0]
];
series //TeXForm

$\frac{\sqrt{\pi } (-1)^{\left\lfloor -\frac{\arg (s)}{\pi }\right\rfloor } \exp \left(b^2 s^2 \left(\frac{1}{2}-\frac{1}{a s^2}\right)-i \pi \left\lfloor \frac{3}{4}-\frac{\arg \left(-a s^2\right)}{2 \pi }\right\rfloor \right)}{\sqrt{a} s}$

Much better! Now, recall that the above EllipticTheta term comes with a prefactor of $\sqrt{\frac{1}{l^2}}$, or equivalently $\sqrt{s^2}$, so we want the limit of s series as $s \to 0$. Hence:

lim[a_, b_] = Assuming[
    a>0 && b>0 && s>0,
    Limit[Simplify[s series], s -> 0]
];
lim[a, b] //TeXForm

$\frac{\sqrt{\pi } e^{-\frac{b^2}{a}}}{\sqrt{a}}$

Summarizing, we have the limit:

$$\underset{s\to 0}{\text{lim}}\,s \vartheta _3(-b s,1-a s^2)=\frac{e^{-\frac{b^2}{a}} \sqrt{\pi }}{\sqrt{a}}$$

Now, the only nonzero term in the limit $s \to 0$ is then:

((a1 Sqrt[(d0 t)/l^2] EllipticTheta[3,-((d0 g π t)/(2 l)),E^(-((d0 π^2 t)/l^2))])/Sqrt[d0 t])

which takes the form:

c s EllipticTheta[3, -b s, 1 - a s^2]

where:

c = a1;
a = d0 π^2 t
b = d0 g π t/2

Hence, the symbolic limit is:

res = a1 lim[d0 π^2 t, d0 g π t/2];
res //TeXForm

$\frac{\operatorname{a1} e^{-\frac{1}{4} \operatorname{d0} g^2 t}}{\sqrt{\pi } \sqrt{\operatorname{d0} t}}$

Let's check:

v = res /. {a1 -> 1, d0 -> 1, g -> 3/2, t -> 1/1000};
v //TeXForm
N[v, 20]

$\frac{10 \sqrt{\frac{10}{\pi }}}{e^{9/16000}}$

17.831208285385305584

in agreement with Bob's answer.

$\endgroup$
1
  • $\begingroup$ I think ou made a mistake at the line before "Lets check" $\endgroup$ Commented Feb 18, 2019 at 12:23
0
$\begingroup$

Machine precision cannot produce meaningful results. Use arbitrary precision and start with exact values for constants.

a1 = 1;
a2 = 1;
g = 3/2;
d0 = 1;
t = 10^-3;

f[l_] = (a2 EllipticTheta[3, -((π (l + d0 g t))/(2 l)), 
        E^(-((d0 π^2 t)/l^2))])/(2 Abs[l]) + (a2 EllipticTheta[
        3, (π (l - d0 g t))/(2 l), E^(-((d0 π^2 t)/l^2))])/(2 Abs[
        l]) + (a1 Sqrt[(d0 t)/l^2] EllipticTheta[3, -((d0 g π t)/(2 l)), 
        E^(-((d0 π^2 t)/l^2))])/Sqrt[d0 t] // Simplify[#, l > 0] &;

Accurate calculations are very slow.

AbsoluteTiming[(N[f[#], 12] // Chop) & /@ {100, 200, 500, 750, 1000}]

(* {296.342, {17.8312082854, 17.8312082854, 17.8312082854, 17.8312082854, 
  17.8312082854}} *)

From the documentation, EllipticTheta is only defined inside the unit disk for its third argument.

Cases[f[l], EllipticTheta[3, u_, q_] :> Limit[q, l -> Infinity], Infinity]

(* {1, 1, 1} *)

In the Limit you are trying to evaluate each EllipticTheta on the unit circle. I suspect that this is what is causing the problem with the Limit.

$\endgroup$
9
  • $\begingroup$ Thank you for your answer. But how can I find the limit without giving numbers to parameters? $\endgroup$ Commented Sep 15, 2018 at 18:52
  • $\begingroup$ sorry, I cannot understand what does your code do. What is the output {1,1,1} ? $\endgroup$ Commented Sep 15, 2018 at 19:03
  • $\begingroup$ @HolgerMate - the {1,1,1} indicates the the third argument of each of the EllipticThetas goes to 1 in the Limit, i.e., the Limit is trying to evaluate the EllipticThetas where they are not defined and gets confused in the process. $\endgroup$
    – Bob Hanlon
    Commented Sep 15, 2018 at 19:08
  • 1
    $\begingroup$ @HolgerMate - I have no reason to believe that the general symbolic limit exists. Why do you think that one does? You are probably restricted to specific numeric cases. $\endgroup$
    – Bob Hanlon
    Commented Sep 15, 2018 at 19:43
  • 1
    $\begingroup$ Would u also tell me what are {296.342, {17.8312082854, 17.8312082854, 17.8312082854, 17.8312082854, 17.8312082854}} $\endgroup$ Commented Sep 15, 2018 at 20:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.