Re: a noise with a better histogram
- To: mathgroup at smc.vnet.net
- Subject: [mg49305] Re: [mg49297] a noise with a better histogram
- From: DrBob <drbob at bigfoot.com>
- Date: Tue, 13 Jul 2004 04:32:37 -0400 (EDT)
- References: <200407120611.CAA12235@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Roger, In my last post, I mentioned that the only function of Random[] that will give Normal variates is the inverse of the Normal CDF. Instead (in your notebook below), you started by inverting the Normal PDF. (Not the same at all.) Then you reapplied a version of the x function you liked so well before, with Re to avoid getting Imaginary numbers: x[a_] := If[Random[] < 0.5, (1 + Sqrt[1 - a^2])/a, (1 - Sqrt[1 - a^2])/a] g[y_] := (-I)*Sqrt[2]*Sqrt[Log[Sqrt[2*Pi]*y]] noise = Table[Re[g[x[Sin[2*Pi*Random[]]]]], {n, 1, 10000}]; So the variates are (substituting X for Random[]): Re[g[x[Sin[2*Pi*X]]]] (If that were InverseErf[X], the variates would be normal.) Then you calculated b = Floor[2500 noise]; because you want Integers and a lot of spread, I guess? Next you plotted a home-grown Histogram... bmax=Max[b] bmin=Min[b] c=Table[Count[b,n],{n,Floor[bmin],bmax}]; ListPlot[c,PlotJoined->True,PlotRange->{{0,bmax+Abs[bmin]},{0,15}}] 11189 0 (and the plot) But this plot hides the fact that over 30% of the variates are zeroes: First@c 3739 Hence the distribution (1) is integer valued, (2) has a huge spike at 0, and (3) is strictly non-negative. Any one of those would be enough to guarantee the distribution isn't normal. But there was no reason to think it would be normal, anyway. Bobby On Mon, 12 Jul 2004 02:11:39 -0400 (EDT), Roger L. Bagula <rlbtftn at netscape.net> wrote: > I used an inversion of a Gaussian to > get my amplitudes instead of a Gaussian. > It seems to work somewhat better in terms of the histogram. > I'm indepted to the patient work of Ray Kooperman and Dr. Bobby Treat > on Kurtosis excess calculations and Cauchy distribution calculations. > As I am giving this information to the egroup for comment, > I must take the good with the bad. > Respectfully, Roger L. Bagula > tftn at earthlink.net, 11759Waterhill Road, Lakeside,Ca 92040-2905,tel: > 619-5610814 : > URL : http://home.earthlink.net/~tftn > URL : http://victorian.fortunecity.com/carmelita/435/ > > (*********************************************************************** > > Mathematica-Compatible Notebook > > This notebook can be used on any computer system with Mathematica 3.0, > MathReader 3.0, or any compatible application. The data for the notebook > starts with the line of stars above. > > To get the notebook into a Mathematica-compatible application, do one of > the following: > > * Save the data starting with the line of stars above into a file > with a name ending in .nb, then open the file inside the application; > > * Copy the data starting with the line of stars above to the > clipboard, then use the Paste menu command inside the application. > > Data for notebooks contains only printable 7-bit ASCII and can be > sent directly in email or through ftp in text mode. Newlines can be > CR, LF or CRLF (Unix, Macintosh or MS-DOS style). > > NOTE: If you modify the data for this notebook not in a Mathematica- > compatible application, you must delete the line below containing the > word CacheID, otherwise Mathematica-compatible applications may try to > use invalid cache data. > > For more information on notebooks and Mathematica-compatible > applications, contact Wolfram Research: > web: http://www.wolfram.com > email: info at wolfram.com > phone: +1-217-398-0700 (U.S.) > > Notebook reader applications are available free of charge from > Wolfram Research. > ***********************************************************************) > > (*CacheID: 232*) > > > (*NotebookFileLineBreakTest > NotebookFileLineBreakTest*) > (*NotebookOptionsPosition[ 5032, 188]*) > (*NotebookOutlinePosition[ 5877, 215]*) > (* CellTagsIndexPosition[ 5833, 211]*) > (*WindowFrame->Normal*) > > > > Notebook[{ > Cell[BoxData[ > \(Clear[x, a, b]\)], "Input"], > > Cell[BoxData[ > \( (*\ > a = \(Sin[2*Pi*Random[]] = > 2*x/\(\((1 + x^2)\) : \ > projective\ line\ to\ circle\ random\ solution\ as\ x\ > on\ the > \ line\)\)*) \)], "Input"], > > Cell[BoxData[ > \( (*\ > b = \(Cos[2*Pi*Random[]] = > \((1 - x^2)\)/ > \(\((1 + x^2)\) : \ > projective\ line\ to\ circle\ random\ solution\ as\ x\ > on\ the\ > line\)\)*) \)], "Input"], > > Cell[BoxData[ > \(\( (*\ by\ Roger\ L . \ Bagula\ 11\ July\ 2004*) \ \)\)], "Input"], > > Cell[CellGroupData[{ > > Cell[BoxData[ > \(Solve[a - 2*x/\((1 + x^2)\) == 0, x]\)], "Input"], > > Cell[BoxData[ > \({{x \[Rule] \(1 - \@\(1 - a\^2\)\)\/a}, { > x \[Rule] \(1 + \@\(1 - a\^2\)\)\/a}}\)], "Output"] > }, Open ]], > > Cell[CellGroupData[{ > > Cell[BoxData[ > \(Solve[b - \((1 - x^2)\)/\((1 + x^2)\) == 0, x]\)], "Input"], > > Cell[BoxData[ > \({{x \[Rule] \(-\(\@\(1 - b\)\/\@\(1 + b\)\)\)}, { > x \[Rule] \@\(1 - b\)\/\@\(1 + b\)}}\)], "Output"] > }, Open ]], > > Cell[BoxData[ > \( (*\ > using\ the\ larger\ > \(solution : \ randoms\ distributed\ over\ the\ real\ line\)*) > \)], > "Input"], > > Cell[BoxData[ > \(SeedRandom[]\)], "Input"], > > Cell[BoxData[ > \(x[a_] := > If[Random[] < 0.5, \(1 + \@\(1 - a\^2\)\)\/a, \(1 - \@\(1 - > a\^2\)\)\/a] > \)], "Input"], > > Cell[BoxData[ > \( (*\ > plot\ of\ line\ random\ to\ inverse\ normal\ distribution\ > height\ at\ > that\ point\ on\ the\ \(line : \ a\) = Sin[2*Pi*Random[]]*) \)], > "Input"], > > Cell[CellGroupData[{ > > Cell[BoxData[ > \(Solve[y - Exp[\(-x^2\)/2]/Sqrt[2*Pi] == 0, x]\)], "Input"], > > Cell[BoxData[ > \(Solve::"ifun" \( : \ \) > "Inverse functions are being used by \!\(Solve\), so some > solutions may \ > not be found."\)], "Message"], > > Cell[BoxData[ > \({{x \[Rule] \(-I\)\ \@2\ \@Log[\@\(2\ \[Pi]\)\ y]}, { > x \[Rule] I\ \@2\ \@Log[\@\(2\ \[Pi]\)\ y]}}\)], "Output"] > }, Open ]], > > Cell[BoxData[ > \(g[y_] := \(-\ I\)*\@2\ \@Log[\@\(2\ \[Pi]\)\ y]\)], "Input"], > > Cell[BoxData[ > \(\(noise = Table[Re[g[x[Sin[2*Pi*\((Random[])\)]]]], {n, 1, 10000}]; > \)\)], "Input"], > > Cell[CellGroupData[{ > > Cell[BoxData[ > \(ListPlot[noise, PlotRange -> All, \ PlotJoined -> \ True]\)], > "Input"], > > Cell[BoxData[ > TagBox[\(\[SkeletonIndicator] Graphics \[SkeletonIndicator]\), > False, > Editable->False]], "Output"] > }, Open ]], > > Cell[BoxData[ > \(\(b = Table[Floor[2500*noise[\([n]\)]], {n, 1, 10000}]; \)\)], > "Input"], > > Cell[CellGroupData[{ > > Cell[BoxData[ > \(b0 = \(Dimensions[b]\)[\([1]\)]\)], "Input"], > > Cell[BoxData[ > \(10000\)], "Output"] > }, Open ]], > > Cell[CellGroupData[{ > > Cell[BoxData[ > \(bmax = Max[b]\)], "Input"], > > Cell[BoxData[ > \(10205\)], "Output"] > }, Open ]], > > Cell[CellGroupData[{ > > Cell[BoxData[ > \(bmin = Min[b]\)], "Input"], > > Cell[BoxData[ > \(0\)], "Output"] > }, Open ]], > > Cell[BoxData[ > \(\(c = Table[Count[b, n], {n, Floor[bmin], bmax}]; \)\)], "Input"], > > Cell[CellGroupData[{ > > Cell[BoxData[ > \(ListPlot[c, PlotJoined -> True, > PlotRange -> {{0, bmax + Abs[bmin]}, {0, 15}}]\)], "Input"], > > Cell[BoxData[ > TagBox[\(\[SkeletonIndicator] Graphics \[SkeletonIndicator]\), > False, > Editable->False]], "Output"] > }, Open ]] > }, > FrontEndVersion->"Macintosh 3.0", > ScreenRectangle->{{0, 1920}, {0, 1060}}, > WindowSize->{1134, 746}, > WindowMargins->{{239, Automatic}, {Automatic, 125}}, > MacintoshSystemPageSetup->"\<\ > 00/0001804P000000_@2@?olonh35@9B7`<5:@?l0040004/0B`000003509H04/ > 02d5X5k/02H20@4101P00BL?00400@0000000000000000010000000000000000 > 0000000000000002000000@210D00000\>" > ] > > > (*********************************************************************** > Cached data follows. If you edit this Notebook file directly, not using > Mathematica, you must remove the line containing CacheID at the top of > the file. The cache data will then be recreated when you save this file > from within Mathematica. > ***********************************************************************) > > (*CellTagsOutline > CellTagsIndex->{} > *) > > (*CellTagsIndex > CellTagsIndex->{} > *) > > (*NotebookFileOutline > Notebook[{ > Cell[1709, 49, 47, 1, 27, "Input"], > Cell[1759, 52, 218, 5, 27, "Input"], > Cell[1980, 59, 237, 6, 27, "Input"], > Cell[2220, 67, 86, 1, 27, "Input"], > > Cell[CellGroupData[{ > Cell[2331, 72, 69, 1, 27, "Input"], > Cell[2403, 75, 121, 2, 46, "Output"] > }, Open ]], > > Cell[CellGroupData[{ > Cell[2561, 82, 79, 1, 27, "Input"], > Cell[2643, 85, 128, 2, 51, "Output"] > }, Open ]], > Cell[2786, 90, 140, 4, 27, "Input"], > Cell[2929, 96, 45, 1, 27, "Input"], > Cell[2977, 99, 130, 3, 48, "Input"], > Cell[3110, 104, 190, 4, 27, "Input"], > > Cell[CellGroupData[{ > Cell[3325, 112, 78, 1, 27, "Input"], > Cell[3406, 115, 154, 3, 22, "Message"], > Cell[3563, 120, 140, 2, 50, "Output"] > }, Open ]], > Cell[3718, 125, 80, 1, 49, "Input"], > Cell[3801, 128, 108, 2, 27, "Input"], > > Cell[CellGroupData[{ > Cell[3934, 134, 90, 1, 27, "Input"], > Cell[4027, 137, 130, 3, 26, "Output"] > }, Open ]], > Cell[4172, 143, 91, 1, 27, "Input"], > > Cell[CellGroupData[{ > Cell[4288, 148, 64, 1, 27, "Input"], > Cell[4355, 151, 39, 1, 26, "Output"] > }, Open ]], > > Cell[CellGroupData[{ > Cell[4431, 157, 46, 1, 27, "Input"], > Cell[4480, 160, 39, 1, 26, "Output"] > }, Open ]], > > Cell[CellGroupData[{ > Cell[4556, 166, 46, 1, 27, "Input"], > Cell[4605, 169, 35, 1, 26, "Output"] > }, Open ]], > Cell[4655, 173, 85, 1, 27, "Input"], > > Cell[CellGroupData[{ > Cell[4765, 178, 118, 2, 27, "Input"], > Cell[4886, 182, 130, 3, 26, "Output"] > }, Open ]] > } > ] > *) > > > > > (*********************************************************************** > End of Mathematica Notebook file. > ***********************************************************************) > > > > > -- DrBob at bigfoot.com www.eclecticdreams.net
- References:
- a noise with a better histogram
- From: "Roger L. Bagula" <rlbtftn@netscape.net>
- a noise with a better histogram