Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The method simplify() sends things to Maxima and back. This is useful with assumptions.

sage: var('n')
n
sage: assume(n,'integer')
sage: sin(n*pi)
sin(pi*n)
sage: sin(n*pi).simplify()
0

As for the error, I've sent an email to the Maxima list about this. There may be something I'm missing, though.

The method simplify() sends things to Maxima and back. This is useful with assumptions.

sage: var('n')
n
sage: assume(n,'integer')
sage: sin(n*pi)
sin(pi*n)
sage: sin(n*pi).simplify()
0

As for the error, I've sent an email to the Maxima list about this. There may be something I'm missing, though.The thread starts here. Essentially, Maxima's radcan() picks a branch and sticks with it, rather than treating sqrt() as a function per se.

The method simplify() sends things to Maxima and back. This is useful with assumptions.

sage: var('n')
n
sage: assume(n,'integer')
sage: sin(n*pi)
sin(pi*n)
sage: sin(n*pi).simplify()
0

As for the error, I've sent an email to the Maxima list about this. The thread starts here. Essentially, Maxima's radcan() picks a branch and sticks with it, rather than treating sqrt() as a function per se.se. But Fateman's answer above gives you what you need to know (even if the news is not so good).

The method simplify() sends things to Maxima and back. This is useful with assumptions.

sage: var('n')
n
sage: assume(n,'integer')
sage: sin(n*pi)
sin(pi*n)
sage: sin(n*pi).simplify()
0

As for your comment, you have to "forget" assumptions about a variable to use other ones. One also has to tell Maxima that the domain is "real", not complex, for the x<0 assumption to take effect. This is somewhat troublesome, but doable.

sage: assume(x<0)
sage: maxima_calculus.eval('domain:real')
'real'
sage: sqrt(x^2).simplify()
-x

As for the error, I've sent an email to the Maxima list about this. The thread starts here. Essentially, Maxima's radcan() picks a branch and sticks with it, rather than treating sqrt() as a function per se. But Fateman's answer above gives you what you need to know (even if the news is not so good).