|
349 | 349 | Note that ``x`` is still ``x``, since the |
350 | 350 | maxima used by the calculus package is different than the one in |
351 | 351 | the interactive interpreter. |
| 352 | +Clear the maxima variables to avoid interference with other tests:: |
| 353 | +
|
| 354 | + sage: maxima('kill(x,y)') |
| 355 | + done |
352 | 356 |
|
353 | 357 | Check to see that the problem with the variables method mentioned |
354 | 358 | in :issue:`3779` is actually fixed:: |
|
395 | 399 | Check if maxima has redundant variables defined after initialization, |
396 | 400 | see :issue:`9538`:: |
397 | 401 |
|
398 | | - sage: maxima = sage.interfaces.maxima.maxima |
| 402 | + sage: maxima = sage.interfaces.maxima_lib.maxima |
399 | 403 | sage: maxima('f1') |
400 | 404 | f1 |
401 | 405 | sage: sage.calculus.calculus.maxima('f1') |
|
419 | 423 | """ |
420 | 424 |
|
421 | 425 | import re |
| 426 | +from types import FunctionType |
| 427 | + |
422 | 428 | from sage.arith.misc import algebraic_dependency |
| 429 | +from sage.interfaces.maxima_lib import maxima |
| 430 | +from sage.misc.latex import latex |
| 431 | +from sage.misc.parser import LookupNameMaker, Parser |
| 432 | +from sage.rings.cc import CC |
423 | 433 | from sage.rings.integer import Integer |
424 | 434 | from sage.rings.rational_field import QQ |
425 | 435 | from sage.rings.real_double import RealDoubleElement |
426 | 436 | from sage.rings.real_mpfr import RR, create_RealNumber |
427 | | -from sage.rings.cc import CC |
428 | | - |
429 | | -from sage.misc.latex import latex |
430 | | -from sage.misc.parser import Parser, LookupNameMaker |
431 | 437 | from sage.structure.element import Expression |
432 | | -from sage.symbolic.ring import var, SR |
433 | | -from sage.symbolic.symbols import symbol_table |
434 | 438 | from sage.symbolic.function import Function |
435 | 439 | from sage.symbolic.function_factory import function_factory |
436 | | -from sage.symbolic.integration.integral import (indefinite_integral, |
437 | | - definite_integral) |
438 | | - |
439 | | -from sage.misc.lazy_import import lazy_import |
440 | | -lazy_import('sage.interfaces.maxima_lib', 'maxima') |
441 | | -from types import FunctionType |
| 440 | +from sage.symbolic.integration.integral import definite_integral, indefinite_integral |
| 441 | +from sage.symbolic.ring import SR, var |
| 442 | +from sage.symbolic.symbols import symbol_table |
442 | 443 |
|
443 | 444 |
|
444 | 445 | ######################################################## |
@@ -667,6 +668,7 @@ def symbolic_sum(expression, v, a, b, algorithm='maxima', hold=False): |
667 | 668 | elif algorithm == 'sympy': |
668 | 669 | expression,v,a,b = (expr._sympy_() for expr in (expression, v, a, b)) |
669 | 670 | from sympy import summation |
| 671 | + |
670 | 672 | from sage.interfaces.sympy import sympy_init |
671 | 673 | sympy_init() |
672 | 674 | result = summation(expression, (v, a, b)) |
@@ -920,6 +922,7 @@ def symbolic_product(expression, v, a, b, algorithm='maxima', hold=False): |
920 | 922 | elif algorithm == 'sympy': |
921 | 923 | expression,v,a,b = (expr._sympy_() for expr in (expression, v, a, b)) |
922 | 924 | from sympy import product as sproduct |
| 925 | + |
923 | 926 | from sage.interfaces.sympy import sympy_init |
924 | 927 | sympy_init() |
925 | 928 | result = sproduct(expression, (v, a, b)) |
@@ -1674,7 +1677,11 @@ def mma_free_limit(expression, v, a, dir=None): |
1674 | 1677 | sage: mma_free_limit(e^(-x), x, a=oo) # optional - internet |
1675 | 1678 | 0 |
1676 | 1679 | """ |
1677 | | - from sage.interfaces.mathematica import request_wolfram_alpha, parse_moutput_from_json, symbolic_expression_from_mathematica_string |
| 1680 | + from sage.interfaces.mathematica import ( |
| 1681 | + parse_moutput_from_json, |
| 1682 | + request_wolfram_alpha, |
| 1683 | + symbolic_expression_from_mathematica_string, |
| 1684 | + ) |
1678 | 1685 | dir_plus = ['plus', '+', 'above', 'right'] |
1679 | 1686 | dir_minus = ['minus', '-', 'below', 'left'] |
1680 | 1687 | math_expr = expression._mathematica_init_() |
@@ -1915,6 +1922,7 @@ def laplace(ex, t, s, algorithm='maxima'): |
1915 | 1922 | elif algorithm == 'sympy': |
1916 | 1923 | ex_sy, t, s = (expr._sympy_() for expr in (ex, t, s)) |
1917 | 1924 | from sympy import laplace_transform |
| 1925 | + |
1918 | 1926 | from sage.interfaces.sympy import sympy_init |
1919 | 1927 | sympy_init() |
1920 | 1928 | result = laplace_transform(ex_sy, t, s) |
@@ -2100,6 +2108,7 @@ def inverse_laplace(ex, s, t, algorithm='maxima'): |
2100 | 2108 | elif algorithm == 'sympy': |
2101 | 2109 | ex_sy, s, t = (expr._sympy_() for expr in (ex, s, t)) |
2102 | 2110 | from sympy import inverse_laplace_transform |
| 2111 | + |
2103 | 2112 | from sage.interfaces.sympy import sympy_init |
2104 | 2113 | sympy_init() |
2105 | 2114 | result = inverse_laplace_transform(ex_sy, s, t) |
@@ -2460,10 +2469,12 @@ def symbolic_expression_from_maxima_string(x, equals_sub=False, maxima=maxima): |
2460 | 2469 |
|
2461 | 2470 | Make sure that we don't accidentally pick up variables in the maxima namespace (:issue:`8734`):: |
2462 | 2471 |
|
2463 | | - sage: sage.calculus.calculus.maxima('my_new_var : 2') |
| 2472 | + sage: maxima('my_new_var : 2') |
2464 | 2473 | 2 |
2465 | 2474 | sage: var('my_new_var').full_simplify() |
2466 | 2475 | my_new_var |
| 2476 | + sage: maxima('kill(my_new_var)') |
| 2477 | + done |
2467 | 2478 |
|
2468 | 2479 | ODE solution constants are treated differently (:issue:`16007`):: |
2469 | 2480 |
|
|
0 commit comments