3 replaced http://mathematica.stackexchange.com/ with https://mathematica.stackexchange.com/
source | link

Here is how you can apply the same principles used in this answerthis answer to your problem:

distSum = {0.167467 E^(-(1/2) (-21.5 + x)^2), 0.160772 E^(-(1/2) (-19.7 + x)^2), 
   0.233762 E^(-(1/2) (-21.7 + x)^2), 0.0930353 E^(-(1/2) (-21.9 + x)^2), 
   0.373293 E^(-(1/2) (-22.4 + x)^2), 0.126876 E^(-(1/2) (-19. + x)^2), 
   0.348056 E^(-(1/2) (-22.7 + x)^2), 0.393082 E^(-(1/2) (-21.4 + x)^2), 
   0.35867 E^(-(1/2) (-20.9 + x)^2), 0.383496 E^(-(1/2) (-22.3 + x)^2)};

dist = ProbabilityDistribution[
        Plus @@ distSum, {x, -Infinity, Infinity}, Method -> "Normalize"];

mean = NExpectation[x, x \[Distributed] dist]

$\ $ 21.6074

variance = Expectation[(x - mean)^2, x \[Distributed] dist] // Chop

$\ $ 1.94362

Plot[PDF[dist, x], {x, 12, 30}, PlotRange -> All]

Out

RandomVariate[dist, 10]

$\ $ {20.7231, 21.2831, 20.6987, 22.486, 22.7043, 25.5388, 21.5406, 21.9175, 20.5078, 21.9182}

Here is how you can apply the same principles used in this answer to your problem:

distSum = {0.167467 E^(-(1/2) (-21.5 + x)^2), 0.160772 E^(-(1/2) (-19.7 + x)^2), 
   0.233762 E^(-(1/2) (-21.7 + x)^2), 0.0930353 E^(-(1/2) (-21.9 + x)^2), 
   0.373293 E^(-(1/2) (-22.4 + x)^2), 0.126876 E^(-(1/2) (-19. + x)^2), 
   0.348056 E^(-(1/2) (-22.7 + x)^2), 0.393082 E^(-(1/2) (-21.4 + x)^2), 
   0.35867 E^(-(1/2) (-20.9 + x)^2), 0.383496 E^(-(1/2) (-22.3 + x)^2)};

dist = ProbabilityDistribution[
        Plus @@ distSum, {x, -Infinity, Infinity}, Method -> "Normalize"];

mean = NExpectation[x, x \[Distributed] dist]

$\ $ 21.6074

variance = Expectation[(x - mean)^2, x \[Distributed] dist] // Chop

$\ $ 1.94362

Plot[PDF[dist, x], {x, 12, 30}, PlotRange -> All]

Out

RandomVariate[dist, 10]

$\ $ {20.7231, 21.2831, 20.6987, 22.486, 22.7043, 25.5388, 21.5406, 21.9175, 20.5078, 21.9182}

Here is how you can apply the same principles used in this answer to your problem:

distSum = {0.167467 E^(-(1/2) (-21.5 + x)^2), 0.160772 E^(-(1/2) (-19.7 + x)^2), 
   0.233762 E^(-(1/2) (-21.7 + x)^2), 0.0930353 E^(-(1/2) (-21.9 + x)^2), 
   0.373293 E^(-(1/2) (-22.4 + x)^2), 0.126876 E^(-(1/2) (-19. + x)^2), 
   0.348056 E^(-(1/2) (-22.7 + x)^2), 0.393082 E^(-(1/2) (-21.4 + x)^2), 
   0.35867 E^(-(1/2) (-20.9 + x)^2), 0.383496 E^(-(1/2) (-22.3 + x)^2)};

dist = ProbabilityDistribution[
        Plus @@ distSum, {x, -Infinity, Infinity}, Method -> "Normalize"];

mean = NExpectation[x, x \[Distributed] dist]

$\ $ 21.6074

variance = Expectation[(x - mean)^2, x \[Distributed] dist] // Chop

$\ $ 1.94362

Plot[PDF[dist, x], {x, 12, 30}, PlotRange -> All]

Out

RandomVariate[dist, 10]

$\ $ {20.7231, 21.2831, 20.6987, 22.486, 22.7043, 25.5388, 21.5406, 21.9175, 20.5078, 21.9182}

2 deleted 32 characters in body
source | link

Here is how you can apply the same principles used in this answer to your problem:

distSum = {0.167467 E^(-(1/2) (-21.5 + x)^2), 
   0.160772 E^(-(1/2) (-19.7 + x)^2), 
   0.233762 E^(-(1/2) (-21.7 + x)^2), 
   0.0930353 E^(-(1/2) (-21.9 + x)^2), 
   0.373293 E^(-(1/2) (-22.4 + x)^2), 
   0.126876 E^(-(1/2) (-19. + x)^2), 
   0.348056 E^(-(1/2) (-22.7 + x)^2), 
   0.393082 E^(-(1/2) (-21.4 + x)^2), 
   0.35867 E^(-(1/2) (-20.9 + x)^2), 
   0.383496 E^(-(1/2) (-22.3 + x)^2)};

dist = ProbabilityDistribution[
        Plus @@ distSum, {x, -Infinity, Infinity}, Method -> "Normalize"];

mean = NExpectation[x, x \[Distributed] dist]

21.6074

$\ $ 21.6074

variance = Expectation[(x - mean)^2, x \[Distributed] dist] // Chop

1.94362

$\ $ 1.94362

Plot[PDF[dist, x], {x, 12, 30}, PlotRange -> All]

Out

Out

RandomVariate[dist, 10]

{20.7231, 21.2831, 20.6987, 22.486, 22.7043, 25.5388, 21.5406, 21.9175, 20.5078, 21.9182}

$\ $ {20.7231, 21.2831, 20.6987, 22.486, 22.7043, 25.5388, 21.5406, 21.9175, 20.5078, 21.9182}

Here is how you can apply the same principles used in this answer to your problem:

distSum = {0.167467 E^(-(1/2) (-21.5 + x)^2), 
   0.160772 E^(-(1/2) (-19.7 + x)^2), 
   0.233762 E^(-(1/2) (-21.7 + x)^2), 
   0.0930353 E^(-(1/2) (-21.9 + x)^2), 
   0.373293 E^(-(1/2) (-22.4 + x)^2), 
   0.126876 E^(-(1/2) (-19. + x)^2), 
   0.348056 E^(-(1/2) (-22.7 + x)^2), 
   0.393082 E^(-(1/2) (-21.4 + x)^2), 
   0.35867 E^(-(1/2) (-20.9 + x)^2), 
   0.383496 E^(-(1/2) (-22.3 + x)^2)};

dist = ProbabilityDistribution[
   Plus @@ distSum, {x, -Infinity, Infinity}, Method -> "Normalize"];

mean = NExpectation[x, x \[Distributed] dist]

21.6074

variance = Expectation[(x - mean)^2, x \[Distributed] dist] // Chop

1.94362

Plot[PDF[dist, x], {x, 12, 30}, PlotRange -> All]

Out

RandomVariate[dist, 10]

{20.7231, 21.2831, 20.6987, 22.486, 22.7043, 25.5388, 21.5406, 21.9175, 20.5078, 21.9182}

Here is how you can apply the same principles used in this answer to your problem:

distSum = {0.167467 E^(-(1/2) (-21.5 + x)^2), 0.160772 E^(-(1/2) (-19.7 + x)^2), 
   0.233762 E^(-(1/2) (-21.7 + x)^2), 0.0930353 E^(-(1/2) (-21.9 + x)^2), 
   0.373293 E^(-(1/2) (-22.4 + x)^2), 0.126876 E^(-(1/2) (-19. + x)^2), 
   0.348056 E^(-(1/2) (-22.7 + x)^2), 0.393082 E^(-(1/2) (-21.4 + x)^2), 
   0.35867 E^(-(1/2) (-20.9 + x)^2), 0.383496 E^(-(1/2) (-22.3 + x)^2)};

dist = ProbabilityDistribution[
        Plus @@ distSum, {x, -Infinity, Infinity}, Method -> "Normalize"];

mean = NExpectation[x, x \[Distributed] dist]

$\ $ 21.6074

variance = Expectation[(x - mean)^2, x \[Distributed] dist] // Chop

$\ $ 1.94362

Plot[PDF[dist, x], {x, 12, 30}, PlotRange -> All]

Out

RandomVariate[dist, 10]

$\ $ {20.7231, 21.2831, 20.6987, 22.486, 22.7043, 25.5388, 21.5406, 21.9175, 20.5078, 21.9182}

1
source | link

Here is how you can apply the same principles used in this answer to your problem:

distSum = {0.167467 E^(-(1/2) (-21.5 + x)^2), 
   0.160772 E^(-(1/2) (-19.7 + x)^2), 
   0.233762 E^(-(1/2) (-21.7 + x)^2), 
   0.0930353 E^(-(1/2) (-21.9 + x)^2), 
   0.373293 E^(-(1/2) (-22.4 + x)^2), 
   0.126876 E^(-(1/2) (-19. + x)^2), 
   0.348056 E^(-(1/2) (-22.7 + x)^2), 
   0.393082 E^(-(1/2) (-21.4 + x)^2), 
   0.35867 E^(-(1/2) (-20.9 + x)^2), 
   0.383496 E^(-(1/2) (-22.3 + x)^2)};

dist = ProbabilityDistribution[
   Plus @@ distSum, {x, -Infinity, Infinity}, Method -> "Normalize"];

mean = NExpectation[x, x \[Distributed] dist]

21.6074

variance = Expectation[(x - mean)^2, x \[Distributed] dist] // Chop

1.94362

Plot[PDF[dist, x], {x, 12, 30}, PlotRange -> All]

Out

RandomVariate[dist, 10]

{20.7231, 21.2831, 20.6987, 22.486, 22.7043, 25.5388, 21.5406, 21.9175, 20.5078, 21.9182}