MathGroup Archive 2011

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

Search the Archive

Re: How to use PDF for function definition?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg121935] Re: How to use PDF for function definition?
  • From: Todd <johnson.todd.r at gmail.com>
  • Date: Fri, 7 Oct 2011 04:43:58 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <j6jok6$m5c$1@smc.vnet.net>

On Oct 6, 4:24 am, icegood <icegood1... at gmail.com> wrote:
You used a lowercase "l" in the function definition, but an uppercase
L in the function call: PDFLa. Changing this gives:

In[108]:= kla = 1.3; nla = 1;
Clear[z, PDFla];
PDFla[z_] := PDF[GammaDistribution[kla, nla/kla], z] ;
PDFla[3]

Out[111]= 0.0441056

But if you want the result to be a pure function you need to add & to
your function definition:

In[112]:= kla = 1.3; nla = 1;
Clear[z, PDFla];
PDFla[z_] := PDF[GammaDistribution[kla, nla/kla], z] &;
PDFla[3]

Out[115]= PDF[GammaDistribution[kla, nla/kla], 3] &

> Code:
> kla = 1.3; nla = 1;
> Clear[z, PDFla];
> PDFla[z_] := PDF[GammaDistribution[kla, nla/kla], z] ;
> PDFLa[3]
>
> Output:
> PDFLa[3]
>
> How to use it? By documentation i can also try simply PDFla :=
> PDF[GammaDistribution[kla, nla/kla]] that defines 'pure function', but
> result is the same. How to use it in right way.
>
> P.S. Where can i find a proper database for 'mathematica' bugs?




  • Prev by Date: Re: list equation
  • Next by Date: Re: How to use PDF for function definition?
  • Previous by thread: Re: How to use PDF for function definition?
  • Next by thread: A variable defaulting to a previous variable?