pygeodesy 24.8.4__py2.py3-none-any.whl → 24.9.9__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. {PyGeodesy-24.8.4.dist-info → PyGeodesy-24.9.9.dist-info}/METADATA +17 -16
  2. PyGeodesy-24.9.9.dist-info/RECORD +118 -0
  3. {PyGeodesy-24.8.4.dist-info → PyGeodesy-24.9.9.dist-info}/WHEEL +1 -1
  4. pygeodesy/__init__.py +23 -23
  5. pygeodesy/__main__.py +46 -47
  6. pygeodesy/auxilats/_CX_4.py +104 -181
  7. pygeodesy/auxilats/_CX_6.py +152 -277
  8. pygeodesy/auxilats/_CX_8.py +211 -438
  9. pygeodesy/auxilats/_CX_Rs.py +222 -0
  10. pygeodesy/auxilats/__init__.py +2 -2
  11. pygeodesy/auxilats/__main__.py +30 -38
  12. pygeodesy/auxilats/auxDST.py +2 -2
  13. pygeodesy/auxilats/auxLat.py +28 -36
  14. pygeodesy/auxilats/auxily.py +30 -50
  15. pygeodesy/basics.py +18 -7
  16. pygeodesy/booleans.py +10 -11
  17. pygeodesy/cartesianBase.py +5 -5
  18. pygeodesy/constants.py +35 -34
  19. pygeodesy/ellipsoidalBase.py +18 -15
  20. pygeodesy/ellipsoidalExact.py +2 -2
  21. pygeodesy/ellipsoidalGeodSolve.py +2 -2
  22. pygeodesy/ellipsoidalKarney.py +2 -2
  23. pygeodesy/ellipsoidalNvector.py +2 -2
  24. pygeodesy/ellipsoidalVincenty.py +7 -6
  25. pygeodesy/elliptic.py +154 -88
  26. pygeodesy/epsg.py +3 -3
  27. pygeodesy/etm.py +71 -59
  28. pygeodesy/fmath.py +99 -90
  29. pygeodesy/fsums.py +201 -14
  30. pygeodesy/gars.py +9 -8
  31. pygeodesy/geodesici.py +6 -5
  32. pygeodesy/geodesicx/_C4_24.py +1 -3
  33. pygeodesy/geodesicx/_C4_27.py +1 -3
  34. pygeodesy/geodesicx/_C4_30.py +1 -3
  35. pygeodesy/geodesicx/__init__.py +1 -1
  36. pygeodesy/geodesicx/__main__.py +44 -46
  37. pygeodesy/geodesicx/gx.py +3 -3
  38. pygeodesy/geodesicx/gxarea.py +5 -5
  39. pygeodesy/geodesicx/gxbases.py +32 -18
  40. pygeodesy/geodsolve.py +3 -3
  41. pygeodesy/geohash.py +18 -11
  42. pygeodesy/geoids.py +293 -315
  43. pygeodesy/heights.py +150 -158
  44. pygeodesy/internals.py +70 -9
  45. pygeodesy/interns.py +4 -4
  46. pygeodesy/karney.py +83 -60
  47. pygeodesy/ktm.py +4 -4
  48. pygeodesy/latlonBase.py +13 -7
  49. pygeodesy/lazily.py +13 -8
  50. pygeodesy/ltp.py +5 -6
  51. pygeodesy/ltpTuples.py +7 -1
  52. pygeodesy/mgrs.py +47 -42
  53. pygeodesy/named.py +8 -4
  54. pygeodesy/namedTuples.py +14 -1
  55. pygeodesy/osgr.py +7 -7
  56. pygeodesy/points.py +2 -2
  57. pygeodesy/props.py +7 -6
  58. pygeodesy/resections.py +7 -7
  59. pygeodesy/rhumb/__init__.py +1 -1
  60. pygeodesy/rhumb/aux_.py +42 -60
  61. pygeodesy/rhumb/solve.py +3 -3
  62. pygeodesy/simplify.py +10 -10
  63. pygeodesy/sphericalBase.py +3 -3
  64. pygeodesy/sphericalTrigonometry.py +2 -2
  65. pygeodesy/streprs.py +3 -3
  66. pygeodesy/triaxials.py +207 -201
  67. pygeodesy/units.py +3 -3
  68. pygeodesy/unitsBase.py +4 -4
  69. pygeodesy/utmupsBase.py +3 -3
  70. pygeodesy/vector2d.py +158 -51
  71. pygeodesy/vector3d.py +13 -52
  72. pygeodesy/vector3dBase.py +81 -63
  73. pygeodesy/webmercator.py +3 -3
  74. pygeodesy/wgrs.py +20 -22
  75. PyGeodesy-24.8.4.dist-info/RECORD +0 -117
  76. {PyGeodesy-24.8.4.dist-info → PyGeodesy-24.9.9.dist-info}/top_level.txt +0 -0
pygeodesy/fmath.py CHANGED
@@ -14,7 +14,7 @@ from pygeodesy.constants import EPS0, EPS02, EPS1, NAN, PI, PI_2, PI_4, \
14
14
  from pygeodesy.errors import _IsnotError, LenError, _TypeError, _ValueError, \
15
15
  _xError, _xkwds_get1, _xkwds_pop2
16
16
  from pygeodesy.fsums import _2float, Fsum, fsum, fsum1_, _isFsumTuple, _1primed, \
17
- Fmt, unstr
17
+ Fmt, unstr
18
18
  from pygeodesy.interns import MISSING, _negative_, _not_scalar_
19
19
  from pygeodesy.lazily import _ALL_LAZY, _sys_version_info2
20
20
  # from pygeodesy.streprs import Fmt, unstr # from .fsums
@@ -24,10 +24,10 @@ from math import fabs, sqrt # pow
24
24
  import operator as _operator # in .datums, .trf, .utm
25
25
 
26
26
  __all__ = _ALL_LAZY.fmath
27
- __version__ = '24.05.29'
27
+ __version__ = '24.09.09'
28
28
 
29
- # sqrt(2) <https://WikiPedia.org/wiki/Square_root_of_2>
30
- _0_4142 = 0.41421356237309504880 # ... sqrt(2) - 1
29
+ # sqrt(2) - 1 <https://WikiPedia.org/wiki/Square_root_of_2>
30
+ _0_4142 = 0.41421356237309504880 # ... ~ 3730904090310553 / 9007199254740992
31
31
  _2_3rd = _1_3rd * 2
32
32
  _h_lt_b_ = 'abs(h) < abs(b)'
33
33
 
@@ -36,13 +36,10 @@ class Fdot(Fsum):
36
36
  '''Precision dot product.
37
37
  '''
38
38
  def __init__(self, a, *b, **name_RESIDUAL):
39
- '''New L{Fdot} precision dot product M{sum(a[i] * b[i] for
40
- i=0..len(a)-1)}.
39
+ '''New L{Fdot} precision dot product M{sum(a[i] * b[i] for i=0..len(a)-1)}.
41
40
 
42
- @arg a: Iterable of values (each C{scalar} or an L{Fsum} or L{Fsum2Tuple}
43
- instance).
44
- @arg b: Other values (each C{scalar} or an L{Fsum} or L{Fsum2Tuple} instance),
45
- all positional.
41
+ @arg a: Iterable of values (each C{scalar}, an L{Fsum} or L{Fsum2Tuple}).
42
+ @arg b: Other values (each C{scalar}, an L{Fsum} or L{Fsum2Tuple}), all positional.
46
43
  @kwarg name_RESIDUAL: Optional C{B{name}=NN} (C{str}) and the C{B{RESIDUAL}=0.0}
47
44
  threshold (C{scalar}) for raising L{ResidualError}s, see class
48
45
  L{Fsum<Fsum.__init__>}.
@@ -64,14 +61,16 @@ class Fdot(Fsum):
64
61
  class Fhorner(Fsum):
65
62
  '''Precision polynomial evaluation using the Horner form.
66
63
  '''
67
- def __init__(self, x, *cs, **name_RESIDUAL):
68
- '''New L{Fhorner} evaluation of polynomial M{sum(cs[i] * x**i for
69
- i=0..len(cs)-1)}.
64
+ def __init__(self, x, *cs, **incx_name_RESIDUAL):
65
+ '''New L{Fhorner} evaluation of polynomial M{sum(cs[i] * x**i for i=0..n)} if
66
+ C{B{incx}=False} for decreasing exponent M{sum(... i=n..0)} where C{n =
67
+ len(cs) - 1}.
70
68
 
71
- @arg x: Polynomial argument (C{scalar} or an L{Fsum} or L{Fsum2Tuple}).
72
- @arg cs: Polynomial coeffients (each C{scalar} or an L{Fsum} or L{Fsum2Tuple}
73
- instance), all positional.
74
- @kwarg name_RESIDUAL: Optional C{B{name}=NN} (C{str}) and the C{B{RESIDUAL}=0.0}
69
+ @arg x: Polynomial argument (C{scalar}, an L{Fsum} or L{Fsum2Tuple}).
70
+ @arg cs: Polynomial coeffients (each C{scalar}, an L{Fsum} or L{Fsum2Tuple}),
71
+ all positional.
72
+ @kwarg incx_name_RESIDUAL: Optional C{B{name}=NN} (C{str}), C{B{incx}=True}
73
+ for in-/decreasing exponents (C{bool}) and the C{B{RESIDUAL}=0.0}
75
74
  threshold (C{scalar}) for raising L{ResidualError}s, see class
76
75
  L{Fsum<Fsum.__init__>}.
77
76
 
@@ -83,9 +82,10 @@ class Fhorner(Fsum):
83
82
 
84
83
  @see: Function L{fhorner} and methods L{Fsum.fadd} and L{Fsum.fmul}.
85
84
  '''
85
+ incx, name_RESIDUAL = _xkwds_pop2(incx_name_RESIDUAL, incx=True)
86
86
  Fsum.__init__(self, **name_RESIDUAL)
87
87
  if cs:
88
- self._fhorner(x, cs, Fhorner.__name__)
88
+ self._fhorner(x, cs, Fhorner.__name__, incx=incx)
89
89
  else:
90
90
  self._fset_ps(_0_0)
91
91
 
@@ -94,11 +94,11 @@ class Fhypot(Fsum):
94
94
  '''Precision summation and hypotenuse, default C{root=2}.
95
95
  '''
96
96
  def __init__(self, *xs, **root_name_RESIDUAL_raiser):
97
- '''New L{Fhypot} hypotenuse of (the I{root} of) several components
98
- (raised to the power I{root}).
97
+ '''New L{Fhypot} hypotenuse of (the I{root} of) several components (raised
98
+ to the power I{root}).
99
99
 
100
- @arg xs: Components (each C{scalar} or an L{Fsum} or L{Fsum2Tuple} instance),
101
- all positional.
100
+ @arg xs: Components (each C{scalar}, an L{Fsum} or L{Fsum2Tuple}), all
101
+ positional.
102
102
  @kwarg root_name_RESIDUAL_raiser: Optional, exponent and C{B{root}=2} order
103
103
  (C{scalar}), C{B{name}=NN} (C{str}), the C{B{RESIDUAL}=0.0}
104
104
  threshold (C{scalar}) and C{B{raiser}=True} (C{bool}) for
@@ -121,12 +121,12 @@ class Fpolynomial(Fsum):
121
121
  '''Precision polynomial evaluation.
122
122
  '''
123
123
  def __init__(self, x, *cs, **name_RESIDUAL):
124
- '''New L{Fpolynomial} evaluation of the polynomial
125
- M{sum(cs[i] * x**i for i=0..len(cs)-1)}.
124
+ '''New L{Fpolynomial} evaluation of the polynomial M{sum(cs[i] * x**i for
125
+ i=0..len(cs)-1)}.
126
126
 
127
- @arg x: Polynomial argument (C{scalar} or an L{Fsum} or L{Fsum2Tuple}).
128
- @arg cs: Polynomial coeffients (each C{scalar} or an L{Fsum} or L{Fsum2Tuple}
129
- instance), all positional.
127
+ @arg x: Polynomial argument (C{scalar}, an L{Fsum} or L{Fsum2Tuple}).
128
+ @arg cs: Polynomial coeffients (each C{scalar}, an L{Fsum} or L{Fsum2Tuple}),
129
+ all positional.
130
130
  @kwarg name_RESIDUAL: Optional C{B{name}=NN} (C{str}) and the C{B{RESIDUAL}=0.0}
131
131
  threshold (C{scalar}) for raising L{ResidualError}s, see class
132
132
  L{Fsum<Fsum.__init__>}.
@@ -153,9 +153,9 @@ class Fpowers(Fsum):
153
153
  def __init__(self, power, *xs, **name_RESIDUAL_raiser):
154
154
  '''New L{Fpowers} sum of (the I{power} of) several bases.
155
155
 
156
- @arg power: The exponent (C{scalar} or an L{Fsum} or L{Fsum2Tuple}).
157
- @arg xs: One or more bases (each C{scalar} or an L{Fsum} or L{Fsum2Tuple} instance),
158
- all positional.
156
+ @arg power: The exponent (C{scalar}, an L{Fsum} or L{Fsum2Tuple}).
157
+ @arg xs: One or more bases (each C{scalar}, an L{Fsum} or L{Fsum2Tuple}), all
158
+ positional.
159
159
  @kwarg name_RESIDUAL_raiser: Optional C{B{name}=NN} (C{str}), the C{B{RESIDUAL}=0.0}
160
160
  threshold (C{scalar}) and C{B{raiser}=True} (C{bool}) for raising
161
161
  L{ResidualError}s, see class L{Fsum<Fsum.__init__>} and method
@@ -175,9 +175,9 @@ class Froot(Fsum):
175
175
  def __init__(self, root, *xs, **name_RESIDUAL_raiser):
176
176
  '''New L{Froot} root of a precision sum.
177
177
 
178
- @arg root: The order (C{scalar} or an L{Fsum} or L{Fsum2Tuple}), non-zero.
179
- @arg xs: Items to summate (each a C{scalar} or an L{Fsum} or L{Fsum2Tuple} instance),
180
- all positional.
178
+ @arg root: The order (C{scalar}, an L{Fsum} or L{Fsum2Tuple}), non-zero.
179
+ @arg xs: Items to summate (each a C{scalar}, an L{Fsum} or L{Fsum2Tuple}), all
180
+ positional.
181
181
  @kwarg name_RESIDUAL_raiser: Optional C{B{name}=NN} (C{str}), the C{B{RESIDUAL}=0.0}
182
182
  threshold (C{scalar}) and C{B{raiser}=True} (C{bool}) for raising
183
183
  L{ResidualError}s, see class L{Fsum<Fsum.__init__>} and method
@@ -226,7 +226,7 @@ def bqrt(x):
226
226
  '''Return the 4-th, I{bi-quadratic} or I{quartic} root, M{x**(1 / 4)},
227
227
  preserving C{type(B{x})}.
228
228
 
229
- @arg x: Value (C{scalar} or an L{Fsum} or L{Fsum2Tuple}).
229
+ @arg x: Value (C{scalar}, an L{Fsum} or L{Fsum2Tuple}).
230
230
 
231
231
  @return: I{Quartic} root (C{float} or an L{Fsum}).
232
232
 
@@ -256,7 +256,7 @@ except ImportError: # Python 3.10-
256
256
  def cbrt(x):
257
257
  '''Compute the cube root M{x**(1/3)}, preserving C{type(B{x})}.
258
258
 
259
- @arg x: Value (C{scalar} or an L{Fsum} or L{Fsum2Tuple}).
259
+ @arg x: Value (C{scalar}, an L{Fsum} or L{Fsum2Tuple}).
260
260
 
261
261
  @return: Cubic root (C{float} or L{Fsum}).
262
262
 
@@ -274,7 +274,7 @@ def cbrt(x):
274
274
  def cbrt2(x): # PYCHOK attr
275
275
  '''Compute the cube root I{squared} M{x**(2/3)}, preserving C{type(B{x})}.
276
276
 
277
- @arg x: Value (C{scalar} or an L{Fsum} or L{Fsum2Tuple}).
277
+ @arg x: Value (C{scalar}, an L{Fsum} or L{Fsum2Tuple}).
278
278
 
279
279
  @return: Cube root I{squared} (C{float} or L{Fsum}).
280
280
 
@@ -284,11 +284,11 @@ def cbrt2(x): # PYCHOK attr
284
284
 
285
285
 
286
286
  def euclid(x, y):
287
- '''I{Appoximate} the norm M{sqrt(x**2 + y**2)} by
288
- M{max(abs(x), abs(y)) + min(abs(x), abs(y)) * 0.4142...}.
287
+ '''I{Appoximate} the norm M{sqrt(x**2 + y**2)} by M{max(abs(x),
288
+ abs(y)) + min(abs(x), abs(y)) * 0.4142...}.
289
289
 
290
- @arg x: X component (C{scalar} or L{Fsum} instance).
291
- @arg y: Y component (C{scalar} or L{Fsum} instance).
290
+ @arg x: X component (C{scalar}, an L{Fsum} or L{Fsum2Tuple}).
291
+ @arg y: Y component (C{scalar}, an L{Fsum} or L{Fsum2Tuple}).
292
292
 
293
293
  @return: Appoximate norm (C{float} or L{Fsum}).
294
294
 
@@ -301,11 +301,11 @@ def euclid(x, y):
301
301
 
302
302
 
303
303
  def euclid_(*xs):
304
- '''I{Appoximate} the norm M{sqrt(sum(x**2 for x in xs))} by
305
- cascaded L{euclid}.
304
+ '''I{Appoximate} the norm M{sqrt(sum(x**2 for x in xs))} by cascaded
305
+ L{euclid}.
306
306
 
307
- @arg xs: X arguments (each C{scalar} or an L{Fsum}
308
- instance), all positional.
307
+ @arg xs: X arguments (each C{scalar}, an L{Fsum} or L{Fsum2Tuple}),
308
+ all positional.
309
309
 
310
310
  @return: Appoximate norm (C{float} or L{Fsum}).
311
311
 
@@ -404,10 +404,10 @@ def fatan2(y, x):
404
404
 
405
405
 
406
406
  def favg(a, b, f=_0_5):
407
- '''Return the precision average of two values.
407
+ '''Return the precise average of two values.
408
408
 
409
- @arg a: One (C{scalar} or an L{Fsum} or L{Fsum2Tuple}).
410
- @arg b: Other (C{scalar} or an L{Fsum} or L{Fsum2Tuple}).
409
+ @arg a: One (C{scalar}, an L{Fsum} or L{Fsum2Tuple}).
410
+ @arg b: Other (C{scalar}, an L{Fsum} or L{Fsum2Tuple}).
411
411
  @kwarg f: Optional fraction (C{float}).
412
412
 
413
413
  @return: M{a + f * (b - a)} (C{float}).
@@ -421,11 +421,11 @@ def favg(a, b, f=_0_5):
421
421
 
422
422
 
423
423
  def fdot(a, *b):
424
- '''Return the precision dot product M{sum(a[i] * b[i] for
425
- i=0..len(a))}.
424
+ '''Return the precision dot product M{sum(a[i] * b[i] for ni=0..len(a))}.
426
425
 
427
- @arg a: Iterable of values (each C{scalar}).
428
- @arg b: Other values (each C{scalar}), all positional.
426
+ @arg a: Iterable of values (each C{scalar}, an L{Fsum} or L{Fsum2Tuple}).
427
+ @arg b: Other values (each C{scalar}, an L{Fsum} or L{Fsum2Tuple}), all
428
+ positional.
429
429
 
430
430
  @return: Dot product (C{float}).
431
431
 
@@ -438,22 +438,17 @@ def fdot(a, *b):
438
438
 
439
439
 
440
440
  def fdot3(xs, ys, zs, start=0):
441
- '''Return the precision dot product M{start +
442
- sum(a[i] * b[i] * c[i] for i=0..len(a)-1)}.
443
-
444
- @arg xs: Iterable (each C{scalar} or an L{Fsum} or
445
- L{Fsum2Tuple} instance).
446
- @arg ys: Iterable (each C{scalar} or an L{Fsum} or
447
- L{Fsum2Tuple} instance).
448
- @arg zs: Iterable (each C{scalar} or an L{Fsum} or
449
- L{Fsum2Tuple} instance).
450
- @kwarg start: Optional bias (C{scalar} or an L{Fsum}
451
- or L{Fsum2Tuple}).
441
+ '''Return the precision dot product M{start + sum(a[i] * b[i] * c[i]
442
+ for i=0..len(a)-1)}.
443
+
444
+ @arg xs: Iterable (each C{scalar}, an L{Fsum} or L{Fsum2Tuple}).
445
+ @arg ys: Iterable (each C{scalar}, an L{Fsum} or L{Fsum2Tuple}).
446
+ @arg zs: Iterable (each C{scalar}, an L{Fsum} or L{Fsum2Tuple}).
447
+ @kwarg start: Optional bias (C{scalar}, an L{Fsum} or L{Fsum2Tuple}).
452
448
 
453
449
  @return: Dot product (C{float}).
454
450
 
455
- @raise LenError: Unequal C{len(B{xs})}, C{len(B{ys})}
456
- and/or C{len(B{zs})}.
451
+ @raise LenError: Unequal C{len(B{xs})}, C{len(B{ys})} and/or C{len(B{zs})}.
457
452
 
458
453
  @raise OverflowError: Partial C{2sum} overflow.
459
454
  '''
@@ -462,9 +457,8 @@ def fdot3(xs, ys, zs, start=0):
462
457
  yield s
463
458
  if p:
464
459
  yield _1_0
465
- _F = Fsum
466
460
  for x, y, z in zip(xs, ys, zs):
467
- yield (_F(x) * y) * z
461
+ yield (Fsum(x) * y) * z
468
462
  if p:
469
463
  yield _N_1_0
470
464
 
@@ -475,15 +469,16 @@ def fdot3(xs, ys, zs, start=0):
475
469
  return fsum(_mul3(xs, ys, zs, start, n < 4))
476
470
 
477
471
 
478
- def fhorner(x, *cs):
479
- '''Evaluate the polynomial M{sum(cs[i] * x**i for
480
- i=0..len(cs)-1)} using the Horner form.
472
+ def fhorner(x, *cs, **incx):
473
+ '''Evaluate a polynomial using the Horner form M{sum(cs[i] * x**i
474
+ for i=0..n)} or if C{B{incx}=False} for decreasing exponent
475
+ M{sum(... i=n..0)} where C{n = len(cs) - 1}.
481
476
 
482
477
  @return: Horner sum (C{float}).
483
478
 
484
479
  @see: Class L{Fhorner} for further details.
485
480
  '''
486
- H = Fhorner(x, *cs)
481
+ H = Fhorner(x, *cs, **incx)
487
482
  return float(H)
488
483
 
489
484
 
@@ -491,10 +486,9 @@ def fidw(xs, ds, beta=2):
491
486
  '''Interpolate using U{Inverse Distance Weighting
492
487
  <https://WikiPedia.org/wiki/Inverse_distance_weighting>} (IDW).
493
488
 
494
- @arg xs: Known values (each C{scalar} or an L{Fsum} or
495
- L{Fsum2Tuple} instance).
496
- @arg ds: Non-negative distances (each C{scalar} or an L{Fsum}
497
- or L{Fsum2Tuple} instance).
489
+ @arg xs: Known values (each C{scalar}, an L{Fsum} or L{Fsum2Tuple}).
490
+ @arg ds: Non-negative distances (each C{scalar}, an L{Fsum} or
491
+ L{Fsum2Tuple}).
498
492
  @kwarg beta: Inverse distance power (C{int}, 0, 1, 2, or 3).
499
493
 
500
494
  @return: Interpolated value C{x} (C{float}).
@@ -550,10 +544,22 @@ def fidw(xs, ds, beta=2):
550
544
  return x
551
545
 
552
546
 
547
+ def fma(x, y, z):
548
+ '''Fused-multiply-add, as C{math.fma(x, y, z)} from Python 3.13+.
549
+
550
+ @arg x: A C{scalar}, an L{Fsum} or L{Fsum2Tuple} instance.
551
+ @arg y: A C{scalar}, an L{Fsum} or L{Fsum2Tuple} instance.
552
+ @arg z: A C{scalar}, an L{Fsum} or L{Fsum2Tuple} instance.
553
+
554
+ @return: C{(x * y) + z} (C{float} or an L{Fsum}).
555
+ '''
556
+ return Fsum(x).fma(y, z).as_iscalar
557
+
558
+
553
559
  def fmean(xs):
554
560
  '''Compute the accurate mean M{sum(xs) / len(xs)}.
555
561
 
556
- @arg xs: Values (C{scalar} or L{Fsum} instances).
562
+ @arg xs: Values (each C{scalar}, or L{Fsum} or L{Fsum2Tuple}).
557
563
 
558
564
  @return: Mean value (C{float}).
559
565
 
@@ -576,8 +582,8 @@ def fmean_(*xs):
576
582
 
577
583
 
578
584
  def fpolynomial(x, *cs, **over):
579
- '''Evaluate the polynomial M{sum(cs[i] * x**i for
580
- i=0..len(cs)) [/ over]}.
585
+ '''Evaluate the polynomial M{sum(cs[i] * x**i for i=0..len(cs))
586
+ [/ over]}.
581
587
 
582
588
  @kwarg over: Optional final, I{non-zero} divisor (C{scalar}).
583
589
 
@@ -593,7 +599,7 @@ def fpolynomial(x, *cs, **over):
593
599
  def fpowers(x, n, alts=0):
594
600
  '''Return a series of powers M{[x**i for i=1..n]}.
595
601
 
596
- @arg x: Value (C{scalar} or an L{Fsum} or L{Fsum2Tuple}).
602
+ @arg x: Value (C{scalar}, an L{Fsum} or L{Fsum2Tuple}).
597
603
  @arg n: Highest exponent (C{int}).
598
604
  @kwarg alts: Only alternating powers, starting with this
599
605
  exponent (C{int}).
@@ -627,7 +633,7 @@ except ImportError:
627
633
  '''Iterable product, like C{math.prod} or C{numpy.prod}.
628
634
 
629
635
  @arg xs: Iterable of values to be multiplied (each
630
- C{scalar} or an L{Fsum}).
636
+ C{scalar}, an L{Fsum} or L{Fsum2Tuple}).
631
637
  @kwarg start: Initial value, also the value returned
632
638
  for an empty B{C{xs}} (C{scalar}).
633
639
 
@@ -822,8 +828,8 @@ def hypot1(x):
822
828
  def hypot2(x, y):
823
829
  '''Compute the I{squared} norm M{x**2 + y**2}.
824
830
 
825
- @arg x: X (C{scalar} or L{Fsum} or L{Fsum2Tuple}).
826
- @arg y: Y (C{scalar} or L{Fsum} or L{Fsum2Tuple}).
831
+ @arg x: X (C{scalar}, an L{Fsum} or L{Fsum2Tuple}).
832
+ @arg y: Y (C{scalar}, an L{Fsum} or L{Fsum2Tuple}).
827
833
 
828
834
  @return: C{B{x}**2 + B{y}**2} (C{float}).
829
835
  '''
@@ -843,8 +849,8 @@ def hypot2(x, y):
843
849
  def hypot2_(*xs):
844
850
  '''Compute the I{squared} norm C{fsum(x**2 for x in B{xs})}.
845
851
 
846
- @arg xs: Components (each C{scalar} or an L{Fsum} or
847
- L{Fsum2Tuple} instance), all positional.
852
+ @arg xs: Components (each C{scalar}, an L{Fsum} or
853
+ L{Fsum2Tuple}), all positional.
848
854
 
849
855
  @return: Squared norm (C{float}).
850
856
 
@@ -886,6 +892,7 @@ def norm2(x, y):
886
892
  or zero norm.
887
893
  '''
888
894
  try:
895
+ h = None
889
896
  h = hypot(x, y)
890
897
  if h:
891
898
  x, y = (x / h), (y / h)
@@ -898,9 +905,10 @@ def norm2(x, y):
898
905
 
899
906
 
900
907
  def norm_(*xs):
901
- '''Normalize all n-dimensional vector components.
908
+ '''Normalize the components of an n-dimensional vector.
902
909
 
903
- @arg xs: Components (C{scalar}s), all positional.
910
+ @arg xs: Components (each C{scalar}, an L{Fsum} or
911
+ L{Fsum2Tuple}), all positional.
904
912
 
905
913
  @return: Yield each component, normalized.
906
914
 
@@ -943,7 +951,7 @@ def sqrt0(x, Error=None):
943
951
  '''Return the square root C{sqrt(B{x})} iff C{B{x} > }L{EPS02},
944
952
  preserving C{type(B{x})}.
945
953
 
946
- @arg x: Value (C{scalar} or an L{Fsum} or L{Fsum2Tuple}).
954
+ @arg x: Value (C{scalar}, an L{Fsum} or L{Fsum2Tuple}).
947
955
  @kwarg Error: Error to raise for negative B{C{x}}.
948
956
 
949
957
  @return: Square root (C{float} or L{Fsum}) or C{0.0}.
@@ -955,14 +963,15 @@ def sqrt0(x, Error=None):
955
963
  '''
956
964
  if Error and x < 0:
957
965
  raise Error(unstr(sqrt0, x))
958
- return _root(x, _0_5, sqrt0) if x > EPS02 else (_0_0 if x < EPS02 else EPS0)
966
+ return _root(x, _0_5, sqrt0) if x > EPS02 else (
967
+ _0_0 if x < EPS02 else EPS0)
959
968
 
960
969
 
961
970
  def sqrt3(x):
962
971
  '''Return the square root, I{cubed} M{sqrt(x)**3} or M{sqrt(x**3)},
963
972
  preserving C{type(B{x})}.
964
973
 
965
- @arg x: Value (C{scalar} or an L{Fsum} or L{Fsum2Tuple}).
974
+ @arg x: Value (C{scalar}, an L{Fsum} or L{Fsum2Tuple}).
966
975
 
967
976
  @return: Square root I{cubed} (C{float} or L{Fsum}).
968
977
 
@@ -1018,7 +1027,7 @@ def zcrt(x):
1018
1027
  '''Return the 6-th, I{zenzi-cubic} root, M{x**(1 / 6)},
1019
1028
  preserving C{type(B{x})}.
1020
1029
 
1021
- @arg x: Value (C{scalar} or an L{Fsum} or L{Fsum2Tuple}).
1030
+ @arg x: Value (C{scalar}, an L{Fsum} or L{Fsum2Tuple}).
1022
1031
 
1023
1032
  @return: I{Zenzi-cubic} root (C{float} or L{Fsum}).
1024
1033
 
@@ -1035,7 +1044,7 @@ def zqrt(x):
1035
1044
  '''Return the 8-th, I{zenzi-quartic} or I{squared-quartic} root,
1036
1045
  M{x**(1 / 8)}, preserving C{type(B{x})}.
1037
1046
 
1038
- @arg x: Value (C{scalar} or an L{Fsum} or L{Fsum2Tuple}).
1047
+ @arg x: Value (C{scalar}, an L{Fsum} or L{Fsum2Tuple}).
1039
1048
 
1040
1049
  @return: I{Zenzi-quartic} root (C{float} or L{Fsum}).
1041
1050