Skip to content

Value of Sinc at complex infinity. #14914

Open
@pjgaudre

Description

I was wondering if we could add the values of the Sinc function at the complex infinities. In #14854, there was some talk to push this in a separate pull request. However, as @simonbyrne mentioned:

If we're going to fix it, we should also fix the cases where it returns incorrect NaNs for finite values as well (e.g. sinc(0.0 +250.0*im)).

However this is probably a bit of work: it will require a bit of complex analysis to figure out what those limits should be (unless you can find a good reference), and fix some of the other incorrect functions (e.g. sinpi(1+300*im), as well as adding tests and docs.

Although I am not quite sure how to remedy the incorrect NaNs for finite values. I have computed the complex limits for the Sinc function and found the following. Any checks or advice or collaboration would be greatly appreciated.

The Sinc function

Given that:

sinc(x+Iy) = [Fr(x,y) + I Fi(x,y)]/((x^2+y^2)*π),
where
Fr(x,y) = x*sinpi(x)*cosh(πy) + y*cospi(x)*sinh(πy),
and
Fi(x,y) = x*cospi(x)*sinh(πy) - y*sinpi(x)*cosh(πy).

We have three cases to consider

  • x is identically 0, in which case, we can simplify things to:
sinc(x+Iy) = sinh(πy)/(πy).
  • x is an integer,hence also a zero of sinpi(x) in which case, we can simplify things to:
sinc(x+Iy) = [Fr(x,y) + I Fi(x,y)]/((x^2+y^2)*π),
where
Fr(x,y) =  y*cospi(x)*sinh(πy),
and
Fi(x,y) = x*cospi(x)*sinh(πy).
  • x+0.5 is an integer, hence also a zero of cospi(x) in which case, we can simplify things to:
sinc(x+Iy) = [Fr(x,y) + I Fi(x,y)]/((x^2+y^2)*π),
where
Fr(x,y) =  x*sinpi(x)*cosh(πy),
and
Fi(x,y) = - y*sinpi(x)*cosh(πy).

With this in mind, this gives rise to the following function definition:

function sinc(x::Complex)
xr, xi = reim(x)
  if x == 0
      return one(x)
  elseif isinf(xr) && isfinite(xi) # Real part is infinite, Imaginary part is finite.
      return zero(x)
  elseif  isfinite(xr) && isinf(xi) # Real part is finite, Imaginary part is infinite.
    Si = sign(xi)
    Sr = sign(xr)
    Sc = sign(cospi(xr))
    Ss = sign(sinpi(xr))
      if xr == 0 # Real part is 0
          return complex(Inf,0)
      elseif isinteger(xr) # Real part is an integer, hence also a zero of sinpi(xr)
          return oftype(x,Inf)*complex(Sc,Si*Sr*Sc)
      elseif isinteger(xr+0.5) # Real part+0.5 is an integer, hence also a zero of cospi(xr)
          return oftype(x,Inf)*complex(Sr*Ss,-Si*Ss)
      else
          return oftype(x,Inf)*complex(Sc,-Si*Ss)
      end
  elseif isinf(xr) && isinf(xi) # Real part and Imaginary part are infinite.
      return oftype(x,NaN)*complex(1,1) # This limit does not exist. There are infinite number of paths.
  else      # Real part and Imaginary part are finite.
      return oftype(x,sinpi(x)/(pi*x))
  end
end

Like I said, any help with this issue would be gladly appreciated! Thanks.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    complexComplex numbers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions