Ask Your Question
0

possible bug involving absolute value of sin function and assume

asked 2010-12-07 16:10:57 +0100

Shashank gravatar image

updated 2010-12-07 16:14:00 +0100

Evgeny gravatar image
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 flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2010-12-07 20:54:00 +0100

kcrisman gravatar image

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
Distributed under the GNU Public License. See the file COPYING.
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.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2010-12-07 16:10:57 +0100

Seen: 533 times

Last updated: Dec 07 '10