behavior of asec()

25 views
Skip to first unread message

Bruce Allen

unread,
Apr 8, 2021, 3:30:02 PM4/8/21
to sy...@googlegroups.com
Dear Sympy developers,

This is not a serious issue, but I wanted to flag it. According to the
documentation (and IMO correctly):

acos(x) = asec(1/x)

So I was surprised to see the contrast between:

>>> acos(Rational(1,2))
pi/3

>>> asec(Rational(2,1))
asec(2)

I would expect the previous line to return pi/3. Here is another
example of this:

>>> acos(sqrt(2)/2)
pi/4

>>> asec(2/sqrt(2))
asec(sqrt(2))

I would expect the previous line to return pi/4.

Cheers,
Bruce


Aaron Meurer

unread,
Apr 8, 2021, 3:42:46 PM4/8/21
to sympy
What version of SymPy are you using? Those both evaluate for me as
expected in 1.7.1.

Aaron Meurer
> --
> You received this message because you are subscribed to the Google Groups "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sympy+un...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/373c727c-2e33-0704-e932-4fac92fc231a%40googlemail.com.

B A

unread,
Apr 9, 2021, 5:47:40 AM4/9/21
to sympy
My previous message can be ignored -- as Aaron pointed out (thank you!) this has been fixed, I was not using a recent-enough release.  Sorry for the noise.

Python 3.9.2 (default, Mar 31 2021, 11:25:52) 
[Clang 10.0.1 (clang-1001.0.46.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sympy
>>> from sympy import asec, Rational, acos
>>> sympy.__version__
'1.7.1'
>>> acos(Rational(1,2))
pi/3
>>> asec(Rational(2,1))
pi/3


Reply all
Reply to author
Forward
0 new messages