Révision 228 pobysoPythonSage/src/pobyso.py
pobyso.py (revision 228) | ||
---|---|---|
375 | 375 |
if precSa is None: |
376 | 376 |
precSa = polySa.parent().base_ring().precision() |
377 | 377 |
if (precSa > initialSollyaPrecSa): |
378 |
assert precSa >= 2, "Precision change <2 requested" |
|
378 | 379 |
if precSa <= 2: |
379 | 380 |
print inspect.stack()[0][3], ": precision change <= 2 requested" |
380 | 381 |
precSo = pobyso_constant_from_int(precSa) |
... | ... | |
1548 | 1549 |
debug=False): |
1549 | 1550 |
if debug: |
1550 | 1551 |
print "Input arguments:" |
1551 |
print "Polynomia:l", ; pobyso_autoprint(polySo)
|
|
1552 |
print "Function:", ; pobyso_autoprint(funcSo) |
|
1553 |
print "Internal precision:", ; pobyso_autoprint(precSo) |
|
1554 |
print "Interval:", ; pobyso_autoprint(intervalSo) |
|
1555 |
print "Current approximation error:", ; pobyso_autoprint(currentApproxErrorSo) |
|
1556 |
print "Requested approxiation error:", ; pobyso_autoprint(approxAccurSo) |
|
1552 |
print "Polynomial: ", ; pobyso_autoprint(polySo)
|
|
1553 |
print "Function: ", ; pobyso_autoprint(funcSo)
|
|
1554 |
print "Internal precision: ", ; pobyso_autoprint(precSo)
|
|
1555 |
print "Interval: ", ; pobyso_autoprint(intervalSo)
|
|
1556 |
print "Current approximation error: ", ; pobyso_autoprint(currentApproxErrorSo)
|
|
1557 |
print "Requested approxiation error: ", ; pobyso_autoprint(approxAccurSo)
|
|
1557 | 1558 |
print "________________" |
1558 | 1559 |
approxAccurSa = pobyso_get_constant_as_rn_so_sa(approxAccurSo) |
1559 | 1560 |
currentApproxErrorSa = pobyso_get_constant_as_rn_so_sa(currentApproxErrorSo) |
... | ... | |
1565 | 1566 |
intervalSa = pobyso_range_to_interval_so_sa(intervalSo) |
1566 | 1567 |
|
1567 | 1568 |
if debug: |
1568 |
print "degreeSa :", degreeSa |
|
1569 |
print "intervalSa:", intervalSa.str(style='brackets') |
|
1569 |
print "degreeSa :", degreeSa
|
|
1570 |
print "intervalSa :", intervalSa.str(style='brackets')
|
|
1570 | 1571 |
print "currentApproxErrorSa :", currentApproxErrorSa |
1571 |
print "approxAccurSa :", approxAccurSa |
|
1572 |
print "approxAccurSa :", approxAccurSa
|
|
1572 | 1573 |
### Start with a 0 value expression. |
1573 | 1574 |
radiusSa = intervalSa.absolute_diameter() / 2 |
1574 | 1575 |
if debug: |
... | ... | |
1587 | 1588 |
else: |
1588 | 1589 |
roundingPowerSa = \ |
1589 | 1590 |
floor(((currentRadiusPowerSa/roundedPolyApproxAccurSa)*(degreeSa+1)).log2()) |
1591 |
## Under extreme conditions the above formulas can evaluate under 2, which is the |
|
1592 |
# minimal precision of an MPFR number. |
|
1593 |
if roundingPowerSa < 2: |
|
1594 |
roundingPowerSa = 2 |
|
1590 | 1595 |
if debug: |
1591 | 1596 |
print "roundedPolyApproxAccurSa", roundedPolyApproxAccurSa |
1592 | 1597 |
print "currentRadiusPowerSa", currentRadiusPowerSa |
... | ... | |
1701 | 1706 |
errorTypeIsNone = False |
1702 | 1707 |
# |
1703 | 1708 |
if accuracySo is None: |
1704 |
# Notice the **! |
|
1709 |
# Notice the **: we are in Pythonland!
|
|
1705 | 1710 |
accuracySo = pobyso_constant_sa_so(RR(2**(-40))) |
1706 | 1711 |
accuracyIsNone = True |
1707 | 1712 |
else: |
Formats disponibles : Unified diff