Hi!

I want to claculate a triple integral of a piecewise function. The piecewise function has 17 domains and I guess that this is a bit too much.

Is there any possibility to optimize it?

the piecewisefunction looks like this:

a := unapply(piecewise(

x1 < 0 or x2 < 0 or x3 < 0 or h < x1 or h < x2 or h < x3, 0,

0.5*h <= x1 and x1 <= h and h-x1 <= x2 and x2 <= x1 and h-x1 <= x3 and x3 <= x1, A1[13],

0 <= x1 and x1 <= .5*h and .5 <= x2 and x2 <= h-x1 and h-x2 <= x3 and x3 <= x2, A1[2],

0 <= x1 and x1 <= .5*h and x1 <= x3 and x3 <= .5*h and x3 <= x2 and x2 <= h-x3, A1[1],

0 <= x1 and x1 <= .5*h and x1 <= x2 and x2 <= h*.5 and x2 <= x3 and x3 <= h-x2, A1[4],

0 <= x1 and x1 <= .5*h and .5*h <= x3 and x3 <= h-x1 and h-x3 <= x2 and x2 <= x3, A1[3],

0.5*h <= x2 and x2 <= h and h-x2 <= x3 and x3 <= x2 and h-x2 <= x1 and x1 <= x2, A1[17],

0 <= x2 and x2 <= .5*h and .5 <= x1 and x1 <= h-x2 and h-x1 <= x3 and x3 <= x1, A1[6],

0 <= x2 and x2 <= .5*h and x2 <= x3 and x3 <= .5*h and x3 <= x1 and x1 <= h-x3, A1[7],

0 <= x2 and x2 <= .5*h and x2 <= x1 and x1 <= h*.5 and x1 <= x3 and x3 <= h-x1, A1[8],

0 <= x2 and x2 <= .5*h and .5*h <= x3 and x3 <= h-x2 and h-x3 <= x1 and x1 <= x3, A1[5],

0.5*h <= x3 and x3 <= h and h-x3 <= x1 and x1 <= x3 and h-x3 <= x2 and x2 <= x3, A1[21],

0 <= x3 and x3 <= .5*h and .5 <= x1 and x1 <= h-x3 and h-x1 <= x2 and x2 <= x1, A1[10],

0 <= x3 and x3 <= .5*h and x3 <= x2 and x2 <= .5*h and x2 <= x1 and x1 <= h-x2, A1[9],

0 <= x3 and x3 <= .5*h and x3 <= x1 and x1 <= h*.5 and x1 <= x2 and x2 <= h-x1, A1[12],

0 <= x3 and x3 <= .5*h and .5*h <= x2 and x2 <= h-x3 and h-x2 <= x1 and x1 <= x2, A1[11]),x1,x2,x3);

Thanky you for comments!