Révision 156
pobysoPythonSage/src/sageSLZ/sageSLZ.sage (revision 156) | ||
---|---|---|
437 | 437 |
precision is reached. |
438 | 438 |
The polynomial, the bounds, the center of the interval and the error |
439 | 439 |
are returned. |
440 |
OUTPU: |
|
440 |
OUTPUT:
|
|
441 | 441 |
A tuple made of 4 Sollya objects: |
442 | 442 |
- a polynomial; |
443 | 443 |
- an range (an interval, not in the sense of number given as an interval); |
... | ... | |
643 | 643 |
def slz_compute_scaled_function(functionSa, |
644 | 644 |
lowerBoundSa, |
645 | 645 |
upperBoundSa, |
646 |
floatingPointPrecSa): |
|
646 |
floatingPointPrecSa, |
|
647 |
debug=False): |
|
647 | 648 |
""" |
648 | 649 |
From a function, compute the scaled function whose domain |
649 | 650 |
is included in [1, 2) and whose image is also included in [1,2). |
... | ... | |
662 | 663 |
domainBoundsIntervalSa = boundsIntervalRifSa(lowerBoundSa, upperBoundSa) |
663 | 664 |
(domainScalingExpressionSa, invDomainScalingExpressionSa) = \ |
664 | 665 |
slz_interval_scaling_expression(domainBoundsIntervalSa, x) |
665 |
print "domainScalingExpression for argument :", invDomainScalingExpressionSa |
|
666 |
print "f: ", f |
|
666 |
if debug: |
|
667 |
print "domainScalingExpression for argument :", \ |
|
668 |
invDomainScalingExpressionSa |
|
669 |
print "f: ", f |
|
667 | 670 |
ff = f.subs({x : domainScalingExpressionSa}) |
668 | 671 |
#ff = f.subs_expr(x==domainScalingExpressionSa) |
669 | 672 |
domainScalingFunction(x) = invDomainScalingExpressionSa |
... | ... | |
671 | 674 |
domainScalingFunction(lowerBoundSa).n(prec=floatingPointPrecSa) |
672 | 675 |
scaledUpperBoundSa = \ |
673 | 676 |
domainScalingFunction(upperBoundSa).n(prec=floatingPointPrecSa) |
674 |
print 'ff:', ff, "- Domain:", scaledLowerBoundSa, scaledUpperBoundSa |
|
677 |
if debug: |
|
678 |
print 'ff:', ff, "- Domain:", scaledLowerBoundSa, \ |
|
679 |
scaledUpperBoundSa |
|
675 | 680 |
# |
676 | 681 |
# Scalling the image -> [1,2[. |
677 | 682 |
flbSa = ff(scaledLowerBoundSa).n(prec=floatingPointPrecSa) |
... | ... | |
680 | 685 |
imageBinadeBottomSa = floor(flbSa.log2()) |
681 | 686 |
else: # Decreasing |
682 | 687 |
imageBinadeBottomSa = floor(fubSa.log2()) |
683 |
print 'ff:', ff, '- Image:', flbSa, fubSa, imageBinadeBottomSa |
|
688 |
if debug: |
|
689 |
print 'ff:', ff, '- Image:', flbSa, fubSa, imageBinadeBottomSa |
|
684 | 690 |
imageBoundsIntervalSa = boundsIntervalRifSa(flbSa, fubSa) |
685 | 691 |
(imageScalingExpressionSa, invImageScalingExpressionSa) = \ |
686 | 692 |
slz_interval_scaling_expression(imageBoundsIntervalSa, x) |
687 |
print "imageScalingExpression for argument :", invImageScalingExpressionSa |
|
693 |
if debug: |
|
694 |
print "imageScalingExpression for argument :", \ |
|
695 |
invImageScalingExpressionSa |
|
688 | 696 |
iis = invImageScalingExpressionSa.function(x) |
689 | 697 |
fff = iis.subs({x:ff}) |
690 |
print "fff:", fff, |
|
691 |
print " - Image:", fff(scaledLowerBoundSa), fff(scaledUpperBoundSa) |
|
698 |
if debug: |
|
699 |
print "fff:", fff, |
|
700 |
print " - Image:", fff(scaledLowerBoundSa), fff(scaledUpperBoundSa) |
|
692 | 701 |
return([fff, scaledLowerBoundSa, scaledUpperBoundSa, \ |
693 | 702 |
fff(scaledLowerBoundSa), fff(scaledUpperBoundSa)]) |
694 | 703 |
# End slz_compute_scaled_function |
Formats disponibles : Unified diff