[Date Index]
[Thread Index]
[Author Index]
Re: Re: how to explain this weird effect? Integrate
*To*: mathgroup at smc.vnet.net
*Subject*: [mg46432] Re: [mg46290] Re: how to explain this weird effect? Integrate
*From*: Daniel Lichtblau <danl at wolfram.com>
*Date*: Wed, 18 Feb 2004 00:36:55 -0500 (EST)
*References*: <200402121216.HAA12039@smc.vnet.net> <c0hhvb$lgl$1@smc.vnet.net> <200402140256.VAA08500@smc.vnet.net>
*Sender*: owner-wri-mathgroup at wolfram.com
steve_H wrote:
> Andrzej Kozlowski <akoz at mimuw.edu.pl> wrote in message news:<c0hhvb$lgl$1 at smc.vnet.net>...
>
>
>>It's not hard to explain if you actually look at the output you get
>>before substituting values for n and m.
>>
>
>
> hi;
>
> I think you missed my point.
>
> As I said , I do see why Mathematica complained. It is clear from
> the ouput. and I know that taking the limit will give the correct
> result I wanted to see. But this is not the point.
>
> My point is that mathematically speaking, it should not make a
> difference when one does the substitution. But using a computer
> algebra package, it made a difference. I am not looking for a way around
> this, I wanted to talk about the user not having to work around these
> limitations.
>
> So, the question is that, why did not Mathematica perform the Limit operation
> itself to give the correct answer?
>
> Look at this example:
>
> r = 1/a
> r /. a -> 0
>
> Here Mathematica complains becuase of 1/0 problem, but still returns
> ComplexInfinity as the correct answer.
>
> Now when I type
>
> Limit[r, a -> 0]
> no complaint is given, and infinity is the answer again.
>
> mathematically speaking, 1/a when a=0, is the same as Limit[1/a , a->0]
> So, the final answer should not be different.
>
> But when I typed
> r = Integrate[Sin[m x] Sin[n x], {x, 0, 2 Pi}]
> r /. {n -> 2, m -> 2}
>
> Mathematica complained about 1/0 output, BUT also did NOT give the answer.
>
> So, here we have 2 examples, both have 1/0 problem, in both cases Mathematica
> complained about 1/0, but in one case it still gave the final answer,
> and in the second case it did not.
>
> to conclude, Mathematica should do one of 2 things:
>
> 1. complain about 1/0, but internally apply the Limit to see if it can
> obtain an answer.
> 2. not complain about 1/0 if applying the Limit will resolve it, else
> only then complain about 1/0 and give no answer.
>
> thanks,
> Steve
>
This thread seems to persist so I thought I might say a few words about
replacement vs. extraction of limits in Mathematica. Specifically I will
provide some of the reasons why the latter is not compatible with the
semantics of the former.
First, the example
r = 1/a
followed by
r /. a->0
gives an undirected infinity. I think all agree this is appropriate and
thus requires no comment. But what of
Limit[r, a->0]
returning DirectedInfinity[1] (that is, +infinity)? This follows from
Limit semantics, which has a default direction associated to limits (and
can be overridden by a specification Direction->...). For infinities,
the direction is simply the direction vector of the infinity. For finite
points, the default direction is -1, that is, approach from the right.
Thus, in this example, we approach the origin from the right, and so
DirectedInfinity[1] is the correct result.
The more general question, as best I can discern, is whether replacement
should in some cases invoke Limit. The short answer is "No, it should
not". I'll try to explain what are the issues but note that already the
example above gives insight into one such.
First observe that replacement is a structural operation. There is no
notion of "variables' and indeed one might do
expr /. {2*a->3, 5->x, Pi->7.2, r^2+3*s->z, Sin[x]->Cos[t]}
Limit, by way of contrast, works with a single variable. Hence the
domains of applicability of Limit and ReplaceAll are not the same.
Next note that Limit may apply various nontrivial transformations
unrelated to whatever is specified in the ReplaceAll. In addition to
being an intrinsically nonstructural operation (it is mathematical,
after all), it can also be slow. Which means it is not well suited for
large-scale replacement operations of the type occasionally done in
computations e.g. when doing random replacements in a large expression
to see if it might be zero.
Another thing to observe, as noted in the example above, is that limits
may depend on direction. When multiple variables are present, they
depend on order as well. Hence results of automatic use of Limit with
replacement of variables, when it could be done at all, would be
difficult to interpret.
I hope this helps to explain why Limit neither is nor could be involved
in ReplaceAll.
Daniel Lichtblau
Wolfram Research
Prev by Date:
**Re: How to numerically estimate an asymptotic equivalent?**
Next by Date:
**Re: Re: how to explain this weird effect? Integrate**
Previous by thread:
**Re: how to explain this weird effect? Integrate**
Next by thread:
**Re: how to explain this weird effect? Integrate**
| |