MathGroup Archive 2008

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

Search the Archive

Re: compelling evaluation

  • To: mathgroup at smc.vnet.net
  • Subject: [mg93213] Re: [mg93175] compelling evaluation
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Fri, 31 Oct 2008 03:06:45 -0500 (EST)
  • Reply-to: hanlonr at cox.net

When you post you should use actual Mathematica notation,

project = UniformDistribution[{0, 1}];

f[y_] = PDF[project, y]/
  (CDF[project, 1] - CDF[project, 0])

Piecewise[{{1, 0 <= y <= 1}}]

The definition of f can be written more simply as

f[y_] = PDF[project, y]

Piecewise[{{1, 0 <= y <= 1}}]

F[y_] = Assuming[{0 <= y <= 1}, Integrate[f[z], {z, 0, y}]]

Piecewise[{{y, Inequality[0, Less, 
         y, LessEqual, 1]}}]

pi0[y_] = F[y]

Piecewise[{{y, Inequality[0, Less, 
         y, LessEqual, 1]}}]

This definition obviously doesn't do anything.

pi1[y_] = Assuming[{0 <= y <= 1},
   Integrate[ (1 - q) f[q], {q, y, 1}]] //
  Simplify

Piecewise[{{(1/2)*(y - 1)^2, 
       Inequality[0, LessEqual, y, 
         Less, 1]}}]

pi2[y_] = Assuming[{0 <= y <= 1},
  Integrate[ q f[q], {q, y, 1}]]

Piecewise[{{(1/2)*(1 - y^2), 
       Inequality[0, LessEqual, y, 
         Less, 1]}}]

T[y_] = Assuming[{0 <= y <= 1},
   Integrate[ (q - y) f[q], {q, y, 1}]] //
  Simplify

Piecewise[{{(1/2)*(y - 1)^2, 
       Inequality[0, LessEqual, y, 
         Less, 1]}}]

D[T[y], y]

Piecewise[{{0, y < 0}, 
     {y - 1, 0 < y < 1}, 
     {0, y == 1 || y > 1}}, 
   Indeterminate]

T[pistar]

Piecewise[{{(1/2)*(pistar - 1)^2, 
       Inequality[0, LessEqual, 
         pistar, Less, 1]}}]


Bob Hanlon

---- 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


--

Bob Hanlon



  • Prev by Date: Re: compelling evaluation
  • Next by Date: Re: Stopping a program
  • Previous by thread: Re: compelling evaluation
  • Next by thread: Re: compelling evaluation