Re: wrong solution for double integral of piecewise function?
- To: mathgroup at smc.vnet.net
- Subject: [mg96993] Re: wrong solution for double integral of piecewise function?
- From: "Sjoerd C. de Vries" <sjoerd.c.devries at gmail.com>
- Date: Sun, 1 Mar 2009 04:56:45 -0500 (EST)
- References: <gob80u$g9q$1@smc.vnet.net>
Tom, Why didn't you look up UnitStep? One press on F1 (PC) and you're done. It shows you that the answers are the same if a<b. I guess you have made the same assumption in your calculation. Cheers -- Sjoerd On Feb 28, 1:43 pm, Tom Roche <tlro... at gmail.com> wrote: > wrong solution for double integral of piecewise function > > I've got a function > > f[\[Chi]_, \[Psi]_] = > {Piecewise[{{k, {a <= \[Chi] <= b, a <= \[Psi] <= b}}}, 0]} > > I'm attempting to solve for k such that f becomes a probability > density function by applying the normalization constraint, i.e. > solving for k such that the double (indefinite) integral of f equals > 1. I can do this by hand pretty easily, integrating first/inside WRT > psi and second/outside WRT chi, and I get > > (1) k = 1/((b-a)^2) > > I don't have the world's greatest calculus chops, but that looks > correct to me. (Am I missing something?) However, when I use > Mathematica to > > Solve[ > First[ > Integrate[ > Integrate[ > f[\[Chi], \[Psi]], {\[Psi], -\[Infinity], \[Infinity]} > ], > {\[Chi], -\[Infinity], \[Infinity]} > ] > ] == 1, k > ] > > I get > > (2) {{k -> -(1/((a - b)^2 (-1 + UnitStep[a - b])))}} > > which seems wrong to me, though I'll admit I don't know what > "UnitStep" means. So I'm wondering > > * does (1) = (2)? or > > * have I made a syntax error? or > > * is this just really hard to solve symbolically? If so, is there a > better way to setup this function and its solution?