Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #6499 > unrolled thread

EmpiricalDistribution bug

Started byMark Fisher <particlefilter@gmail.com>
First post2011-11-18 11:23 +0000
Last post2011-11-20 10:36 +0000
Articles 3 — 2 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  EmpiricalDistribution bug Mark Fisher <particlefilter@gmail.com> - 2011-11-18 11:23 +0000
    Re: EmpiricalDistribution bug Mark Fisher <particlefilter@gmail.com> - 2011-11-19 11:49 +0000
    Re: EmpiricalDistribution bug Ralph Dratman <ralph.dratman@gmail.com> - 2011-11-20 10:36 +0000

#6499 — EmpiricalDistribution bug

FromMark Fisher <particlefilter@gmail.com>
Date2011-11-18 11:23 +0000
SubjectEmpiricalDistribution bug
Message-ID<ja5f74$6b8$1@smc.vnet.net>
Here is a (bad) bug involving EmpriicalDistribution:

PDF[EmpiricalDistribution[{1}], 1]

produces error messages and returns

Boole[{1}[[GeometricFunctions`BinarySearch[{{1}, "Sorted"}, 1]]] ==
   1] {1}[[GeometricFunctions`BinarySearch[{{1}, "Sorted"}, 1]]]

Here is an (awkward) workaround:

PDF[EmpiricalDistribution[{1}], x] /. x -> 1

which returns 1.

I have submitted this to support@wolfram.com, but I'm hoping someone
lurking from wolfram will look into this and figure out a code patch
that can be applied right away. Thanks.

--Mark

"8.0 for Microsoft Windows (64-bit) (October 7, 2011)"

[toc] | [next] | [standalone]


#6530

FromMark Fisher <particlefilter@gmail.com>
Date2011-11-19 11:49 +0000
Message-ID<ja854v$iid$1@smc.vnet.net>
In reply to#6499
On Nov 18, 6:23 am, Mark Fisher <particlefil...@gmail.com> wrote:
> Here is a (bad) bug involving EmpriicalDistribution:
>
> PDF[EmpiricalDistribution[{1}], 1]
>
> produces error messages and returns
>
> Boole[{1}[[GeometricFunctions`BinarySearch[{{1}, "Sorted"}, 1]]] ==
>    1] {1}[[GeometricFunctions`BinarySearch[{{1}, "Sorted"}, 1]]]
>
> Here is an (awkward) workaround:
>
> PDF[EmpiricalDistribution[{1}], x] /. x -> 1
>
> which returns 1.
>
> I have submitted this to supp...@wolfram.com, but I'm hoping someone
> lurking from wolfram will look into this and figure out a code patch
> that can be applied right away. Thanks.
>
> --Mark
>
> "8.0 for Microsoft Windows (64-bit) (October 7, 2011)"

I got an answer from Andy Ross at Wolfram support:

"This is a known issue that has been resolved for future versions of
Mathematica but unfortunately didn't make it in for 8.0.4. In the
meantime you can use the following code which should fix the problem.

GeometricFunctions`BinarySearch;
Unprotect[GeometricFunctions`BinarySearch];
GeometricFunctions`BinarySearch[{{d_?NumericQ},"Sorted"},x_?
NumericQ]:=Which[x<d,0,x==d,1,True,2];
Protect[GeometricFunctions`BinarySearch];

It is possible (though unlikely) that this could have some unintended
consequences in other parts of Mathematica so only use it if you
really need it."

The patch works but of course I don't know what it might break.

--Mark


[toc] | [prev] | [next] | [standalone]


#6549

FromRalph Dratman <ralph.dratman@gmail.com>
Date2011-11-20 10:36 +0000
Message-ID<jaal88$153$1@smc.vnet.net>
In reply to#6499
So, there actually was an (unofficial) code patch that could be
applied right away, but it hasn't been thoroughly tested. which is
probably a good example of why Wolfram doesn't (officially) distribute
patches. Mathematica is huge, and must be a lot of work to test and
support. If there were official patches floating around, those would
have to be supported too. That's why I don't like patches and plugins
and other things that go bump in the night.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web