       Re: delayed function assignment

• To: mathgroup at smc.vnet.net
• Subject: [mg88187] Re: delayed function assignment
• From: Szabolcs Horvát <szhorvat at gmail.com>
• Date: Sun, 27 Apr 2008 07:00:55 -0400 (EDT)
• Organization: University of Bergen
• References: <fv1fec\$eru\$1@smc.vnet.net>

```leigh wrote:
> Dear Mathgroup,
>
> I am trying to integrate the pdf of a chi-square mixture distribution.
> If I define the pdf as
>
> pdf2 := .25
> \!\(pdf2[x] :=  .5*\(\(1/2\^\(1/
>         2\)\)\/Gamma[1/2]\) \(x\^\(1/2 - 1\)\) \[ExponentialE]\^\(\(-x
> \)/
>               2\) +  .25*\(1\/\(2*Gamma\)\) \[ExponentialE]\^\(\(-x
> \)/2\)\)
>
> I can then obtaing the cumulative distribution function symbolically
> as
>
> In:=\!\(\$B"i(Bpdf2[x] \[DifferentialD]x\)
>
> Out=\!\(\(-0.25`\)\ 2.718281828459045`\^\(\(-0.5`\)\ x\) + 0.5`\ \
> Erf[0.7071067811865476`\ \@x]\)
>
> I can get numerical values using for example
>
> In:=\!\(1 -  .25 - \$B"i(B\_0\%12 pdf2[x] \[DifferentialD]x\)
>
> Out=0.000885691
>
> However if I try to define this as a function of the statistic
> obtained, say
>
> \!\(cum2[x] := 1 -  .25 - \$B"i(B\_0\%x pdf2[t] \[DifferentialD]t\)
>
> Then
>
> In:=cum2
>
> Out=cum2
>
> Doesn't evaluate. What should I do to obtain the value as output.

patterns:

http://reference.wolfram.com/mathematica/tutorial/DefiningFunctions.html
http://reference.wolfram.com/mathematica/tutorial/Introduction-Patterns.html

The proper function definition in your application has the form

f[x_] := x

and not

f[x] := x

(The latter has a different meaning.)

```

• Prev by Date: Re: Base function
• Next by Date: Re: delayed function assignment
• Previous by thread: Re: delayed function assignment
• Next by thread: Re: delayed function assignment