I am trying to integrate a hat function for a project that I am doing and have found a method to do so but I find it sloppy. Currently I have the basis function
\[Psi][z_] := z - Subscript[Z, i]/ \[CapitalDelta]z + 1;
which I am trying to integrate from $z_{i-1}$ to $z_{i+1}$. I break the basis function up into two pieces and integrate the left side from $z_{i-1}$ to $z_{i}$ and then the right side from $z_i$ to $z_{i+1}$. My first question is, is there a way to integrate piecewise functions? The second question I have is, is there a way to set global assumptions like $z_{i-1} < z_i < z_{i+1}$, $z_i - z_{i-1} = \Delta z$ , etc?
Edit: This is the piece wise function taken directly from my code I am trying to integrate
\[Psi][z_, c_] := Piecewise[{{(z - c)/\[CapitalDelta]z + 1,
z <= c}, {-(z - c)/\[CapitalDelta]z + 1, z > c}}];
where $c$ is the center of the hat function. Here is my attempt to integrate the piece wise function
FullSimplify[
Integrate[\[Psi][z, Subscript[Z, i]], {z, Subscript[Z, i - 1],
Subscript[Z, i + 1]}],
Assumptions -> {-(Subscript[Z, i + 1] - Subscript[Z,
i ]) == -\[CapitalDelta]z,
Subscript[Z, i + 1] - Subscript[Z,
i ] == \[CapitalDelta]z, -(Subscript[Z, i] - Subscript[Z,
i - 1 ]) == -\[CapitalDelta]z,
Subscript[Z, i] - Subscript[Z, i - 1 ] == \[CapitalDelta]z}]
I do not get a usable answer. Am I doing something wrong (ie can one integrate a piece wise function)?
Piecewise
? Did you know thatIntegrate
can take symbolic values (such asSubscript[z,i-1]
) in its integration limits? $\endgroup$