Révision 79 pobysoPythonSage/src/sageSLZ/sageSLZ.sage

sageSLZ.sage (revision 79)
104 104
    return([fff, scaledLowerBoundSa, scaledUpperBoundSa, \
105 105
            fff(scaledLowerBoundSa), fff(scaledUpperBoundSa)])
106 106

  
107
def slz_float_poly_of_float_to_rat_poly_of_rat(polyOfFloat):
108
    # Create a polynomial over the rationals.
109
    polynomialRing = QQ[str(polyOfFloat.variables()[0])]
110
    return(polynomialRing(polyOfFloat))
111
# End slz_float_poly_of_float_to_rat_poly_of_rat
112
     
107 113
def slz_get_intervals_and_polynomials(functionSa, variableNameSa, degreeSa, 
108 114
                                      lowerBoundSa, 
109 115
                                      upperBoundSa, floatingPointPrecSa, 
......
122 128
    The initial interval is, possibly, splitted into smaller intervals.
123 129
    It return a list of tuples, each made of:
124 130
    - a first polynomial (without the changed variable f(x) = p(x-x0));
125
    - a second polynomila (with a changed variable f(x) = q(x))
131
    - a second polynomial (with a changed variable f(x) = q(x))
126 132
    - the approximation interval;
127 133
    - the center, x0, of the interval;
128 134
    - the corresponding approximation error.
......
241 247
    Compute the Sage version of the Taylor polynomial and it's
242 248
    companion data (interval, center...)
243 249
    The input parameter is a five elements tuple:
244
    - [0]: the polyomial (without variable change);
245
    - [1]: the polyomial (with variable change done in Sollya);
250
    - [0]: the polyomial (without variable change), as polynomial over a
251
           real ring;
252
    - [1]: the polyomial (with variable change done in Sollya), as polynomial
253
           over a real ring;
246 254
    - [2]: the interval (as Sollya range);
247 255
    - [3]: the interval center;
248 256
    - [4]: the approximation error. 
......
261 269
    return((polynomialSa, polynomialChangedVarSa, intervalSa, centerSa, errorSa))
262 270
    # End slz_polynomial_and_interval_to_sage
263 271

  
272
def slz_rat_poly_of_int_to_int_poly_of_int(ratPolyOfInt):
273
    pass
274
# End slz_ratPoly_of_int_to_int_poly_of_int
275

  
276
def slz_rat_poly_of_rat_to_rat_poly_of_int(ratPolyOfRat, 
277
                                          precision):
278
    """
279
    Makes a variable substitution into the input polynomial so that the output
280
    polynomial can take integer arguments.
281
    All variables of the input polynomial "have precision p". That is to say
282
    that they are rationals with denominator == 2^precision: x = y/2^precision
283
    We "incorporate" these denominators into the coefficients with, 
284
    respectively, the "right" power.
285
    """
286
    polynomialField = ratPolyOfRat.parent()
287
    polynomialVariable = rationalPolynomial.variables()[0]
288
    print "The polynomial field is:", polynomialField
289
    return \
290
        polynomialField(rationalPolynomial.subs({polynomialVariable : \
291
                                   polynomialVariable/2^(precision-1)}))
292
    
293
    # Return a tuple:
294
    # - the bivariate integer polynomial in (i,j);
295
    # - 2^K
296
# End slz_rat_poly_of_rat_to_rat_poly_of_int
297

  
264 298
print "sageSLZ loaded..."

Formats disponibles : Unified diff