Loading [MathJax]/jax/output/HTML-CSS/jax.js
Ask Your Question
2

Equality test of symbolic expressions

asked 7 years ago

joaoff gravatar image

I'm confused about the equality test of symbolic expressions. I saw the recently asked question https://ask.sagemath.org/question/417... and, coincidently, I read something similar on the first page of the second chapter of this book http://dl.lateralis.org/public/sagebo.... It says that Sage evaluates the following expressions as below,

sage: bool(arctan(1+abs(x)) == pi/2 - arctan(1/(1+abs(x))))
False
sage: bool(arctan(sqrt(2)) == pi/2 - arctan(1/sqrt(2)))
True

In Wikipedia (https://en.wikipedia.org/wiki/List_of...), we can verify the corresponding trigonometric identity.

arctan(x)+arctan(1x)=π2,ifx>0

and

arctan(x)+arctan(1x)=π2,ifx<0

The above evaluation works as is in the version I am using.

sage: version()
'SageMath version 7.5.1, Release Date: 2017-01-15'

However, in Sage Math Cell or Cocalc ('SageMath version 8.1, Release Date: 2017-12-07') both tests evaluate to False.

Mathematica is not able to evaluate any of the expressions and return the entire equality test without evaluation.

Questions:

1) I understand that both tests should evaluate to True, am I right? If so, and as Sage 7.5.1 can verify the second equality, why it can't verify the first?

2) Why the newer version of Sage cannot verify the second equation anymore?

3) Differently from Mathematica, that returns True if both expressions are numerically equal, False otherwise and returns the test unevaluated if it cannot establish the equality, Sage returns True if it can prove that the difference between both expressions is zero and False otherwise. Is this correct?

Preview: (hide)

Comments

1

1) See my (partial) answer below.

2) Nice question. If you have a Sage development tree, you might try to bisect it...

3) is correct for Sage. I dunno about Mathematica.

Note that the introduction in Sage of "unknown" answers to boolean questions, available in Maxima (see ?maxima.is), has been discussed ad nauseam without decision for implementation.

Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 7 years ago )

In item 2, I haven't understood what you mean. I don't have much experience in software development. In item 3, I took a while to accept the way Sage works, but now, it seems very logical to me. Thanks again!

joaoff gravatar imagejoaoff ( 7 years ago )

sage is not always able to simplify the expressions into what you need, sometimes you need to direct it towards a specific type of simplification, expansion, etc. which will lead to your desired expression that is ultimately equal to zero.

DanialBagh gravatar imageDanialBagh ( 7 years ago )

1 Answer

Sort by » oldest newest most voted
2

answered 7 years ago

Emmanuel Charpentier gravatar image

Note that, for Sage :

sage: bool(tan(arctan(x))==x)
True
sage: bool(arctan(tan(x))==x)
False

(Indeed, the first expression is defined (and True) for all xR, whereas the second is defined for x2k+12π, kZ, and True only for x]π2, π2[).

Note also that, for Sage :

sage: tan(pi/2-x).trig_expand()
cot(x)
sage: tan(x-pi/2).trig_expand()
-cot(x)
sage: bool(cot(x)==1/tan(x))
True

which allow to retrieve your equalities (assuming that the domain choosen for arctan is indeed ]π2, π2[).

Preview: (hide)
link

Comments

I imagined that the interval where arctan is defined should have something to do with the issue, but I was not sure. Thanks a lot, your answer is very clear.

joaoff gravatar imagejoaoff ( 7 years ago )

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: 7 years ago

Seen: 2,761 times

Last updated: Mar 26 '18