Пример #1
0
 def test_hyp0f1_complex(self):
     assert_mpmath_equal(lambda a, z: sc.hyp0f1(a.real, z),
                         _exception_to_nan(lambda a, x: mpmath.hyp0f1(a, x, **HYPERKW)),
                         [Arg(), ComplexArg()])
Пример #2
0
 def test_hyp0f1(self):
     assert_mpmath_equal(sc.hyp0f1,
                         _exception_to_nan(lambda a, x: mpmath.hyp0f1(a, x, **HYPERKW)),
                         [Arg(), Arg()])
Пример #3
0
 def test_hyp0f1(self):
     assert_mpmath_equal(
         sc.hyp0f1,
         _exception_to_nan(lambda a, x: mpmath.hyp0f1(a, x, **HYPERKW)),
         [Arg(), Arg()])
Пример #4
0
 def test_hyp0f1_complex(self):
     assert_mpmath_equal(
         lambda a, z: sc.hyp0f1(a.real, z),
         _exception_to_nan(lambda a, x: mpmath.hyp0f1(a, x, **HYPERKW)),
         [Arg(), ComplexArg()])
#!/usr/bin/env python

'''
program:     hypergeometric_functions_with_mpmath.py
author:      tc
created:     2015-10-17 -- 11 CEST
description: computes some hypergeometric functions with mpmath, and checks
             with Mathematica values.
notes:       hyp0f1(a, z) fails at a=0, while the Mathematica version does not.
'''

import mpmath

a = [1, 1]
b = [3, 3, 3]
z = 2.0
res1 = float(mpmath.hyper(a, b, z))
res2 = float(mpmath.hyp0f1(1, 2))
print 'HypergeometricPFQ[{1, 1}, {3, 3, 3}, 2.0]: 1.07893'
print 'mpmath.hyper([1, 1], [3, 3, 3], 2.0):      %f' % res1
print 'Hypergeometric0F1Regularized[1, 2]: 4.25235'
print 'mpmath.hyp0f1(1, 2):                %f' % res2