On Thu, Jun 24, 2021 at 8:40 AM David Bailey <d...@dbailey.co.uk> wrote:
>
> On 23/06/2021 23:15, Oscar Benjamin wrote:
> > There are some useful things that you can do with zoo like:
> >
> > In [1]: 1/zoo
> > Out[1]: 0
> >
> I suppose I might question the word 'useful' in your example! I mean oo
> is clearly extremely useful for limits, integrals, etc, but zoo isn't,
> because its phase is indeterminate.

Anyone who's studied complex numbers knows that complex infinity (the
north pole of the Riemann sphere) is a very useful concept. The
usefulness in SymPy is limited by what it is able to compute. For
example, limits currently don't work with zoo. The main benefit for
SymPy is that zoo is a mathematically consistent answer for 1/0, which
helps avoid wrong results.

>
> Aaron also mentioned nan's, and indeed zoo/zoo returns nan! He justifies
> these objects because they avoid raising exceptions - but exceptions
> were invented because they are useful.

I do agree with you here regarding nan, but not zoo. Although I
haven't thought too hard about what the consequences might be for
making code give exceptions where it would currently give nan.

>
> In a string of calculations, zoo's and nan's will just end up being
> passed to other processes that will ultimately raise exceptions that are
> harder to interpret. For example:
>
> integrate(exp(-x),(x,0,zoo))

In this case, it's garbage in, garbage out (the integral is
mathematically meaningless). I'm not sure I see how an indirect
computation could result in this particular example.

In general, if you make a mistake in a way that's still mathematically
valid, you aren't going to get an error at the site of the mistake.
For nan, the point is made that the expression stops being
mathematically valid as soon as it appears, but for zoo, it is valid
in complex numbers. That just might not be what you originally
intended.

By the way, there is some work to make the assumptions on SymPy
symbols finite by default, which can help with some of these concerns.
Right now a Symbol('x') with no given assumptions isn't assumed to be
finite, so it could be zoo as far as the assumptions are concerned.

Aaron Meurer

>
> David
>
>
> --
> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sympy/e19b91f1-3b6c-8656-ab23-ac62b16496dc%40dbailey.co.uk.

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CAKgW%3D6K_OzMq%2BaS224-k6xGY_krgkXCrddvkRCwurB7b6_JCLg%40mail.gmail.com.

Reply via email to