Skip to content

doctest trigonometric functions for complex input #16491

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ppurka opened this issue Jun 17, 2014 · 10 comments
Closed

doctest trigonometric functions for complex input #16491

ppurka opened this issue Jun 17, 2014 · 10 comments

Comments

@ppurka
Copy link
Member

ppurka commented Jun 17, 2014

This is a follow up to #16439.

  1. The functions atan, acos, asin give TypeError on Python complex input.

  2. The output of trigonometric functions are inconsistent depending on whether complex or CDF or CC is used as the input type.

From #16439 discussion by @kcrisman:

Just one point - almost certainly some of those digits are 'extra' from Python. Compare (after this):

sage: sec(1.+i)
0.498337030555187 + 0.591083841721045*I
sage: sec(complex(1,1))
(0.49833703055518686+0.5910838417210451j)
sage: sec(CDF(complex(1,1)))
0.498337030555 + 0.591083841721*I

Interesting.

Here is something else I don't know what to do with.

sage: arccot(1.+i)
arccot(1.00000000000000 + 1.00000000000000*I)  # in SR
sage: cot(1.+i)
0.217621561854403 - 0.868014142895925*I

One would think this should be the same type of output.

That said, SR is useful for some other cases of exact input.

I'm wondering whether we want to try to fix all of this here, though.

CC: @burcin @kcrisman @rwst

Component: symbolics

Author: Ralf Stephan

Branch/Commit: 5e18f34

Reviewer: Vincent Delecroix

Issue created by migration from https://trac.sagemath.org/ticket/16491

@ppurka ppurka added this to the sage-6.3 milestone Jun 17, 2014
@ppurka

This comment has been minimized.

@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.3, sage-6.4 Aug 10, 2014
@rwst
Copy link
Contributor

rwst commented Jan 31, 2015

comment:3

Everything except point 2 seems to be fixed so I'm changing the title.

sage: atan(complex(1,1))
(1.0172219678978514+0.4023594781085251j)
sage: acos(complex(1,1))
(0.9045568943023814-1.0612750619050357j)
sage: asin(complex(1,1))
(0.6662394324925152+1.0612750619050357j)
sage: asin(CDF(complex(1,1)))
0.6662394324925152 + 1.0612750619050357*I
sage: asin(CC(complex(1,1)))
0.666239432492515 + 1.06127506190504*I
sage: arccot(1.+i)
arccot(i + 1.00000000000000)
sage: cot(1.+i)
cot(i + 1.00000000000000)

@rwst rwst changed the title Fix output of trigonometric functions for complex input unify output of trigonometric functions for complex input Jan 31, 2015
@rwst
Copy link
Contributor

rwst commented Dec 20, 2015

comment:4

I get now:

sage: arccot(1.+i)
0.553574358897045 - 0.402359478108525*I
sage: cot(1.+i)
0.217621561854403 - 0.868014142895925*I

So this seems fixed.

@rwst rwst removed this from the sage-6.4 milestone Dec 20, 2015
@videlec
Copy link
Contributor

videlec commented Apr 6, 2016

comment:5

What about adding doctests?

@rwst
Copy link
Contributor

rwst commented Apr 7, 2016

@rwst
Copy link
Contributor

rwst commented Apr 7, 2016

New commits:

5e18f3416491: doctest complex trig functions

@rwst
Copy link
Contributor

rwst commented Apr 7, 2016

Author: Ralf Stephan

@rwst
Copy link
Contributor

rwst commented Apr 7, 2016

Commit: 5e18f34

@rwst rwst added this to the sage-7.2 milestone Apr 7, 2016
@rwst rwst changed the title unify output of trigonometric functions for complex input doctest trigonometric functions for complex input Apr 7, 2016
@videlec
Copy link
Contributor

videlec commented Apr 7, 2016

Reviewer: Vincent Delecroix

@vbraun
Copy link
Member

vbraun commented Apr 8, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants