Why do you use Wild('a')?
Aaron Meurer
> --
> You received this message because you are subscribed to the Google Groups "sympy" group.
> To post to this group, send email to sy...@googlegroups.com.
> To unsubscribe from this group, send email to sympy+un...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/sympy?hl=en.
>
Neither one trumps the other. That is why 0*oo returns nan.
Aaron Meurer
Hmmm...I thought I left such behavior in (`x*oo`) after a suggestion of yours perhaps thinking that the above was true...perhaps you had the -oo in mind? Regarding the other,
[ http://www.philforhumanity.com/Zero_Times_Infinity.html ]
/c
For me, no matter what we call them, limit directions *are* filters.
A priori, I agree that going back to the theoretical definition will
often not be terribly useful in practice. However, the definition is
very important for the design because it ensures that we can operate on
these objects in a perfectly consistent manner.
>
> Limit descriptions are the answers of limits.
> These can be very complicated, if a lot of information is to be
> conveyed. For example:
>
> * limits can exist as ordinary numbers, this is the base case
> (limit(sin(x), x, 0) == 0 for example)
> * limits taken in R can be +oo or -oo in a well-defined sense, e.g.
> limit(x**2, x, oo)
> * limits such as limit(sin(x), x, oo) have to be described in a more
> complicated way. The result could say "point of accumulation for any x
> in [-1, 1]".
> * limits of meromorphic functions in C can be classified as a number,
> a pole of order n (for some n > 0), or essential singularity
> * in general, not much can be said. Even a rational function of two
> variables can have limits that cannot usefully be interpreted as a
> number or infinity.
>
Limit descriptions are filters as well (except that I don't see how to
express the order of a pole with a filter, but I'd argue that it is
singularity classification, not limit description). For any filter X,
limit(f(x), x -> X) is the filter f(X), i.e. the filter generated by the
set {f(A)| A ∈ X}.
>
> Much confusion arises, I think, because objects of the three different
> classes are often described by the same names:
>
> * a number can be seen as an expression and as a limit description,
> and also as a limit direction at least two different ways (over C and
> over R)
> * oo can be seen as both a singularity description and as a limit
> direction
> * ditto for zoo
>
> Moreover +-oo can be seen as two points of an extended real line
> (topologically its end-compactification). Similarly zoo can be seen as
> a point on the riemann sphere.
>
> Finally, we typically want to be able to do at least some arithmetic
> with infinities, to write things such as oo+1 == oo. SympyCore calls
> this extended number system.
>
All this works just as well if oo and zoo are defined as filters.
>
> *Use cases*
>
> My primary use case is for code in sympy to be able to understand the
> result of a limiting operation. In particular there is currently no
> (good) way to interpret the result of e.g. limit(Wild('a')*x, x, oo)
> as being "infinity" (to the end user a*oo is visibly infinity, but
> (a*oo).is_unbounded is None)
>
> For end-users, a useful result in e.g. limit(sin(x), x, oo) would be
> desirable.
>
If oo is a filter, sin(oo) is perfectly well defined: it's the filter
generated by [-1, 1].
Arithmetic between numbers and filters can be defined via f(X) =
limit(f(x), x ->X) where f is an ordinary real or complex function, i.e.
1 + oo = limit(1 + x, x -> oo) = oo.
Arithmetic between filters can be defined via f(X, Y) = limit(f(x,y),
(x, y) -> X×Y). This gives the same results as above except where NaN is
involved.
oo - oo is well defined. Going back to the definition of filters, it's
easy to see that its value is the filter generated by R, which should be
called something like "AnyReal". Similarly, zoo + oo is AnyComplex.
Turning now to 0 * +oo, we see that it's important to make a difference
between 0 as a real number and 0 as limit direction. If 0 is a real
number, then according to the first definition above 0 * oo = 0. If we
consider the neighbourhood of 0, calling the corresponding filter '0~'
to avoid ambiguity, then the second definition applies
and we have 0~ * oo = AnyReal, 0~ * zoo = AnyComplex, etc.
> *Implementation*
>
> Here I don't know a lot to say at all. Limit descriptions should
> derive from Expr, possibly even Number. Limit directions should not.
> The "honest-to-got" limit evaluation function should take as arguments
> an expression, a variable and a limit direction and returns a limit
> description. A more user-friendly wrapper can query things like the
> type of symbol and then construct a call to call to the "honest-to-
> god" function. E.g. (pseudocode)
>
> def limit(ex, var, a):
> if var.is_real:
> if a.is_bounded:
> return limitHonest(ex, x, RealDirection(a, twoSided=True))
> else:
> return limitHonest(ex, x, RealDirection(a))
> else: # assume a is complex for now
> return limitHonest(ex, x, ComplexDirection(a))
>
> I have no idea if effective algorithms exist for determining limiting
> behaviours in more general cases.
>
>
> This is my two cents. I know I am just getting started working with
> sympy, so there are probably many things wrong with this proposal. I'm
> just trying to clarify things and get discussion started.
>
Thanks for sharing your ideas. This discussion is very interesting.
> Thanks,
> Tom
>
Tom, can I ask you to put your letter content on wiki? I am going create
section where to put similar materials (Under Consideration or something
else).
Regarding the content itself, I have some little remark that `Limit
descriptions` is some confuse name-token, because it is not obviously
what it is: either it is description of procedure, or description of
result of it.
--
Alexey U.
Thanks, I will answer in a day.
--
Alexey U.
Sorry for the late answer.
Problematic
------------
First off all, I would to clarify the aims, what problematic issues it
touch on, which are unresolved or under decision now.
So I add some ones and If I'll write something wrong, correct me please.
Issue 2200, what should be :
>>> limit(sin(x),x,oo)
Issue 2097, what should be:
>>> sin(oo)
issue 2096, What should be:
>>> 1/0
Issue 1116, integrate outputs wrong result when the function is singular.
Issue 360, Arithmetic with complex infinity
Issue 1321, trigonometric functions of floating-point numbers should
return floating-point numbers.
Issue 2242, A general way to describe and test for singularities is needed.
Issue 1000, What should be:
>>> limit(abs(x)/x, x, 0)
Definition of limit (One-sided limits).
(See Hector's last mail message)
This issues touch upon various topics, and we will rely on those common
definitions:
* limit
[1] http://en.wikipedia.org/wiki/Limit_of_a_function
[8]
* singularities
[2] http://en.wikipedia.org/wiki/Mathematical_singularity
* Real field extension
(R U +oo U -oo)
[3] http://en.wikipedia.org/wiki/Extended_real_number_line
(R U oo)
[4] http://en.wikipedia.org/wiki/Real_projective_line
Previous discussions collection:
limit(abs(x)/x, x, 0)
[5]
http://groups.google.com/group/sympy/browse_thread/thread/c834029d7696de5c
On a general representation for singularities and infinities (limits in
topological spaces, described by filters)
[6] https://github.com/sympy/sympy/wiki/Infinities-and-Singularities
[7]
http://groups.google.com/group/sympy/browse_thread/thread/73f7e90aef508882
Limits
------
Regarding the issue 1000 (`limit(abs(x)/x, x, 0)`)
Hector almost resolved it right now for reals. I agree, that
mathematically limit don't exists at zero point, but only one-sides
limits exist.
(a) One question (to all), is the exception needed or is returning of
nan (or None) sufficient in this case?
On the one hand, if we can assume that `nan` related with value of
source expression, so limit can't return result as the value in a field
of function result.
On the other hand, we can use exception, but to avoid exceptions in
outer user's code, user can use (and we can introduce) some tester
methods (has_limit, is_continues, get_singularity_description).
e.g limit(sin(x), x, oo) is not exists (in both sides, btw).
(Oops, I can't say exactly is it continuous *at* `oo` point or not, I
think rather not, it is related with the way of real number line extension)
Regarding the issue 2200, what should be `limit(sin(x),x,oo)`.
In Tom's [6, 7] the general way is described how to deal with limits in
topological spaces (general definition of limit, and one-sided limits
are also in it)
Additionally the difference between general limit results (value of
function, singularity description, infinity) on one hand and
description of limit procedure on the other have introduced, which is
mixed now in SymPy in case of `oo`.
Further I am going answer to Toms's page (because I promised to answer).
But before I want to say, that from limit procedure I expect (in general
meaning) to get the behaviour of function in limit (is it value, or
singularity description, or something else), so I'll always keep in mind
this aim (with above issue resolution).
Preliminary remarks about [6]:
(b) In preamble section I should like to add the above issues if they
are related (with links for convenient).
(c)
> There are three kinds of objects involved: expressions, "limit
directions" and "limit result descriptions".
To avoid confusion, as I understand, by the term "limit directions"
entailed "limit directives" how to obtain limit (not directions on the
plane or axes).
Now classify the kinds of results of limit procedure precisely.
As it have written above the strict definition entailed the existence of
limit or not:
(d) If limit exists then value is returned (which belongs to the field
of function).
The discussion question in this case is only how consider `oo` (this
question rises in issue 2096)
(e) If limit is not exists, then discussion question is what should
resulted in (exception or nan, or limit result description)
(f) "limit result descriptions"
Note that if (e) will be resulted to return nan or exception then
separated procedure will be required for obtaining "limit result
descriptions". Nevertheless for the moment I see just only one aim of
it: describe behaviour of function in limit. E.g.
>>> limit(sin(x), x, oo)
Singularity(type="essential", interval=[-1, 1])
or another variant( it depends on (b) resolving):
>>> limit(sin(x), x, oo)
nan
>>> singularity(sin(x), x, oo)
Singularity(type="essential", interval=[-1, 1])
also it can be resolved somehow (I am not sure)
>>> sin(oo)
Singularity(type="essential", interval=[-1, 1])
>>> sin(oo)**2
Singularity(type="essential", interval=[0, 1])
May be the others "limit result descriptions" exists too.
(g) But, as I understand , the last variant does not underlie the thesis
that "filters are not limit result descriptions". (right, Tom?)
Now talk about algorithms.
(i) The direct method described in Tom's page, as I understand, is
consist of with operations with filter.
(This question is very hard for me, so I omit it).
(k) Additionally (or with combination), we can go on the other hand to
achieve some targets .
We can describe a class of function for which well known that in any
filter they have limit (or pole) (E.g. continuous, complex analytical).
This calculation may be recourse and rely on some properties of
elementary functions and their combinations.
In this case, the task can be in separated to question of implementing
useful methods (`is_continuous` `is_differentiable`, `is_analytical`)
for other topics (series)
(Unfortunately I don't estimate how it related with gruntz algorithm.)
In conclusion I write, that (a-k) are questions for discussions, in
wchich I am not sure. (b,c) rather for Tom about [6] wiki-page.
And I am going to extend wiki pages (with the help of Tom) after discussion.
Sorry for tangled message.
--
Alexey U.