Mathematica  Initializations

Mathematica 3. Initializations
Book 3

In[54]:=

Off[General :: spell] ;

Off[General :: spell1] ;

Off[Plot :: plnr] ;

Off[ParametricPlot :: ppcom] ;

Needs["Graphics`FilledPlot`"] ;

Needs["Graphics`Colors`"] ;

Needs["Statistics`DescriptiveStatistics`"] ;

In[61]:=

Unprotect[Var] ;

Clear[Var, X] ;

Var[X_] := VarianceMLE[X] ;

Protect[Var] ;

In[65]:=

$Line = Infinity ; <br />

Unprotect[cumdist, Expect, ExpectPlot, DataSetPlot] ; <br />

Expect[X_] := N[Mean[X]] <br />(*ExpectPlot[X_, color_, pointsize_] := Graphics[{color, pointsize, Point[{Expect[X], 0}]}] ; *)<br />

cumdist[x_, data_] := (Position[Sort[Flatten[{data, x}]], x][[-1, 1]] - 1.)/Length[data] <br />

Options[DataSetPlot] = {DataSetPointSize->0.03, DataSetColor->RGBColor[1, 0, 0], AspectRatio->1/8, PlotLabel->"dataset", AxesLabel->"x"} ;

    Protect[cumdist, Expect, ExpectXPlot, DataSetPlot] ;

In[Infinity]:=

Unprotect[ProbSpike, Freq, FreqPlot, dataplot, FreqPlot, DataPlot] ; <br />

Clear[ProbSpike, Freq, FreqPlot, dataplot, DataPlot] ;

Freq[y_, X_] := N[Count[X, x_/;x == y]/Length[X]] <br /><br /><br />

ProbSpike[x_, X_, spikecolor_, tipcolor_, thickness_] := {Graphics[{spikecolor, thickness, Line[{{x, 0}, {x, Freq[x, X]}}]}], Graphics[{tipcolor, PointSize[0.03], Point[{x, Freq[x, X]}]}]} ;

In[Infinity]:=

Unprotect[indicator, Prob] ;

Clear[x, indicator, given, Prob, A, data, k] ;

indicator[x_, given_] := If[MemberQ[given, x],   1, 0] <br />

Protect[indicator, Prob]

Out[Infinity]=

{indicator, Prob}

In[Infinity]:=

In[Infinity]:=

<br /><br /><br /><br />DataPlot[X_, color_, size_] := Table[ Graphics[{color, size, Point[{Union[X][[k]], 0}]}], {k, 1, Length[Union[X]]}] ;

In[Infinity]:=

In[Infinity]:=

Unprotect[Frequency, Frequencybox, Histogram] ; Clear[Frequency, Frequencybox, Histogram] ;

Frequency[x_, jump_, X_] := cumdist[x + jump, X] - cumdist[x, X] ;

Frequency[Min[X], jump_, X_] := cumdist[Min[X] + jump, X] <br />

Protect[Frequency, Frequencybox, Histogram] ;

Unprotect[Filledplot] ;

    Clear[Filledplot] ;

Protect[FilledPlot] ; <br />

Unprotect[CumdistBoxplot] ;

Clear[CumdistBoxplot] ;

Protect[CumdistBoxPlot]

Out[Infinity]=

{CumdistBoxPlot}

In[Infinity]:=

In[Infinity]:=

In[Infinity]:=

In[Infinity]:=

Unprotect[Exponentialcumdist, ExponentialFrequency, ExponentialFrequencybox, ExponentialHistogram] ;

Clear[Exponentialcumdist, ExponentialFrequency, ExponentialFrequencybox, ExponentialHistogram] ;

Exponentialcumdist[x_, mean_ ]    := 1 - E^(-x/mean) ;

In[Infinity]:=

        <br />ExponentialFrequency[x_, jump_, mean_] := Exponentialcumdist[x + jump, mean] - Exponentialcumdist[x , mean]

In[Infinity]:=

N[E^(-4)]

In[Infinity]:=

In[Infinity]:=

Protect[Exponentialcumdist, ExponentialFrequency, ExponentialFrequencybox, ExponentialHistogram] ;

In[Infinity]:=

Unprotect[Normalcumdist, NormalFrequency, NormalFrequencybox, NormalHistogram] ;

Clear[Normalcumdist, NormalFrequency, NormalFrequencybox, NormalHistogram] ;

Normalcumdist[x_, mean_ , dev_]    := 1/2 (1 + Erf[(-mean + x)/(2^(1/2) dev)]) <br />        

NormalFrequency[x_, jump_, mean_, dev_] := Normalcumdist[x + jump, mean, dev] - Normalcumdist[x , mean, dev] <br />

Protect[Normalcumdist, NormalFrequency, NormalFrequencybox, NormalHistogram] ;


Created by Mathematica  (September 6, 2006) Valid XHTML 1.1!