Take f[x] = { 2 x if x > 0 and -2 x if x <= 0 } .
Make a plot of f[x]. Discuss whether
f[x],
f[x], and
f[x] exist. Explain why or why not for each limit.
Clear[f]
f[x_]:= If[x > 0, 2x, -2x]
A Mathematica note---When we have a piecewise defined function, we use the If command to define it. In the statement:
f[x_]:= If[x > 0, 2x, -2x]
the first entry, x > 0, tells Mathematica to first decide if a given x-value is greater than 0. If x > 0, then we use the second entry in the If command to find f[x]. If x is not greater than 0 (i.e., x <= 0), then we use the third entry in the If command to define f[x]. Here is f[0.1]:
f[0.1]
And here is f[-0.1]:
f[-0.1]
Here is the plot of f[x]:
Plot[f[x],{x,-3,3}]
![[Graphics:LimitsBasicsgr2.gif]](LimitsBasicsgr2.gif)
![[Graphics:LimitsBasicsgr135.gif]](LimitsBasicsgr135.gif)
In this example it is clear that the limit from below is 0, as is the limit from above. Thus the limit from both sides is also 0.
We can write
f[x] =
f[x] =
f[x] = 0.