# Using Piecewise to plot a defined function [closed]

I'm trying to Plot this function:

Between the interval -0.2 < t < 0.1 but it doesn't work. All i get is a blank graph between my intervals. If you could help me out I'd greatly appreciate it.

This is my code:

Plot[Piecewise[{{Sqrt[t]*Sin[t^(-1)], x > 0}, {t*Sin[t^(-1)]}}], {t, -0.2, 0.1}]


## closed as off-topic by xzczd, Bob Hanlon, m_goldberg, Henrik Schumacher, Lukas LangNov 4 '18 at 12:18

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – xzczd, Bob Hanlon, m_goldberg, Henrik Schumacher, Lukas Lang
If this question can be reworded to fit the rules in the help center, please edit the question.

• 1. The x should be t. 2. Syntax of Piecewise is wrong, please check the document of Piecewise for more information. The correct one should be Plot[Piecewise[{{Sqrt[t] Sin[1/t], t > 0}}, t Sin[1/t]], {t, -0.2, 0.1}] – xzczd Nov 3 '18 at 15:41
• Oh my god. I've been spending way to much in front of the computer today it seems. I don't know what I was thinking when I put x instead of t. – wznd Nov 3 '18 at 15:46
• No problem. These things happen to all of us. Anyways, since this is settled, I vote to close this post as "simple mistake". – Henrik Schumacher Nov 3 '18 at 20:56

Since the function is only defined at t == 0 in the limit and the Limit is 0, you want to specify both conditions in the Piecewise and let its default cover the limiting case.

Limit[Sqrt[t]*Sin[t^(-1)], t -> 0] == Limit[t*Sin[t^(-1)], t -> 0] == 0

(* True *)

Manipulate[
Plot[
Piecewise[{
{Sqrt[t]*Sin[t^(-1)], t > 0},
{t*Sin[t^(-1)], t < 0}}],
{t, xmin, xmax},
Frame -> True,
FrameTicks -> All,
WorkingPrecision -> 20,
PlotPoints -> 200,
MaxRecursion -> 10,
PlotStyle -> AbsoluteThickness[0.5]],
{{xmin, -0.2}, -0.2, -0.02, 0.02, Appearance -> "Labeled"},
{{xmax, 0.1}, 0.02, 0.1, 0.01, Appearance -> "Labeled"},
SynchronousUpdating -> False]