Révision 159 pobysoPythonSage/src/pobyso.py
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 |
Formats disponibles : Unified diff