[Date Index]
[Thread Index]
[Author Index]
Re: Re: Number of interval Intersections for a large number of intervals
*To*: mathgroup at smc.vnet.net
*Subject*: [mg81767] Re: [mg81718] Re: [mg81679] Number of interval Intersections for a large number of intervals
*From*: DrMajorBob <drmajorbob at bigfoot.com>
*Date*: Wed, 3 Oct 2007 02:29:23 -0400 (EDT)
*References*: <4236415.1191246194428.JavaMail.root@m35> <200710020936.FAA28508@smc.vnet.net> <31150092.1191354562039.JavaMail.root@m35>
*Reply-to*: drmajorbob at bigfoot.com
I realized, after sending, that it's only the Piecewise discontinuities
that Exclusions detects, not the others caused by InterpolationOrder->0.
It appears that Exclusions occur only at min and minHigh, not at max and
maxLow, yet that's an illusion, as these plots show:
Plot[count2@x, {x, maxLow - 0.1, maxLow + 0.1}]
Plot[count2@x, {x, max - 0.1, max + 0.1}]
count2 is constant near maxLow and max, but Exclusions causes a spurious
gap in the horizontal line at those points. That gap is present but
invisible, I suppose, in the broader chart,
Plot[count2@x, {x, -1, 1}]
Bobby
On Tue, 02 Oct 2007 09:41:43 -0500, Brett Champion <brettc at wolfram.com>
wrote:
> On Oct 2, 2007, at 4:36 AM , DrMajorBob wrote:
>
>> [WRI: there's a Plot/Piecewise insect (bug?) noted below.]
>>
>> I'm having to guess a bit, but maybe this is what you mean:
>>
>> intervals = Sort /@ RandomReal[{-1, 1}, {10^5, 2}];
>> trans = Transpose@intervals;
>> {{min, maxLow}, {minHigh, max}} = Through[{Min, Max}@#] & /@ trans;
>> {low, high} =
>> Interpolation[Transpose@{Sort@#, -1 + Range@Length@#},
>> InterpolationOrder -> 0] & /@ trans;
>>
>> Clear[count]
>> count[x_] /; x < min = 0;
>> count[x_] /; x > max = 0;
>> count[x_] /; x < minHigh := low[x]
>> count[x_] /; x > maxLow := low[maxLow] - high[x]
>> count[x_] := low[x] - high[x];
>> First@Timing@Plot[count@x, {x, -1, 1}]
>>
>> 0.031
>>
>> or
>>
>> Clear[count2]
>> count2[x_] =
>> Piecewise[{{0, x < min}, {low[x], x < minHigh}, {low[x] - high[x],
>> x <= maxLow}, {low[maxLow] - high[x], x <= max}}];
>> First@Timing@Plot[count2@x, {x, -1, 1}]
>>
>> 0.047
>>
>> INSECT report: If I use a small number of Intervals -- 10, say -- the
>> two
>> plots are different. The Piecewise version doesn't have "returns" at
>> some
>> of the discontinuities, even though the following plots the zero
>> function
>> as expected:
>>
>> Plot[count2@x - count@x, {x, -1, 1}]
>>
>> Is this an example of Exclusions->Automatic at work?
>>
>> If so, why aren't all the returns omitted?
>>
>
> Conditional definitions of functions, such as used to define count[],
> are not detected by the automatic calculation of exclusions. I don't
> think this is a bug, although it is an interesting idea.
>
> In the case of count2[], there are only going to be exclusions at the
> Piecewise boundaries: x==min, x==max, x==minHigh, x==maxLow. The
> interpolating function used by low[] and high[] will be a black box to
> it.
>
> Brett Champion
> Wolfram Research
>
--
DrMajorBob at bigfoot.com
Prev by Date:
** Re: Install problem, 6.0, Mac OS 10.4.10: No kernel connect?**
Next by Date:
**Re: Re: Palette Size**
Previous by thread:
**Re: Re: Number of interval Intersections for a large number of intervals**
Next by thread:
**Percent symbol still lacking**
| |