# Tag Info

3

Here is a brute force approach, approximating the density by simply counting near neighbors: all = Ball[10000]; blz = {Count[ all, p_ /; (Norm[p - #] < .5)], #} & /@ all ; ..Go get lunch.. Then directly color each point.. Graphics3D[{AbsolutePointSize[3], {Hue[N[(2/3) Log[#[[1]]]/7]], Point[#[[2]]]} & /@ blz}, Boxed -> True, ...

0

This is not particularly clever or efficient, but you could use FindClusters to break the data into pieces and then do a rough density calculation on each piece. Ball[num_] := Table[{#1 Sqrt[1 - #2^2] Cos[#3], #1 Sqrt[ 1 - #2^2] Sin[#3], #1 #2} &[Random[NormalDistribution[1, 0.5]], Random[Real, {-1, 1}], Random[Real, {0, 2 Pi}]], {num}] ...

5

There are two ways: Calculate the density analytically. For the distribution you use this is difficult but since this for producing something pretty, and not for accuracy, you can consider using a different distribution. Approximate the distribution numerically. I'm going to do no. 2. below. I don't have version 7, so it is just a guess that these ...

4

EmpiricalDistribution can assign probabilities to each element in a set of discrete values: Here's an example: In[1]:= d = EmpiricalDistribution[{1/3, 1/2, 1/6} -> {1, 2, 3}]; In[2]:= Mean[d] Out[2]= 11/6 In[3]:= PDF[d, x] Out[3]= 1/3 Boole[1 == x] + 1/2 Boole[2 == x] + 1/6 Boole[3 == x] In[4]:= CDF[d, x] Out[4]= 1/3 Boole[1 <= x] + 1/2 Boole[2 ...

3

In Mathematica, the PDF of a GammaDistribution[a,b] is proportional to $$x^{a-1} e^{-\frac{x}{b}},$$ as described in the documentation. In R, dgamma(x, shape=a, rate=r) is a PDF proportional to $$x^{a-1} e^{-r x},$$ again as described in the documentation. R's rate $r$ is the same as Mathematica's $1/b$. Just make sure you use these parameters ...

5

NExpectation[ Max[(S12 + S1)/2 - 100, 0], {S1, S12} \[Distributed] SliceDistribution[ GeometricBrownianMotionProcess[r, sigma, S0], {1/2, 1}], Method -> "MonteCarlo"] or NExpectation[ Max[(S12 + S1)/2 - 100, 0], {S1, S12} \[Distributed] SliceDistribution[ GeometricBrownianMotionProcess[r, sigma, S0], {1/2, 1}], Method -> {"NIntegrate", ...

2

It appears that Mathematica does not support discontinuous CDFs. For example, try F[x_] := ((Sign[x] + x) + 2)/4 dist = ProbabilityDistribution[{"CDF", F[x]}, {x, -1, 1}]; Plot[{F[x], CDF[dist, x]}, {x, -1, 1}] and you can see the results are not the same. Even if we define $F$ equivalently as G[x_] := Piecewise[{{(1 + x)/4, -1 <= x < 0}, {(3 + ...

Top 50 recent answers are included