MathGroup Archive 2005

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

Search the Archive

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 

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?


Chris Rodgers.

P.S. A workbook containing these formulae and a plot of "testfunc" is 
available at

and a PDF showing the output is available at

  • Prev by Date: Re: Set construction with condition
  • Next by Date: Re: Re: Display sound but suppress graphics
  • Previous by thread: Re: Double integral of a piecewise-constant function
  • Next by thread: Re: Re: Double integral of a piecewise-constant function