# possible bug involving absolute value of sin function and assume sage: a=var('a')
sage: assume(a>0)
sage: view(sqrt(a*a).simplify_full())
sage: theta=var('theta')
sage: assume(theta>0)
sage: assume(theta<pi)
sage: view(sqrt(sin(theta)*sin(theta)).simplify_full())


The answer for the first one is $a$ as it should be. However, for the second one I get $|\sin(\theta)|$. Considering that I have already assumed $0<\theta<\pi$, I should not have got the absolute sign. Is this a bug? And is there a way to get around it?

edit retag close merge delete

Sort by » oldest newest most voted

The Maxima assumption framework is fairly weak:

sage: maxima_console()
<snip>
Maxima 5.22.1 http://maxima.sourceforge.net
using Lisp ECL 10.4.1
Dedicated to the memory of William Schelter.
The function bug_report() provides bug reporting information.
(%i1) assume(theta>0);
(%o1)                             [theta > 0]
(%i2) assume(theta<%pi);
(%o2)                            [theta < %pi]
(%i3) sqrt(sin(theta)*sin(theta));
(%o3)                           abs(sin(theta))


Quoted here: "Maxima's deduction mechanism is not very strong; there are many obvious consequences which cannot be determined by is. This is a known weakness."

Of course,

(%i4) assume(sin(theta)>0);
(%o4)                          [sin(theta) > 0]
(%i5) sqrt(sin(theta)*sin(theta));
(%o5)                             sin(theta)


so

sage: assume(sin(theta)>0)
sage: sqrt(sin(theta)*sin(theta))
sqrt(sin(theta)^2)
sage: _.simplify_full()
sin(theta)


in case that helps.

more