Révision 159

pobysoPythonSage/src/pobyso.py (revision 159)
187 187
    TODO: completely rework and test.
188 188
    """
189 189
    pobyso = pobyso_name_free_variable_sa_so(funcSa.variables()[0])
190
    funcSo = pobyso_parse_string(funcSa._assume_str())
190
    funcSo = pobyso_parse_string(funcSa._assume_str().replace('_SAGE_VAR_', ''))
191 191
    rangeSo = pobyso_range_sa_so(lowerBoundSa, upperBoundSa)
192 192
    infnormSo = pobyso_infnorm_so_so(funcSo,rangeSo)
193 193
    # Sollya return the infnorm as an interval.
......
197 197
    binadeTopLimitSa = 2**ceil(fMaxUpperBoundSa.log2())
198 198
    # Put up together the function to use to compute the lower bound.
199 199
    funcAuxSo = pobyso_parse_string(str(binadeTopLimitSa) +  \
200
                                    '-(' + f._assume_str() + ')')
200
                                    '-(' + f._assume_str().replace('_SAGE_VAR_', '') + ')')
201 201
    pobyso_autoprint(funcAuxSo)
202 202
    # Clear the Sollya range before a new call to infnorm and issue the call.
203 203
    sollya_lib_clear_obj(infnormSo)
......
771 771
    Sa_sa variant of the solly_guessdegree function.
772 772
    Return 0 if something goes wrong.
773 773
    """
774
    functionAsStringSa = functionSa._assume_str()
774
    functionAsStringSa = functionSa._assume_str().replace('_SAGE_VAR_', '')
775 775
    functionSo = pobyso_parse_string_sa_so(functionAsStringSa)
776 776
    if pobyso_is_error_so_sa(functionSo):
777 777
        sollya_lib_clear_obj(functionSo)
......
783 783
    else:
784 784
        approxErrorSo = pobyso_constant_sa_so(RR(approxErrorSa))
785 785
    if not weightSa is None:
786
        weightAsStringSa = weightSa._assume_str()
786
        weightAsStringSa = weightSa._assume_str().replace('_SAGE_VAR_', '')
787 787
        weightSo = pobyso_parse_string_sa_so(weightAsStringSa)
788 788
        if pobyso_is_error(weightSo):
789 789
            sollya_lib_clear_obj(functionSo)
......
1011 1011
        if len(localFuncSa.variables()) > 0:
1012 1012
            currentVariableNameSa = localFuncSa.variables()[0]
1013 1013
            sollya_lib_name_free_variable(str(currentVariableNameSa))
1014
            functionSo = sollya_lib_parse_string(localFuncSa._assume_str())
1014
            functionSo = \
1015
              sollya_lib_parse_string(localFuncSa._assume_str().replace('_SAGE_VAR_', ''))
1015 1016
    # Expression test.
1016 1017
    elif type(func) == type(zorglub):
1017 1018
        # Until we are able to translate Sage expressions into Sollya 
......
1019 1020
        if len(func.variables()) > 0:
1020 1021
            currentVariableNameSa = func.variables()[0]
1021 1022
            sollya_lib_name_free_variable(str(currentVariableNameSa))
1022
            functionSo = sollya_lib_parse_string(func._assume_str())
1023
            functionSo = \
1024
              sollya_lib_parse_string(func._assume_str().replace('_SAGE_VAR_', ''))
1023 1025
    else:
1024 1026
        return(None)
1025 1027
    if weight is None: # No weight given -> 1.
......
1027 1029
    elif parent(weight) == parent("string"): # Weight given as string: parse it.
1028 1030
        weightSo = sollya_lib_parse_string(func)
1029 1031
    elif type(weight) == type(zorglub): # Weight given as symbolice expression.
1030
        functionSo = sollya_lib_parse_string_sa_so(weight._assume_str())
1032
        functionSo = \
1033
          sollya_lib_parse_string_sa_so(weight._assume_str().replace('_SAGE_VAR_', ''))
1031 1034
    else:
1032 1035
        return(None)
1033 1036
    degreeSo = pobyso_constant_from_int(degree)
......
1266 1269
    else: # Interval.
1267 1270
        pointSo = pobyso_interval_to_range_sa_so(pointSa, pointPrecSa)
1268 1271
    # Sollyafy the function.
1269
    functionSo = pobyso_parse_string_sa_so(functionSa._assume_str())
1272
    functionSo = pobyso_parse_string_sa_so(functionSa._assume_str().replace('_SAGE_VAR_', ''))
1270 1273
    if sollya_lib_obj_is_error(functionSo):
1271 1274
        print "pobyso_tailorform: function string can't be parsed!"
1272 1275
        return None
pobysoPythonSage/src/sageSLZ/sagePolynomialOperations.sage (revision 159)
1
load "/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageSLZ/sageMatrixOperations.sage"
1
load(str('/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageSLZ/sageMatrixOperations.sage'))
2 2
print "sagePolynomialOperations loading..."
3 3
def spo_add_polynomial_coeffs_to_matrix_row(poly, 
4 4
                                            knownMonomials, 
pobysoPythonSage/src/sageSLZ/sageSLZ.sage (revision 159)
752 752
    #
753 753
    print "Approximation precision: ", RR(approxPrecSa)
754 754
    # Prepare the arguments for the Taylor expansion computation with Sollya.
755
    functionSo = pobyso_parse_string_sa_so(fff._assume_str())
755
    functionSo = \
756
      pobyso_parse_string_sa_so(fff._assume_str().replace('_SAGE_VAR_', ''))
756 757
    degreeSo = pobyso_constant_from_int_sa_so(degreeSa)
757 758
    scaledBoundsSo = pobyso_bounds_to_range_sa_so(scaledLowerBoundSa, 
758 759
                                                  scaledUpperBoundSa)
pobysoPythonSage/src/sageSLZ/sageRationalOperations.sage (revision 159)
20 20
    except Exception:
21 21
        print "denominators:", rationalList, \
22 22
                "does not understand the len() function."
23
        return([])
23
        return []
24 24
    if listLength == 0:
25
        return([])
25
        return []
26 26
    if listLength == 1:
27 27
        try:
28 28
            return([QQ(rationalList[0]).denominator()])
29 29
        except Exception:
30 30
            print "denominators:", rationalList[0], \
31 31
                    "has no \"denominator()\" member." 
32
            return([])
32
            return []
33 33
    denominatorsList = []    
34 34
    for i in xrange(listLength):
35 35
        try:
......
37 37
        except Exception:
38 38
            print "denominators:", rationalList[i], \
39 39
                    "has no \"denominator()\" member." 
40
            return([])
40
            return []
41 41
    return(denominatorsList)
42 42
# End sro_denominators
43 43

  
......
81 81
    except Exception:
82 82
        print "numerators:", rationalList, \
83 83
                "does not understand the len() function."
84
        return([])
84
        return []
85 85
    if listLength == 0:
86
        return([])
86
        return [] 
87 87
    if listLength == 1:
88 88
        try:
89 89
            return(QQ(rationalList[0]).numerator())
90 90
        except Exception:
91 91
            print "denominators:", rationalList[0], \
92 92
                    "has no \"numerator()\" member." 
93
            return([])
93
            return [] 
94 94
    numeratorsList = []    
95 95
    for i in xrange(listLength):
96 96
        try:
......
98 98
        except Exception:
99 99
            print "numerators:", rationalList[i], \
100 100
                    "has no \"numerator()\" member." 
101
            return([])
102
    return(numeratorsList)
101
            return [] 
102
    return numeratorsList
103 103
# End sro_numerators
104 104

  
105 105
print "\t...sageRationalOperations loaded"
pobysoPythonSage/src/testPobyso.sage (revision 159)
71 71
    print "Running", inspect.stack()[0][3], "..."
72 72
    intervalSa = RIF(1,2)
73 73
    functionSo = pobyso_parse_string("exp(x)")
74
    degreeSo   = pobyso_
74
    degreeSo   = pobyso_constant_from_int_sa_so(4)
75 75
    #RealIntervalField
76 76
    pointSo    = pobyso_constant_sa_so(RR("1.5"))
77 77
    intervalSo = pobyso_interval_to_range_sa_so(intervalSa)

Formats disponibles : Unified diff