Skip to content

error when evaluating symbolic expression involving cotangent of a complex number #29409

@DaveWitteMorris

Description

@DaveWitteMorris

This issue is split off from #29400. The command cot(1 + I).n() gives a TypeError:

sage: cot(1 + I).n()
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-6-8ad83d3021de> in <module>()
----> 1 cot(Integer(1) + I).n()

    [snip]

/Users/dmorris/Documents/misc/Programs/sage3/local/lib/python3.7/site-packages/sage/symbolic/expression.pyx in sage.symbolic.expression.Expression.numerical_approx (build/cythonized/sage/symbolic/expression.cpp:34715)()
   6054             res = x.pyobject()
   6055         else:
-> 6056             raise TypeError("cannot evaluate symbolic expression numerically")
   6057 
   6058         # Important -- the  we get might not be a valid output for numerical_approx in

TypeError: cannot evaluate symbolic expression numerically

There is no such error for sin, cos, tan, sec, or csc.

I believe this can be fixed by renaming the cotan method of the ComplexNumber class to cot, and I will upload a PR soon.

Component: symbolics

Keywords: cotangent, complex

Author: Dave Morris

Branch/Commit: b941d30

Reviewer: Kwankyu Lee

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions