Question: How to extract from an expression the terms of a given form


I have  an expression made of a sum of different terms from which I want to extract all terms of a specific form.

A typical expression and the functions I want to extract is given in the attached file.

You will see in the example that the terms in the expression can be 

  • a constant
  • a continuous function of t
  • a piecewise function like
    something*piecewise(a(t) < 0, A(t), a(t) < 1, B(t), ...)
  • a piecewise function like
    something*piecewise(t < 0, A(t), t < 1, B(t), ...)


The functions I want to extract are only those of this latter form .

Thanks in advance

PS: all the situations I have to manage contain expressions of the form of the prototype expression given in the attached file.
       Nothing more general than this.

Please Wait...