Re: compelling evaluation
- To: mathgroup at smc.vnet.net
- Subject: [mg93205] Re: [mg93175] compelling evaluation
- From: Daniel Lichtblau <danl at wolfram.com>
- Date: Fri, 31 Oct 2008 03:05:17 -0500 (EST)
- References: <200810300701.CAA00563@smc.vnet.net>
randolph.silvers at deakin.edu.au wrote:
> I have created a function from a PDF and so it is non-zero on the unit
> interval and 0 elsewhere. But when I try to integrate some function of
> that function, it is not evaluated. How can I get it to be evaluated?
>
> For example,
>
> project=UniformDistribution[{0,1}];
> f[y_]:=PDF[project,y]/(CDF[project,1] - CDF[project,0]);
> F[y_]:=Integral_0^y f[z]dz;
>
> Now, I define
>
> pi0[y_]:= F[y]
> pi1[y_]:= Integral_y^1 (1-q) f[q] dq
> pi2[y_]:= Integral_y^1 q f[q] dq
> T[y_]:= Integral_y^1 (q-y) f[q] dq
>
> When I enter a numerical value, each is correctly computed; when I
> differentiate, it also looks correct. For example,
>
> D[T[y],y] returns
>
> Integral_y^1 -{1 0<=q<=1 dq
>
> and, T[pistar] returns
>
> Integral_pistar^1 (-pistar + q)({1 0 <=q <= 1) dq
>
> How can I compel Mathematica to "know" or evaluate T[pistar] and
> return the symbolic expression assuming that q is in the relevant
> domain?
>
> Then, D[T[y],y] would return -(1-y) and T[pistar] would return:
>
> 1/2 - pistar + pistar^2/2
You appear to be using TeX notation in places where you probably want
Mathematica to be used instead.
I start with
project = UniformDistribution[{0,1}];
f[y_] := PDF[project,y]/(CDF[project,1] - CDF[project,0]);
T[y_] := Integrate[(q-y)*f[q], {q,y,1}]
Then one can use Assuming[...Refine[...]] to enforce the domain
restrictions.
In[9]:= InputForm[Assuming[0<y<1, Refine[D[T[y],y]]]]
Out[9]//InputForm= (-2 + 2*y)/2
In[12]:= InputForm[Assuming[0<pistar<1, Refine[T[pistar]]]]
Out[12]//InputForm= (1 - 2*pistar + pistar^2)/2
I will note that without the domain restrictions, you can still get
reasonable results expressed via Piecewise.
Daniel Lichtblau
Wolfram Research
- References:
- compelling evaluation
- From: randolph.silvers@deakin.edu.au
- compelling evaluation