1
$\begingroup$

If I define a piecewise function

f[t_] := Piecewise[{{t^2, t < 0}, {Sin[t], t > 0}}]
Which[f[t], t > 0]

how do I display only one part of the function? e.g. I want to know what f is when t>0, how do I get Mathematica to output Sin[t]?

(This is a MWE. My actual piecewise function contains thousands of terms when t<0, and I only want to study the function at t>0.)

Edit: Thanks for the responses. I should add that the piecewise function is the solution to a Convolve operation. So I'm not sure if the piecewise function is a "Mathematica function" in the strict sense.

$\endgroup$
  • $\begingroup$ What else could it be if it's not a "Mathematica function in the strict sense"? $\endgroup$ – Roman Jun 7 at 12:04
  • $\begingroup$ I don't know, I'm a Mathematica newbie. What I mean is, it's a function that isn't expressed as f[t_] :=. Instead it's f = . Does this make sense? $\endgroup$ – Medulla Oblongata Jun 7 at 12:22
  • $\begingroup$ No, it doesn't make sense. Please read a tutorial on immediate and delayed definitions. Both are functions. $\endgroup$ – Roman Jun 7 at 13:11
3
$\begingroup$
PiecewiseExpand[f[t], t > 0]
(*    Sin[t]    *)
$\endgroup$
3
$\begingroup$

Simplify gives the desired result:

Simplify[f[t], t > 0]

Sin[t]

$\endgroup$

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.