Révision 254 pobysoPythonSage/src/sageSLZ/sageRunSLZ.sage
sageRunSLZ.sage (revision 254) | ||
---|---|---|
3502 | 3502 |
|
3503 | 3503 |
if debug: |
3504 | 3504 |
print "Function :", inputFunction |
3505 |
print "Lower bound :", inputLowerBound |
|
3506 |
print "Upper bounds :", inputUpperBound |
|
3505 |
print "Lower bound :", inputLowerBound.str(truncate=False)
|
|
3506 |
print "Upper bounds :", inputUpperBound.str(truncate=False)
|
|
3507 | 3507 |
print "Alpha :", alpha |
3508 | 3508 |
print "Degree :", degree |
3509 | 3509 |
print "Precision :", precision |
... | ... | |
3530 | 3530 |
lowerBound = RRR(inputLowerBound) |
3531 | 3531 |
upperBound = RRR(inputUpperBound) |
3532 | 3532 |
## Before going any further, check domain and image binade conditions. |
3533 |
print inputFunction(1).n() |
|
3533 |
print inputFunction._assume_str(), "at 1:", inputFunction(1).n()
|
|
3534 | 3534 |
output = slz_fix_bounds_for_binades(lowerBound, upperBound, inputFunction) |
3535 |
#print "srsv04p:", output, (output is None) |
|
3536 |
# |
|
3537 |
## Check if input to thr fix_bounds function is valid. |
|
3535 | 3538 |
if output is None: |
3536 | 3539 |
print "Invalid domain/image binades. Domain:",\ |
3537 |
lowerBound, upperBound, "Images:", \ |
|
3540 |
lowerBound.str(truncate=False), upperBound(truncate=False), \ |
|
3541 |
"Images:", \ |
|
3538 | 3542 |
inputFunction(lowerBound), inputFunction(upperBound) |
3539 | 3543 |
raise Exception("Invalid domain/image binades.") |
3540 | 3544 |
lb = output[0] ; ub = output[1] |
3545 |
# |
|
3546 |
## Check if bounds have changed. |
|
3541 | 3547 |
if lb != lowerBound or ub != upperBound: |
3542 |
print "lb:", lb, " - ub:", ub |
|
3543 |
print "Invalid domain/image binades. Domain:",\ |
|
3544 |
lowerBound, upperBound, "Images:", \ |
|
3548 |
print "lb:", lb.str(truncate=False), " - ub:", ub.str(truncate=False) |
|
3549 |
print "Invalid domain/image binades." |
|
3550 |
print "Domain:", lowerBound, upperBound |
|
3551 |
print "Images:", \ |
|
3545 | 3552 |
inputFunction(lowerBound), inputFunction(upperBound) |
3546 | 3553 |
raise Exception("Invalid domain/image binades.") |
3547 | 3554 |
# |
... | ... | |
3568 | 3575 |
pobyso_name_free_variable_sa_so(str(function.variables()[0])) |
3569 | 3576 |
## Compute the scaled function and the degree, in their Sollya version |
3570 | 3577 |
# once for all. |
3578 |
#print "srsvp initial bounds:",lowerBound, upperBound |
|
3571 | 3579 |
(scaledf, sdlb, sdub, silb, siub) = \ |
3572 | 3580 |
slz_compute_scaled_function(function, lowerBound, upperBound, precision) |
3573 | 3581 |
print "Scaled function:", scaledf._assume_str().replace('_SAGE_VAR_', '') |
3574 |
#print "Scaled bounds:", sdlb, sdub |
|
3582 |
#print "srsvp Scaled bounds:", sdlb, sdub
|
|
3575 | 3583 |
scaledfSo = sollya_lib_parse_string(scaledf._assume_str().replace('_SAGE_VAR_', '')) |
3576 | 3584 |
degreeSo = pobyso_constant_from_int_sa_so(degree) |
3577 | 3585 |
# |
... | ... | |
3807 | 3815 |
iRootsSet = set() |
3808 | 3816 |
hasNonNullResultant = False |
3809 | 3817 |
for polyPair in polyPairsList: |
3810 |
resultantsComputationTime = cputime()
|
|
3818 |
resultantsComputationTime = cputime() |
|
3811 | 3819 |
currentResultantI = \ |
3812 | 3820 |
slz_resultant(polyPair[0], |
3813 | 3821 |
polyPair[1], |
... | ... | |
3835 | 3843 |
rootsComputationsFullTime = cputime(rootsComputationTime) |
3836 | 3844 |
if len(iRootsList) == 0: |
3837 | 3845 |
print "No roots in \"i\"." |
3838 |
break # No roots in i. |
|
3846 |
#break # No roots in i.
|
|
3839 | 3847 |
else: |
3840 | 3848 |
for iRoot in iRootsList: |
3841 | 3849 |
# A root is given as a (value, multiplicity) tuple. |
3842 | 3850 |
iRootsSet.add(iRoot[0]) |
3851 |
print "Root added." |
|
3852 |
#### A non null, non constant resultant has been tested |
|
3853 |
# for. There is no need to check for another one. Break |
|
3854 |
# whether roots are found or not. |
|
3855 |
break |
|
3843 | 3856 |
# End loop for polyPair in polyParsList. We only loop again if a |
3844 | 3857 |
# None or zero resultant is found. |
3845 | 3858 |
#### Prepare for results for the current interval.. |
Formats disponibles : Unified diff