Révision 63 pobysoPythonSage/src/sageSLZ.sage
| sageSLZ.sage (revision 63) | ||
|---|---|---|
| 56 | 56 |
return((polySo, currentRangeSo, intervalCenterSo, maxErrorSo)) |
| 57 | 57 |
# End slz_compute_polynomial_and_interval |
| 58 | 58 |
|
| 59 |
def slz_get_intervals_and_polynomials(functionSa, degreeSa, lowerBoundSa, |
|
| 59 |
def slz_get_intervals_and_polynomials(functionSa, variableNameSa, degreeSa, |
|
| 60 |
lowerBoundSa, |
|
| 60 | 61 |
upperBoundSa, floatingPointPrecSa, |
| 61 | 62 |
internalSollyaPrecSa): |
| 62 | 63 |
""" |
| ... | ... | |
| 82 | 83 |
- the center, x0, of the interval (the polynomial is defined as p(x-x0)); |
| 83 | 84 |
- the corresponding approximation error. |
| 84 | 85 |
""" |
| 86 |
x = var(variableNameSa) |
|
| 85 | 87 |
# Scalling the domain -> [1,2[. |
| 86 | 88 |
boundsIntervalRifSa = RealIntervalField(floatingPointPrecSa) |
| 87 | 89 |
domainBoundsIntervalSa = boundsIntervalRifSa(lowerBoundSa, upperBoundSa) |
| 88 | 90 |
(domainScalingExpressionSa, invDomainScalingExpressionSa) = \ |
| 89 |
slz_interval_scaling_expression(domainBoundsIntervalSa, 'x')
|
|
| 91 |
slz_interval_scaling_expression(domainBoundsIntervalSa, variableNameSa)
|
|
| 90 | 92 |
print "domainScalingExpression for argument :", domainScalingExpressionSa |
| 91 |
ff(x) = f(domainScalingExpressionSa) |
|
| 93 |
print "f: ", f |
|
| 94 |
ff = f.subs({x:domainScalingExpressionSa})
|
|
| 92 | 95 |
scaledLowerBoundSa = invDomainScalingExpressionSa(lowerBoundSa).n() |
| 93 | 96 |
scaledUpperBoundSa = invDomainScalingExpressionSa(upperBoundSa).n() |
| 94 | 97 |
print 'ff:', ff, "- Domain:", scaledLowerBoundSa, scaledUpperBoundSa |
| ... | ... | |
| 103 | 106 |
print 'ff:', ff, '- Image:', flbSa, fubSa, imageBinadeBottomSa |
| 104 | 107 |
imageBoundsIntervalSa = boundsIntervalRifSa(flbSa, fubSa) |
| 105 | 108 |
(imageScalingExpressionSa, invImageScalingExpressionSa) = \ |
| 106 |
slz_interval_scaling_expression(imageBoundsIntervalSa, 'x') |
|
| 107 |
fff(x) = invImageScalingExpressionSa(ff(x)) |
|
| 109 |
slz_interval_scaling_expression(imageBoundsIntervalSa, variableNameSa) |
|
| 110 |
iis = invImageScalingExpressionSa.function(x) |
|
| 111 |
fff = iis.subs({x:ff})
|
|
| 108 | 112 |
print "fff:", fff, |
| 109 | 113 |
print " - Image:", fff(scaledLowerBoundSa), fff(scaledUpperBoundSa) |
| 110 | 114 |
# |
Formats disponibles : Unified diff