Expression.simplify() takes no "algorithm" keyword

asked 2023-12-07 01:22:17 +0100

GPN gravatar image

Hi Sage experts.

I am trying to run the following example, which is really copied from the doc with slight modification to adapt it to my Jupyter notebook.

from sage. All import *
from IPython.display import display, Math, Latex

%display latex

x, t = var("x, t")
ex = cos(t).exponentialize()
ex = ex.subs((sin(t).exponentialize()==x).solve(t)[0]); display(ex)
ex.simplify(); display(ex)
ex.simplify(algorithm="sympy"); display(ex)

It runs nicely till the last line, which fails with the error TypeError: Expression.simplify() takes no keyword arguments. Since this line is copied from the doc, I am baffled.

I am using SageMath 9.5 on Ubuntu 22.04 and in the Jupyter notebook.

Thank you


edit retag flag offensive close merge delete



Version 10.1 does the job. To see if a method accepts some arguments, ask for its doc string. For instance, with the above definition of ex:

sage: ?ex.simplify

And this gives me in the present version:

   Return a simplified version of this symbolic expression.


   * "algorithm" -- one of :

        * "maxima" : (default) sends the expression to "maxima" and
          converts it back to Sage

        * "sympy" : converts the expression to "sympy", simplifies it
          (passing any optional keyword(s)), and converts the result
          to Sage

        * "giac" : converts the expression...

(and so on, not too much place left in a comment.)

dan_fulea gravatar imagedan_fulea ( 2023-12-07 02:26:33 +0100 )edit

@dan_fulea thank you

GPN gravatar imageGPN ( 2023-12-07 12:05:37 +0100 )edit

@dan_fulea : could you convert your comment into an answer, in order to help future (per-users ?

Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 2023-12-08 13:28:33 +0100 )edit