Plot is discontinuous (it shouldn't be)

Plot[{(E^x)^(-2 I π) Hypergeometric2F1[-2 I π - 2 I Sqrt[2] π, -2 I π + 2 I Sqrt[2] π,
1 - 4 I π, -E^x] +
(E^x)^ (2 I π)  Hypergeometric2F1[2 I π - 2 I Sqrt[2] π, 2 I π + 2 I Sqrt[2] π,
1 + 4 I π, -E^x]},
{x, -10, 10}]


Why? How to fix?

• The leading term in the asymptotic expansion for x<0 is 2 Cos[2 Pi x]. For x>0, the expression is much more complicated but the leading term is A Cos[2 Sqrt[2] Pi x+d] where A~1.7 and d~0.5. The transition between these asymptotic behaviours is in over -3 < x < 3. Commented Jul 8, 2015 at 4:58

The numerical evaluation of your argument function leads to very small imaginary parts in the result that are due to numerical inaccuracy. Remove them by wrapping the argument of Plot in Chop (see its documentation):

Plot[Chop[(E^x)^(-2 I π) Hypergeometric2F1[-2 I π -
2 I Sqrt[2] π, -2 I π + 2 I Sqrt[2] π,
1 - 4 I π, -E^x] + (E^x)^(2 I π) Hypergeometric2F1[
2 I π - 2 I Sqrt[2] π, 2 I π + 2 I Sqrt[2] π,
1 + 4 I π, -E^x]], {x, -10, 10}]


• Interesting. It is a miracle that it evaluates it to be purely real for anywhere at all. Commented Jul 4, 2015 at 9:37
• @grdgfgr it doesn't have to evaluate to purely real to appear plotted. The ratio of imaginary to real part just has to be below some threshold. See e.g. Plot[Sin[x]+10^-15I,{x,-3,3}], it'll be plotted where the real part is greater than about 0.1. Commented Jul 4, 2015 at 11:10

Good way: use a higher setting of WorkingPrecision.

Plot[{Exp[x]^(-2 I π) Hypergeometric2F1[-2 I π (Sqrt[2] + 1), 2 I π (Sqrt[2] - 1),
1 - 4 I π, -Exp[x]] +
Exp[x]^(2 I π) Hypergeometric2F1[-2 I π (Sqrt[2] - 1), 2 I π (Sqrt[2] + 1),
1 + 4 I π, -Exp[x]]}, {x, -10, 10},
WorkingPrecision -> 20]


Best way: stand on the shoulders of giants:

Plot[(1 + Exp[x]) (Exp[x]^(-2 I π) Hypergeometric2F1[
1 + 2 I π (Sqrt[2] - 1), 1 - 2 I π (Sqrt[2] + 1), 1 - 4 I π, -Exp[x]] +
Exp[x]^(2 I π) Hypergeometric2F1[1 + 2 I π (Sqrt[2] + 1),
1 - 2 I π (Sqrt[2] - 1), 1 + 4 I π, -Exp[x]]), {x, -10, 10}]

• Now your gedanken model got the Gedanken Graphics(tm) upgrade. Nice! Commented Jul 4, 2015 at 4:01
• Nono, I am on a borrowed computer again for today, @bel. :) Commented Jul 4, 2015 at 4:11

I think this question has been asked before, the short answer is the function is at least not real for numerical evaluation.

Table[{(E^x)^(-2 I π) Hypergeometric2F1[-2 I π -
2 I Sqrt[2] π, -2 I π + 2 I Sqrt[2] π,
1 - 4 I π, -E^x] + (E^x)^(2 I π) Hypergeometric2F1[
2 I π - 2 I Sqrt[2] π, 2 I π + 2 I Sqrt[2] π,
1 + 4 I π, -E^x]}, {x, 1.1, 1.15, 0.01}]

{{-0.217093 + 2.55351*10^-15 I}, {-0.073033 +
2.55351*10^-15 I}, {0.0715313 + 3.33067*10^-15 I}, {0.2156 +
1.9984*10^-15 I}, {0.358176 + 3.10862*10^-15 I}, {0.498267 +
4.66294*10^-15 I}}


You can just plot the real part:

Plot[{Re[(E^x)^(-2 I π) Hypergeometric2F1[-2 I π -
2 I Sqrt[2] π, -2 I π + 2 I Sqrt[2] π,
1 - 4 I π, -E^x] + (E^x)^(2 I π) Hypergeometric2F1[
2 I π - 2 I Sqrt[2] π, 2 I π + 2 I Sqrt[2] π,
1 + 4 I π, -E^x]]}, {x, -10, 10}, PlotPoints -> 200]