Question: Integrating piecewise function

I want to integrate / differentiate the following piecewise function:

phi[i] := procproc (x) options operator, arrow; piecewise(x[i] <= x and x <= x[i-1], (x-x[i-1])/h[i], x[i] <= x and x <= x[i+1], (x[i+1]-x)/h[i+1]) end proc

 

where,

h[i] := x[i]-x[i-1]

h[i+1] := x[i+1]-x[i]

 

I get the following message for doing the following integration:

 

int(phi[i](x), x = x[i] .. x[i+1])

Error, (in collect/series) invalid expression for series

Appriciating any help

 

Please Wait...