# HG changeset patch
# User Jens Rasch <jyr2000@gmail.com>
# Date 1244977722 -3600
# Node ID a3427ba1dfd0b77e1b600cc0ab8180b1408d46e4
# Parent 0d484bf601d041e7ea1c0089d819100f4db0ce70
All functions now have doc tests, redundant functions
test_calc_factlist() and test_bigDeltacoeff() have been removed.
diff -r 0d484bf601d0 -r a3427ba1dfd0 sage/functions/wigner.py
|
a
|
b
|
|
| 42 | 42 | _Factlist=[1] |
| 43 | 43 | |
| 44 | 44 | def _calc_factlist(nn): |
| 45 | | if nn>=len(_Factlist): |
| 46 | | for ii in range(len(_Factlist),nn+1): |
| 47 | | _Factlist.append(_Factlist[ii-1]*ii) |
| 48 | | #_Factlist.append(factorial(ii)) |
| 49 | | #return _Factlist |
| 50 | | |
| 51 | | |
| 52 | | def test_calc_factlist(nn): |
| 53 | 45 | r""" |
| 54 | 46 | Function calculates a list of precomputed factorials in order to |
| 55 | 47 | massively accelerate future calculations of the various |
| … |
… |
|
| 68 | 60 | |
| 69 | 61 | Calculate list of factorials: |
| 70 | 62 | |
| 71 | | sage: from sage.functions.wigner import test_calc_factlist |
| 72 | | sage: test_calc_factlist(10) |
| | 63 | sage: from sage.functions.wigner import _calc_factlist |
| | 64 | sage: _calc_factlist(10) |
| 73 | 65 | [1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880, 3628800] |
| 74 | 66 | """ |
| 75 | | _calc_factlist(nn) |
| 76 | | return _Factlist[:nn+1] |
| | 67 | if nn>=len(_Factlist): |
| | 68 | for ii in range(len(_Factlist),nn+1): |
| | 69 | _Factlist.append(_Factlist[ii-1]*ii) |
| | 70 | #_Factlist.append(factorial(ii)) |
| | 71 | return _Factlist[:Integer(nn)+1] |
| | 72 | |
| 77 | 73 | |
| 78 | 74 | |
| 79 | 75 | |
| … |
… |
|
| 353 | 349 | |
| 354 | 350 | double - Value of the Delta coefficient |
| 355 | 351 | |
| | 352 | |
| | 353 | EXAMPLES: |
| | 354 | |
| | 355 | Simple examples: |
| | 356 | |
| | 357 | sage: from sage.functions.wigner import _bigDeltacoeff |
| | 358 | sage: _bigDeltacoeff(1,1,1) |
| | 359 | 1/2*sqrt(1/6) |
| | 360 | |
| 356 | 361 | """ |
| 357 | 362 | |
| 358 | 363 | if(int(aa+bb-cc)!=(aa+bb-cc)): |
| … |
… |
|
| 384 | 389 | else: |
| 385 | 390 | res=ressqrt |
| 386 | 391 | return res |
| 387 | | |
| 388 | | |
| 389 | | def test_bigDeltacoeff(aa,bb,cc,prec=None): |
| 390 | | r""" |
| 391 | | Test for the Delta coefficient of the 3 angular momenta for |
| 392 | | Racah symbols. Also checks that the differences are of integer |
| 393 | | value. |
| 394 | | |
| 395 | | INPUT: |
| 396 | | |
| 397 | | - aa - first angular momentum, integer or half integer |
| 398 | | - bb - second angular momentum, integer or half integer |
| 399 | | - cc - third angular momentum, integer or half integer |
| 400 | | - prec - precision of the sqrt() calculation |
| 401 | | |
| 402 | | OUTPUT: |
| 403 | | |
| 404 | | double - Value of the Delta coefficient |
| 405 | | |
| 406 | | EXAMPLES: |
| 407 | | |
| 408 | | Simple examples: |
| 409 | | |
| 410 | | sage: from sage.functions.wigner import test_bigDeltacoeff |
| 411 | | sage: test_bigDeltacoeff(1,1,1) |
| 412 | | 1/2*sqrt(1/6) |
| 413 | | |
| 414 | | """ |
| 415 | | |
| 416 | | return _bigDeltacoeff(aa,bb,cc,prec) |
| 417 | 392 | |
| 418 | 393 | |
| 419 | 394 | |