Given a piecewise function f[t_]:=Piecewise[{{Exp[-1/t^2],t>0},{0,x<=0}}], I can define another function like this: g[t_]:=f[t+1]f[1-t]. Both the functions can be calculated and plotted. But when I define the third function h[t_]:=Integrate[g[x],{x,-:inf:,t}], h[t] cannot be used to plot. Does the definition for h[t] have anything wrong?

  • 1
    $\begingroup$ Please be more specific about what you mean by "cannot be used". Also: did you mean to write x <= 0 or t <= 0 in f? $\endgroup$
    – Szabolcs
    Commented Jan 29, 2015 at 3:46
  • $\begingroup$ Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Read the faq! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! $\endgroup$ Commented Jan 29, 2015 at 5:13
  • $\begingroup$ Recommend that the definition of g be modified to g[t_] = f[t + 1] f[1 - t] // PiecewiseExpand // Simplify $\endgroup$
    – Bob Hanlon
    Commented Jan 29, 2015 at 5:15
  • $\begingroup$ Thanks, I have revised the question. $\endgroup$ Commented Jan 29, 2015 at 7:08

1 Answer 1


You have an error in the definition of f[] and it's faster to use NIntegrate[]:

f[t_] := Piecewise[{{Exp[-1/t^2], t > 0}, {0, t <= 0}}]
g[t_] := f[t + 1] f[1 - t]
h[t_] := NIntegrate[g[x], {x, -Infinity, t}]
Plot[h[t], {t, -1, 1}]

Mathematica graphics


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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