# Question:How to handle piecewise defined matrix valued functions

## Question:How to handle piecewise defined matrix valued functions

Maple

Hi,

I have some matrix valued functions that that I can only define piecewise. Unfortunately I have some problems to manipulate those functions. Piecewise sees to do the job for  scalar valued functions. There I can easily differentiale and add results. For Matrix valued functions however, those features seem to not be availible.

I can work around these limitations by manually applying all operations to the operands of the piecewise function. Like I show here:

 > restart:
 > # a piecewise function
 > p1:=piecewise(a(t)^2=0,,<1,1/a(t)>)
 (1)
 > # differentiation does not work
 > diff(p1,t)
 (2)
 > # selecting individual entries does not work
 > r:=p1(1)+1
 (3)
 > # strange simplification behaviour
 > simplify(p1)
 (4)
 > # current workaround, define new piecewise function by using op
 > r:=piecewise(op(1,p1),op(2,p1)(1)+1,op(3,p1)(1)+1)
 (5)
 >