# why doesn't rootscontract work with conjugate?

x=var('x')
assume(x,'real')
(sqrt(-x+1)*sqrt(x+1)).conjugate()._maxima_().rootscontract()._sage_()


It works without conjugate, but with conjugate it does not contract roots. Is there a workaround? I know I can do it by hand but, what I have above is a part of a much larger expression.

edit retag close merge delete

Notice that you are really asking a Maxima question here, because rootscontract is acting on an object which you've put into Maxima. It's probably a question with an interesting answer. I'd take a look at what the _maxima_() looks like in each case, then try it out in maxima_console() and see what happens.

( 2012-01-11 15:12:56 -0600 )edit

Sort by » oldest newest most voted

The docstring for rootscontract indicates that there are optional arguments affecting the behavior of the function (radexpand and rootsconmode). These seem not to be available in the Sage wrapper, but may be related to telling Maxima that certain functions are multiplicative and therefore can be "contracted". None of them relate to the conjugate function anyway though.

Maybe Maxima is unwilling to recognize conjugation as multiplicative (e.g. for speed/memory reasons). Since you do know that conjugation is multiplicative, can you apply it after you contract the roots? For example:

x=var('x')
assume(x,'real')
a = (sqrt(-x+1)*sqrt(x+1))
(sqrt(-x+1)*sqrt(x+1))._maxima_().rootscontract()._sage_().conjugate()

conjugate(sqrt(-x^2 + 1))

more