2
$\begingroup$

I want to integrate one piecewise functions as following,

Assuming[ {t1 ∈ Reals && t1 > 0, t ∈ Reals && t > 0}, 
 Integrate[
  Piecewise[{{1,    x > 0    && x < t1}, 
            {-1,    x > t1   && x < 2*t1}, 
            {1,     x > 2*t1 && x < 3*t1},
            {1 - 1, x > 3*t1 && x < 4*t1},
            {0, True}}, x], {x, 0, t}]]

I have assumed t1>0 and why the output is as the picture shownenter image description here?

$\endgroup$
  • $\begingroup$ By the way...doesn't t1>0 imply t1 ∈ Reals? $\endgroup$ – mikuszefski Dec 9 '14 at 9:29
  • $\begingroup$ You can simplify the output by feeding it to FullSimplify. $\endgroup$ – Stephen Luttrell Dec 9 '14 at 10:11
  • $\begingroup$ Should the fourth piece of your piecewise function not be -1 instead of 1-1? $\endgroup$ – TransferOrbit Dec 9 '14 at 10:30
  • $\begingroup$ • Are you expecting an analytical (symbolic) answer or numerical? If numerical, you'll need to specify a numerical t1. • Did you intend to have the function undefined at the boundaries of each piece (ie. x < t1 instead of x <= t1)? $\endgroup$ – TransferOrbit Dec 9 '14 at 10:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.