Index: pobyso.py
===================================================================
--- pobyso.py	(revision 284)
+++ pobyso.py	(revision 285)
@@ -102,7 +102,7 @@
     sollya_lib_autoprint(arg, None)
 
 def pobyso_autoprint_so_so(arg):
-    sollya_lib_autoprint(arg,None)
+    sollya_lib_autoprint(arg, None)
 
 def pobyso_bounds_to_interval_sa_sa(lowerBound, upperBound):
     """
@@ -121,12 +121,24 @@
         prec = 53
     # Create the RealIntervalField and the interval (if possible).
     theRIF = RealIntervalField(prec)
+    theRR  = RealField(prec)
+    # Try convert the lower bound to a RealField element or fail.
     try:
-        interval = theRIF(lowerBound, upperBound)
+        lowerBoundRF = theRR(lowerBound)
     except TypeError:
-        return None
-    else:
-        return interval
+        try:
+            lowerBoundRF = theRR(str(lowerBound))
+        except TypeError:
+            return None
+    # Try convert the upper bound to a RealField element or fail.
+    try:
+        upperBoundRF = theRR(upperBound)
+    except TypeError:
+        try:
+            upperBoundRF = theRR(str(upperBound))
+        except TypeError:
+            return None
+    return theRIF(lowerBoundRF, upperBoundRF)
 # End pobyso_bounds_to_interval_sa_sa
     
 def pobyso_bounds_to_range_sa_so(rnLowerBoundSa, rnUpperBoundSa, \
@@ -232,6 +244,86 @@
     return(sollya_lib_evaluate(funcSo,chvarExpSo))
 # End pobyso_change_var_in_function_so_so     
 
+def pobyso_chebyshevform_sa_sa(funcSa, degreeSa, intervalSa):
+    """
+    An chebyshevnorm call with Sage arguments that returns Sage objects.
+    To the moment only the polynomial and the delta are returned.
+    """
+    # Check that funcSa is a function.
+    if not \
+     sage.symbolic.callable.is_CallableSymbolicExpressionRing(parent(funcSa)):
+        return None
+    # Check that funcSa is an integer.
+    try:
+        if degreeSa != int(degreeSa):
+            print "degreeSa is not a valid integer."
+            return None
+    except ValueError:
+        print "degreeSa is not a number."
+        return None 
+    # Create the Sollya degree...
+    degreeSo = pobyso_constant_from_int_sa_so(degreeSa)
+    # ...and check it.
+    if pobyso_is_error_so_sa(degreeSo):
+        print "Could not correctly convert degreeSa to Sollya."
+        return None
+    # Check that intervalSa is an interval.
+    try:
+        intervalSa.upper()
+    except AttributeError:
+        print "intervalSa is not an interval."
+        return None
+    # Convert the Sage polynomial into a Sollya polynomial.
+    # Convert the Sage function into a Sollya function.
+    funcAsStringSa = funcSa._assume_str().replace('_SAGE_VAR_', '')
+    funcSo = pobyso_parse_string_sa_so(funcAsStringSa)
+    if not pobyso_obj_is_function_so_sa(funcSo):
+        sollya_lib_clear_obj(funcSo)
+        print "The Sollya object created from the function is not a function."
+        return None
+    #pobyso_autoprint(funcSo)
+    # Convert the Sage interval into a Sollya range.
+    rangeSo = pobyso_interval_to_range_sa_so(intervalSa)
+    if not pobyso_is_range_so_sa(rangeSo):
+        sollya_lib_clear_obj(funcSo)
+        sollya_lib_clear_obj(rangeSo)
+        print "The Sollya object created from the interval is not a range."
+        return None
+    #pobyso_autoprint(rangeSo)
+    retValSo = sollya_lib_chebyshevform(funcSo,
+                                        degreeSo,
+                                        rangeSo, 
+                                        None)
+    sollya_lib_clear_obj(funcSo)
+    sollya_lib_clear_obj(degreeSo)
+    sollya_lib_clear_obj(rangeSo)
+    if pobyso_is_error_so_sa(retValSo):
+        sollya_lib_clear_obj(retValSo)
+        print "Could not compute the Chebyshev form."
+        return None
+    #pobyso_autoprint(retValSo)
+    ## Get the list of Sollya objects returned by sollya_lib_chebyshevform
+    retValSa = pobyso_get_list_elements_so_so(retValSo)
+    if retValSa[1] != 4:
+        print "Invalid number of elements in the Chebyshev form."
+        sollya_lib_clear_obj(retValSo)
+        return None
+    ## Convert all the element of the retValSa[0] array of Sollya objects 
+    #  into their Sage counterparts.
+    polySa = pobyso_float_poly_so_sa(retValSa[0][0])
+    if not pobyso_is_poly_sa_sa(polySa):
+        print "Conversion of the polynomial of the Chebyshev form failed."
+        sollya_lib_clear_obj(retValSo)
+        return None
+    deltaSa  = pobyso_get_interval_from_range_so_sa(retValSa[0][2])
+    if not pobyso_is_interval_sa_sa(deltaSa):
+        print "Conversion of the delta interval of the Chebyshev form failed."
+        sollya_lib_clear_obj(retValSo)
+        return None
+    sollya_lib_clear_obj(retValSo)
+    return(polySa,deltaSa)
+# End pobyso_chebyshevform_sa_sa.
+
 def pobyso_chebyshevform_so_so(functionSo, degreeSo, intervalSo):
     resultSo = sollya_lib_chebyshevform(functionSo, degreeSo, intervalSo)
     return(resultSo)
@@ -270,7 +362,7 @@
 
 def pobyso_clear_taylorform_sa_so(taylorFormSaSo):
     """
-    This method is rapper around pobyso_clear_list_elements_sa_so.
+    This method is wrapper around pobyso_clear_list_elements_sa_so.
     It is a legacy method left here since it may be used in existing code 
     where Taylor forms are used as Sage lists obtained by converting
     Sollya Taylor forms (a list made of:
@@ -650,7 +742,7 @@
     #print polyRingSa
     # Do not use the polynomial(expressionSa, ring=polyRingSa) form!
     polynomialSa = polyRingSa(expressionSa)
-    polyCoeffsListSa = polynomialSa.coefficients()
+    #polyCoeffsListSa = polynomialSa.coefficients()
     #for coeff in polyCoeffsListSa:
     #    print coeff.abs().n()
     return polynomialSa
@@ -988,7 +1080,8 @@
     """
     Convert a Sollya polynomial into a Sage polynomial.
     Legacy function. Use pobyso_float_poly_so_sa() instead.
-    """    
+    """
+    print "Deprecated: use pobyso_float_poly_so_sa() instead."    
     return pobyso_float_poly_so_sa(polySo,realFieldSa)
 # End pobyso_get_poly_so_sa
 
@@ -1347,6 +1440,29 @@
         return False
 # End pobyso_is_floating_piont_number_sa_sa
 
+def pobyso_is_interval_sa_sa(objectSa):
+    """
+    Check that objectSa is an interval.
+    """
+    try:
+        objectSa.upper()
+    except AttributeError:
+        return False
+    return True
+
+def pobyso_is_poly_sa_sa(objectSa):
+    """
+    Check if an object is a polynomial.
+    """
+    try:
+        coefficientsListSa = objectSa
+        if len(objectSa.coefficients()) < 0:
+            return False
+    except AttributeError:
+        return False
+    return True
+# End pobyso_is_poly_sa_sa
+
 def pobyso_is_range_so_sa(rangeCandidateSo):
     """
     Thin wrapper over sollya_lib_is_range.
@@ -2110,7 +2226,7 @@
                          funcSa, 
                          intervalSa, 
                          errorTypeSa=SOLLYA_ABSOLUTE, 
-                         accuracySa=RR(2^-40)):
+                         accuracySa=RR(2**-40)):
     """
     An supnorm call with Sage arguments.
     """
