Révision 234
pobysoPythonSage/src/pobyso.py (revision 234) | ||
---|---|---|
361 | 361 |
""" |
362 | 362 |
return sollya_lib_evaluate(funcSo, argumentSo) |
363 | 363 |
# End pobyso_evaluate_so_so. |
364 |
def pobyso_dirty_find_zeros_so_so(funcSo, rangeSo): |
|
365 |
""" |
|
366 |
Thin wrapper over sollya_lib_dirtyfindzeros() |
|
367 |
""" |
|
368 |
return sollya_lib_dirtyfindzeros(funcSo, rangeSo) |
|
369 |
# End pobys_dirty_find_zeros |
|
364 | 370 |
|
371 |
def pobyso_float_list_so_sa(listSo): |
|
372 |
""" |
|
373 |
Return a Sollya list of floating-point as a Sage list of |
|
374 |
floating-point numbers. |
|
375 |
""" |
|
376 |
listSa = [] |
|
377 |
## Remember pobyso_get_list_elements_so_so returns more information |
|
378 |
# than just the elements of the list (# elements, is_ellipti) |
|
379 |
listSaSo = pobyso_get_list_elements_so_so(listSo)[0] |
|
380 |
## Search first for the maximum precision of the elements |
|
381 |
maxPrecSa = 0 |
|
382 |
for floatSo in listSaSo: |
|
383 |
pobyso_autoprint(floatSo) |
|
384 |
curPrecSa = pobyso_get_prec_of_constant_so_sa(floatSo) |
|
385 |
if curPrecSa > maxPrecSa: |
|
386 |
maxPrecSa = curPrecSa |
|
387 |
## |
|
388 |
RF = RealField(maxPrecSa) |
|
389 |
## |
|
390 |
for floatSo in listSaSo: |
|
391 |
listSa.append(pobyso_get_constant_as_rn_with_rf_so_sa(floatSo)) |
|
392 |
return listSa |
|
393 |
# End pobyso_float_list_so_sa |
|
394 |
|
|
365 | 395 |
def pobyso_float_poly_sa_so(polySa, precSa = None): |
366 | 396 |
""" |
367 | 397 |
Create a Sollya polynomial from a Sage RealField polynomial. |
... | ... | |
1345 | 1375 |
get_rn_value(rnUpperBound)) |
1346 | 1376 |
if sollyaPrecChanged: |
1347 | 1377 |
pobyso_set_prec_so_so(initialSollyaPrecSo) |
1348 |
pobyso_lib_clear_obj(initialSollyaPrecSo)
|
|
1378 |
sollya_lib_clear_obj(initialSollyaPrecSo)
|
|
1349 | 1379 |
return rangeSo |
1350 | 1380 |
# End pobyso_range_from_bounds_sa_so |
1351 | 1381 |
|
... | ... | |
1470 | 1500 |
The functions (func and weight) must be passed as expressions or strings. |
1471 | 1501 |
Otherwise the function fails. |
1472 | 1502 |
The return value is a pointer to a Sollya function. |
1503 |
lowerBound and upperBound mus be reals. |
|
1473 | 1504 |
""" |
1474 | 1505 |
var('zorglub') # Dummy variable name for type check only. Type of |
1475 | 1506 |
# zorglub is "symbolic expression". |
... | ... | |
1477 | 1508 |
# The func argument can be of different types (string, |
1478 | 1509 |
# symbolic expression...) |
1479 | 1510 |
if parent(func) == parent("string"): |
1480 |
localFuncSa = eval(func)
|
|
1511 |
localFuncSa = sage_eval(func,globals())
|
|
1481 | 1512 |
if len(localFuncSa.variables()) > 0: |
1482 | 1513 |
currentVariableNameSa = localFuncSa.variables()[0] |
1483 | 1514 |
sollya_lib_name_free_variable(str(currentVariableNameSa)) |
1484 | 1515 |
Formats disponibles : Unified diff