14
$\begingroup$
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}]

enter image description here

Why? How to fix?

$\endgroup$
  • $\begingroup$ 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. $\endgroup$ – TheDoctor Jul 8 '15 at 4:58
15
$\begingroup$

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}]

Mathematica graphics

$\endgroup$
  • $\begingroup$ Interesting. It is a miracle that it evaluates it to be purely real for anywhere at all. $\endgroup$ – grdgfgr Jul 4 '15 at 9:37
  • 3
    $\begingroup$ @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. $\endgroup$ – Ruslan Jul 4 '15 at 11:10
17
$\begingroup$

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}]
$\endgroup$
  • 2
    $\begingroup$ Now your gedanken model got the Gedanken Graphics(tm) upgrade. Nice! $\endgroup$ – Dr. belisarius Jul 4 '15 at 4:01
  • 1
    $\begingroup$ Nono, I am on a borrowed computer again for today, @bel. :) $\endgroup$ – J. M. is away Jul 4 '15 at 4:11
8
$\begingroup$

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]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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