Opened 8 years ago

Closed 7 years ago

# doctest trigonometric functions for complex input

Reported by: Owned by: Punarbasu Purkayastha major sage-7.2 symbolics Burcin Erocal, Karl-Dieter Crisman, Ralf Stephan Ralf Stephan Vincent Delecroix N/A 5e18f34 5e18f344b2016d6e7eea64c06d398017da851761

This is a follow up to #16439.

1. The functions `atan, acos, asin` give `TypeError` on Python `complex` input.
1. 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.

### comment:1 Changed 8 years ago by Punarbasu Purkayastha

Description: modified (diff)

### comment:2 Changed 8 years ago by For batch modifications

Milestone: sage-6.3 → sage-6.4

### comment:3 Changed 8 years ago by Ralf Stephan

Summary: Fix output of trigonometric functions for complex input → unify output of trigonometric functions for complex input

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)
```

### comment:4 Changed 7 years ago by Ralf Stephan

Milestone: sage-6.4 → sage-duplicate/invalid/wontfix new → needs_review

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.

### comment:6 Changed 7 years ago by Ralf Stephan

Branch: → u/rws/unify_output_of_trigonometric_functions_for_complex_input

### comment:7 Changed 7 years ago by Ralf Stephan

Authors: → Ralf Stephan → 5e18f344b2016d6e7eea64c06d398017da851761 sage-duplicate/invalid/wontfix → sage-7.2 unify output of trigonometric functions for complex input → doctest trigonometric functions for complex input

New commits:

 ​5e18f34 `16491: doctest complex trig functions`

### comment:8 Changed 7 years ago by Vincent Delecroix

Reviewers: → Vincent Delecroix needs_review → positive_review

### comment:9 Changed 7 years ago by Volker Braun

Branch: u/rws/unify_output_of_trigonometric_functions_for_complex_input → 5e18f344b2016d6e7eea64c06d398017da851761 → fixed positive_review → closed
Note: See TracTickets for help on using tickets.