First time here? Check out the FAQ!

Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

answered 13 years ago

kcrisman gravatar image

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.

click to hide/show revision 2
No.2 Revision

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.

click to hide/show revision 3
No.3 Revision

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).

click to hide/show revision 4
No.4 Revision

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).