Message Boards Message Boards

Integrate of 2D piecewise function with constants?


My question is about letting Mathematica automatically find the constants for the different pieces of a piecewise defined function. This works fine in case of 1D piecewise function, but not for a 2D function. At least I do not know what I'm doing wrong. Here is the integration of the 1D piecewise function that does work:

tent[x_] = Piecewise[{{x + 1, -1 <= x < 0}, {-x + 1, 0 <= x <= 1}}] 
itent[x_] = Integrate[tent[x], x] 

itent evaluates nicely to:

{0, x <= -1}, 
{1/2 + x + x^2/2, -1 < x <= 0}, 
{1/2 + x - x^2/2, 0 < x <= 1}}, 

However when I apply (single) vertical integration on a 2D function the constants are not found anymore:

tent2D[x_, y_] = tent[x]*tent[y]
HyNoConst[x_, y_] = Integrate[tent2D[x, y], y]

Have a look to the attache notebook file (Mathematica version 9). Here output of above HyNoConst is printed and plotted. It is clear that the pieces in the piecewise function are integrated as if they were separately integrated; without taking account for the integrated value of adjoining piecewise parts. Find at the bottom of the attached notebook the HyExpected, where I manually added the vertical integration constants, which I expect Mathematica to find automatically. Also a plot of HyExpected is shown which makes it clear why this is the expected outcome.

POSTED BY: Koen Meinds
3 months ago

Group Abstract Group Abstract