On Mon, Jun 22, 2009 at 18:49, Luke<[email protected]> wrote: > > Ondrej and I have had some discussion about what the trigonometric > functions tan, cot, sec, csc should return at singular points. It > seems there are a couple of options: > 1) Return S.ComplexInfinity for things like tan(pi/2), tan(-pi/2), > tanh(pi/2*I), tanh(-pi/2*I), etc. > 2) Raise an exception of some sort.
3) Create a new warning ComplexInfinityWarning. Tell the warnings module to ignore it by default (do this immediately after defining the ComplexInfinityWarning). Always issue a ComplexInfinityWarning before returning a ComplexInfinity result. Users who want different behavior, like raising an exception, can do so using the warnings module. This emulates how numpy deals with floating point exceptions that arise from similar calculations (although we default to printing the warning as well as returning the infinity). The user can control whether they treat infinities as domain errors or as valid results or even as suspect results that let the computation go through anyways. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/sympy?hl=en -~----------~----~----~----~------~----~------~--~---
