New answers tagged

3

Couldn't you model this as a DiscreteMarkovProcess? (* states are start(1), stage1(2), stage2(3), stage3(4), missing(5) *) proc = DiscreteMarkovProcess[{1, 0, 0, 0, 0}, {{0, 0.253, 0, 0, 0.747}, {0, 0, 0.507, 0, 0.493}, {0, 0, 0, 0.705, 0.295}, {0, 0, 0, 1, 0}, {0, 0, 0, 0, 1} }]; Graph[proc] PDF[StationaryDistribution[proc], 4] (* 0....


2

This method generalises easily to larger sums: k = 2; vec = Array[x, k]; dist = EmpiricalDistribution[{2/9, 5/9, 2/9} -> {-1, 0, 1}]; pdf = PDF @ TransformedDistribution[ Total[vec], vec \[Distributed] ProductDistribution[ {dist, k} ] ] DiscretePlot[pdf[n], {n, -10, 10}, PlotRange -> All]


1

Two random variables, x and y, each with the same distribution: dist = EmpiricalDistribution[{2/9, 5/9, 2/9} -> {-1, 0, 1}]; ya[t_] := PDF[TransformedDistribution[x + y, {x \[Distributed] dist, y [Distributed] dist}], t]; ya /@ Range[-10, 10] (*Output:{0,0,0,0,0,0,0,0,4/81,20/81,11/27,20/81,4/81,0,0,0,0,0,0,0,0}*)


3

Amplifying on answer by @bRost03 distX = TruncatedDistribution[{0, Pi/2}, NormalDistribution[μ, σ]]; distY = TransformedDistribution[h/Tan[x], x \[Distributed] distX, Assumptions -> h > 0]; g = Assuming[{y > 0, h > 0, σ > 0, μ ∈ Reals}, PDF[distY, y] // FullSimplify] (* (E^(-((μ + 2 ArcTan[(y - Sqrt[h^2 + y^2])/h])^2/( 2 σ^2))) h ...


4

EDIT It seems to work now. The key is to use the TruncatedDistribution so $h \cot(x)$ is monotonic. transF=TransformedDistribution[h Cot[x], x\[Distributed]TruncatedDistribution[{0,π/2},NormalDistribution[μ,σ]], Assumptions->μ∈Reals&&σ>0&&h>0]; FullSimplify[PDF[transF,y],{y>0,h>0,μ∈Reals,σ>0}] gives (E^(-((μ + 2 ArcTan[(...


2

It works if you boost the Working precision. h[x_] := (x*CDF[NormalDistribution[0, 1], x]* Log[CDF[NormalDistribution[0, 1], x]])/ PDF[NormalDistribution[0, 1], x]; Then Plot[h[x], {x, -5, 14}, WorkingPrecision -> 80] Note that for a WorkingPrecision -> 40 one gets a smooth output with a sharp discontinuity near 13.5 which is somewhat ...


7

The slowest part of the code is clearly Zeta. You have to compute it only on a small parameter range and you also do not much very high accuracy (as Monte Carlo won't deliver much accuracy, too). So you can just sample Zeta over a fixed grid and use an interpolation function instead. Mathematica's interpolation functions are notoriously slow, so I implement ...


3

Just an extended comment stating that the one-step can be made to work but it's a very fragile approach. The list z below is a list of equivalent formulations of the desired random variable: z = {10^(1/5 (25 + 5 x + y)), Exp[5 Log[10] + Log[10] x + Log[10] y/5], Exp[Log[10] (5 + x + y/5)], Exp[a (5 + x + y/5)]}; TableForm[results = {#, Mean[...


0

randomNoodle[start_: {0, 0}, angle_: Pi/4, length_: 1, pieces_: 20] := Line[AnglePath[start, Thread[{length/pieces, RandomReal[{-angle, angle}, pieces]}]]] Examples: SeedRandom[4444] noodles = Table[randomNoodle[RandomReal[1, 2]], 20]; MinMax[ArcLength /@ noodles] {1., 1.} g = Graphics[{RandomColor[], Thick, #} & /@ noodles, ImageSize -> Large] ...


Top 50 recent answers are included