Skip to content

U(a,b,z) returns results different from Mathematica/MATLAB when z is negative #63

Open
@Haonan-Zhou

Description

@Haonan-Zhou

Hi,

Thanks a lot for the wonderful package!

This issue might be related to #61 , but I tried to compare the result of the Tricomi confluent hypergeometric function HypergeometricFunctions.U(a,b,z) across softwares when the final argument z is a negative number. Here are some results:

Experiment 1: Evaluate U(0.5, 0.5, -2.5):

  • Mathematica: HypergeometricU[0.5, 0.5, -2.5] yields 0.145492 - 0.810467i.
  • MATLAB: kummerU(0.5, 0.5, -2.5) yields 0.1455 - 0.8105i.
  • Julia: HypergeometricFunctions.U(0.5, 0.5, Complex(-2.5)) yields 0.0 - 1.1612906236707266im.

Note that HypergeometricFunctions.U(0.5, 0.5, -2.5) throws a DomainError with -2.5: Exponentiation yielding a complex result requires a complex argument. Probably one needs to make sure z^(1-b) is defined for negative real z.

Experiment 2: Evaluate U(-0.5 -0.5, -2.5):

  • Mathematica: HypergeometricU[-0.5, -0.5, -2.5] yields 0.0727459 + 1.17591i.
  • MATLAB: kummerU(-0.5, -0.5, -2.5) yields 0.0727 + 1.1759i.
  • Julia: HypergeometricFunctions.U(-0.5, -0.5, Complex(-2.5)) yields 0.0 + 0.0im.

The issue does not seem to appear (the results matches across platforms) if z is a positive real or z is a complex number with a negative real part:

Experiment 3: Evaluate U(-0.5 -0.5, -2.5-1.5im):

  • Mathematica: HypergeometricU[-0.5, -0.5, -2.5-1.5i] yields 0.595921 - 1.34976i.
  • MATLAB: result is 0.5959 - 1.3498i.
  • Julia: result is 0.5959210215481137 - 1.3497630048128746im.

Environment: Julia 1.8.5, package ver. 0.3.15. MATLAB R2022a. Mathematica 12.3.1.0 on a macOS 13.3.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions