Re: Re: Double integral of a piecewise-constant function

*To*: mathgroup at smc.vnet.net*Subject*: [mg61546] Re: [mg61515] Re: Double integral of a piecewise-constant function*From*: Bob Hanlon <hanlonr at cox.net>*Date*: Sat, 22 Oct 2005 00:35:33 -0400 (EDT)*Reply-to*: hanlonr at cox.net*Sender*: owner-wri-mathgroup at wolfram.com

You can state the assumption upfront. Assuming[{Element[t[1], Reals]}, Integrate[Integrate[testfunc, {t[2], 0, t[1]}], {t[1], 0, 3}]] Bob Hanlon > > From: Chris Rodgers <rodgers at physchem.NOSPAMox.aREMOVEc.uk> To: mathgroup at smc.vnet.net > Date: 2005/10/21 Fri AM 12:38:00 EDT > Subject: [mg61546] [mg61515] Re: Double integral of a piecewise-constant function > > OK. Here is a simpler example where I try to integrate a > piecewise-constant function in two dimensions. > > I define a very simple function ("testfunc") with constant values in 1x1 > squares over the domain t[1] = 0 to 3 and t[2] = 0 to 3 with value zero > elsewhere. > > I then proceed to integrate a triangular region of this surface, whose > integral should be 1+2+3=6. I tried three different approaches: > > 1) Integrate[Integrate[testfunc, {t[2], 0, t[1]}], {t[1], 0, 3}] > > 2) Integrate[testfunc, {t[1], 0, 3}, {t[2], 0, t[1]}] > > 3) Integrate[ > Integrate[testfunc, {t[2], 0, t[1]}, > Assumptions -> t[1] \[Element] Reals], {t[1], 0, 3}] > > In (2) and (3), Mathematica succeeds, but in case (1) it doesn't. > > Why does Mathematica not understand that the dummy variable t[1] is Real > in case (1)? > > Although this example is trivial, in the work that I am trying to do, it > will be much more difficult to collect all the integrals together into a > single term. Is there any way to make the inner Integrate(s) realise > that t[1] is Real automatically? Can this be scaled up to the case where > I have more than two Integrate's within one-another? > > Yours, > > Chris Rodgers. > > P.S. A workbook containing these formulae and a plot of "testfunc" is > available at > > http://physchem.ox.ac.uk/~rodgers/MMA/Problem1.nb > > and a PDF showing the output is available at > > http://physchem.ox.ac.uk/~rodgers/MMA/Problem1.pdf > >