Coverage for src/hypra/__init__.py: 100.00%

45 statements  

« prev     ^ index     » next       coverage.py v7.17.3, created at 2026-11-26 22:12 +0000

1"""Hypra: a SymPy-native hypergeometric expansion project. 

2 

3Native exact regulator expansions inspired by HypExp; no Mathematica required. 

4An experimental external comparison bridge is optional. 

5""" 

6 

7from collections.abc import Iterable 

8from typing import cast 

9 

10from sympy import hyper 

11 

12from ._typing import ExactScalar 

13from .api import ExpansionResult, backend_info, expand_epsilon 

14from .backend import ( 

15 BackendError, 

16 BackendProtocolError, 

17 BackendTimeoutError, 

18 BackendUnavailableError, 

19) 

20from .config import BackendConfig 

21from .errors import HypraError, IncompleteExpansionError, UnsupportedExpressionError 

22from .expansion_library import ExpansionLibrary 

23from .hpl.algebra import hpl_series, integrate_from_zero, primitive_hpl, shuffle_expand 

24from .hpl.alternating import hpl_alternating_at_one, hpl_at_minus_one, reduce_euler_sum 

25from .hpl.arguments import transform_hpl_arguments 

26from .hpl.boundary_numeric import HPLBoundaryNumericResult, evaluate_hpl_boundary 

27from .hpl.classical import classical_hpl 

28from .hpl.constants import ConstantNumericResult, evaluate_euler_sum, evaluate_mzv 

29from .hpl.endpoints import hpl_at_one, reduce_mzv 

30from .hpl.inversion import invert_hpl 

31from .hpl.known_functions import reduce_hpl_to_known_functions 

32from .hpl.limits import hpl_limit_at_one 

33from .hpl.maps import fractional_hpl, square_hpl 

34from .hpl.minimal import reduce_hpl_to_minimal_set 

35from .hpl.mobius import mobius_hpl 

36from .hpl.named_constants import HPLs6, HPLs7a, HPLs7b, HPLs8a, HPLs8b, HPLs8c, HPLs8d 

37from .hpl.notation import ( 

38 HPLPM, 

39 compress_indices, 

40 expand_indices, 

41 hpl_pm, 

42 letters_to_pm, 

43 pm_to_letters, 

44) 

45from .hpl.numeric import ( 

46 HPLNumericalConvergenceError, 

47 HPLNumericResult, 

48 evaluate_hpl, 

49 hpl_evalf, 

50) 

51from .hpl.radial_continuation import HPLContinuationResult, continue_hpl 

52from .hpl.real_continuation import analytic_continue_hpl 

53from .hpl.reduction import extract_hpl_logs, lyndon_factors, lyndon_reduce 

54from .hpl.regularization import ( 

55 hpl_endpoint_polynomial, 

56 hpl_expression_endpoint_polynomial, 

57 shuffle_regularized_hpl_at_one, 

58) 

59from .hpl.series_one import hpl_series_at_one 

60from .hpl.special import hpl_at_i, hpl_pm_at_i 

61from .hpl.stuffle import stuffle_expand_constants 

62from .hpl.taylor import hpl_taylor 

63from .hpl.transforms import negate_hpl, reflect_hpl 

64from .hypexp_integrals import beta_log_moment, hypergeometric_log_moment 

65from .native import NativeBackend, NativeConfig 

66from .nielsen import NielsenPolylog, hpl_to_nielsen, nielsen_to_hpl, reduce_nielsen 

67from .polylog_reduction import reduce_polylogs 

68from .polylogs import transform_polylog_arguments 

69from .serialization import SerializationError, decode_expr, encode_expr 

70from .symbolic import HPL, MZV, EulerSum 

71 

72__version__ = "0.3.0" 

73 

74 

75def hypergeometric( 

76 upper: Iterable[ExactScalar], 

77 lower: Iterable[ExactScalar], 

78 argument: ExactScalar, 

79) -> hyper: 

80 """Construct an unevaluated generalized hypergeometric function. 

81 

82 Construction preserves matching upper and lower parameters for later 

83 validation by `expand_epsilon`. 

84 

85 Args: 

86 upper: Exact numerator parameters in their supplied order. 

87 lower: Exact denominator parameters in their supplied order. 

88 argument: Exact argument of the function. 

89 

90 Returns: 

91 A SymPy hypergeometric atom with parameter cancellation disabled. 

92 """ 

93 return cast(hyper, hyper(tuple(upper), tuple(lower), argument, evaluate=False)) 

94 

95 

96__all__ = [ 

97 "HPL", 

98 "HPLPM", 

99 "MZV", 

100 "BackendConfig", 

101 "BackendError", 

102 "BackendProtocolError", 

103 "BackendTimeoutError", 

104 "BackendUnavailableError", 

105 "ConstantNumericResult", 

106 "EulerSum", 

107 "ExpansionLibrary", 

108 "ExpansionResult", 

109 "HPLBoundaryNumericResult", 

110 "HPLContinuationResult", 

111 "HPLNumericResult", 

112 "HPLNumericalConvergenceError", 

113 "HPLs6", 

114 "HPLs7a", 

115 "HPLs7b", 

116 "HPLs8a", 

117 "HPLs8b", 

118 "HPLs8c", 

119 "HPLs8d", 

120 "HypraError", 

121 "IncompleteExpansionError", 

122 "NativeBackend", 

123 "NativeConfig", 

124 "NielsenPolylog", 

125 "SerializationError", 

126 "UnsupportedExpressionError", 

127 "__version__", 

128 "analytic_continue_hpl", 

129 "backend_info", 

130 "beta_log_moment", 

131 "classical_hpl", 

132 "compress_indices", 

133 "continue_hpl", 

134 "decode_expr", 

135 "encode_expr", 

136 "evaluate_euler_sum", 

137 "evaluate_hpl", 

138 "evaluate_hpl_boundary", 

139 "evaluate_mzv", 

140 "expand_epsilon", 

141 "expand_indices", 

142 "extract_hpl_logs", 

143 "fractional_hpl", 

144 "hpl_alternating_at_one", 

145 "hpl_at_i", 

146 "hpl_at_minus_one", 

147 "hpl_at_one", 

148 "hpl_endpoint_polynomial", 

149 "hpl_evalf", 

150 "hpl_expression_endpoint_polynomial", 

151 "hpl_limit_at_one", 

152 "hpl_pm", 

153 "hpl_pm_at_i", 

154 "hpl_series", 

155 "hpl_series_at_one", 

156 "hpl_taylor", 

157 "hpl_to_nielsen", 

158 "hypergeometric", 

159 "hypergeometric_log_moment", 

160 "integrate_from_zero", 

161 "invert_hpl", 

162 "letters_to_pm", 

163 "lyndon_factors", 

164 "lyndon_reduce", 

165 "mobius_hpl", 

166 "negate_hpl", 

167 "nielsen_to_hpl", 

168 "pm_to_letters", 

169 "primitive_hpl", 

170 "reduce_euler_sum", 

171 "reduce_hpl_to_known_functions", 

172 "reduce_hpl_to_minimal_set", 

173 "reduce_mzv", 

174 "reduce_nielsen", 

175 "reduce_polylogs", 

176 "reflect_hpl", 

177 "shuffle_expand", 

178 "shuffle_regularized_hpl_at_one", 

179 "square_hpl", 

180 "stuffle_expand_constants", 

181 "transform_hpl_arguments", 

182 "transform_polylog_arguments", 

183]