       Re: Triangular Distribution in Mathematica

• To: mathgroup at smc.vnet.net
• Subject: [mg74243] Re: [mg74204] Triangular Distribution in Mathematica
• From: Darren Glosemeyer <darreng at wolfram.com>
• Date: Thu, 15 Mar 2007 05:03:58 -0500 (EST)
• References: <200703140850.DAA25031@smc.vnet.net>

```negedea at googlemail.com wrote:
> Dear all,
>
> Does any one know how to use triangular distribution in Mathematica?
> Does any one have an add-in? Or a formula that works? I want to get
> the PDF function, plot and the first four moments, mean, variance,
> skew, kurtosis. I have the following parameters for the distribution
> minimum value 270, maximum 415 and  likeliest or mode 392.
>
>
> Negede
>
>

Here is a definition for the triangular distribution pdf along with
computations for the mean, variance, skewness and kurtosis and the plot

In:= \$Post=InputForm;

Out//InputForm= Null

In:= trianglePDF[min_, max_, mode_, x_] :=
Piecewise[{{(2*(-min + x))/((max - min)*(-min + mode)),
min <= x <= mode}, {(2*(max - x))/((max - min)*(max -
mode)),
mode < x <= max}}]

Out//InputForm= Null

In:= mu = Integrate[x*trianglePDF[270, 415, 392, x], {x, 270, 415}]

Out//InputForm= 359

In:= var = Integrate[(x - mu)^2*trianglePDF[270, 415, 392, x], {x, 270,
415}]

Out//InputForm= 6073/6

In:= Integrate[(x - mu)^3*trianglePDF[270, 415, 392, x], {x, 270, 415}]/
var^(3/2)

Out//InputForm= (-493416*Sqrt[6/6073])/30365

In:= Integrate[(x - mu)^4*trianglePDF[270, 415, 392, x], {x, 270, 415}]/
var^2

Out//InputForm= 12/5

In:= Plot[trianglePDF[270, 415, 392, x], {x, 270, 415}]

Darren Glosemeyer
Wolfram Research

```

• Prev by Date: Re: Triangular Distribution in Mathematica
• Next by Date: Re: fastest way to add up a billion numbers
• Previous by thread: Triangular Distribution in Mathematica
• Next by thread: Re: Triangular Distribution in Mathematica