Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2001
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2001

[Date Index] [Thread Index] [Author Index]

Search the Archive

RE: Triangular Probability Distributions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg30020] RE: [mg30009] Triangular Probability Distributions
  • From: "tgarza01 at prodigy.net.mx" <tgarza01 at prodigy.net.mx>
  • Date: Sat, 21 Jul 2001 16:16:45 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Hello Michael,

I'm not clear as to what you mean by "methodology". Still, what you may do is define the triangular probability density function and work from it. For example, if you want your density defined in the interval [a, b],

In[1]:=
Clear[triPdf,triCdf]
In[2]:=
triPdf[x_,a_,b_]:=((1+a)/(b^2-a^2))*4*(x-a)/;a<=x<=(b+a)/2;
triPdf[x_,a_,b_]:=((1+a)/(b^2-a^2))*4*(b-x)/;(b+a)/2<x<=b;
triPdf[x_,a_,b_]:=0/;a>x||x<b;

In[3]:=
Plot[triPdf[x,0,1],{x,0,1}];

Here you obtained the graph of the triangular density in [0,1]. The distribution function is then defined as 

In[4]:=
triCdf[x_,a_,b_]:=Integrate[triPdf[y,a,b],{y,a,x}]

which you plot with (it takes a little while, due to the fact that the numerical integration is slow because of the peak at x = 0.5; you may integrate one part after the other and then it runs very quickly):

 In[5]:=
Off[NIntegrate::"ncvb"];Off[NIntegrate::"slwcon"];
In[6]:=
Plot[triCdf[x,0,1],{x,0,1}];

I turned off the messages to avoid looking at them. The k-th moment is

Integrate[x^k*triPdf[x,a,b],{x,a,b}]

for any k.

Tomas Garza

Original Message:
-----------------
From:  loopm at yahoo.com (Michael Loop)
To: mathgroup at smc.vnet.net
Subject: [mg30020] [mg30009] Triangular Probability Distributions


I have been looking for a methodology for using the triangular
probability distribution in Mathematica.  I have not found anything
that allows me to do this.  Has anyone found a way to use the
triangular distribution?  Are there any add-on packages that would
include this distribution?

Thank you,
Michael Loop
Minneapolis MN

--------------------------------------------------------------------
Mail2Web - Check your email from the web at
http://www.mail2web.com/ .



  • Prev by Date: Re: Folds
  • Next by Date: Re: Re: slow integration
  • Previous by thread: Triangular Probability Distributions
  • Next by thread: Delay in $Context changes taking effect?