In general, multi-valued functions shouldn't be simplified "nicely" by default. It should be possible to get Maxima to do something like this using radexpand:True
, I think, but I don't believe Sage has this wrapped. It is also NOT obvious in the Maxima documentation what to do unless you really dig...
sage: maxima_console()
(%i1) exp:1/2*sqrt(-cos(theta) + 1)*sqrt(cos(theta) + 1);
sqrt(1 - cos(theta)) sqrt(cos(theta) + 1)
(%o1) -----------------------------------------
2
(%i2) trigsimp(rootscontract(exp));
abs(sin(theta))
(%o2) ---------------
2
There is currently not a consensus on just how much customization should be available through Sage commands. However, the maxima_methods()
command allows access to pretty much all of them.
sage: exp = 1/2*sqrt(-cos(theta) + 1)*sqrt(cos(theta) + 1)
sage: exp = exp.maxima_methods().rootscontract(); exp
1/2*sqrt(-cos(theta)^2 + 1)
sage: exp.simplify_full()
1/2*abs(sin(theta))
There are a number of things that the Maxima assumption framework (which Sage uses) doesn't interact with, so perhaps the part where you are trying to ensure sin is positive is one of those things...
Hi, I've formatted the code part a bit. The input actually accepts simple formatting called Markdown. For code every line must be indented by four spaces, it can also be done by selecting a range and then hitting "format code" button in the editor that has numbers written on it