Plotting a part of curves (with possible solution as an attempt) I may mess up with this question!
I plotted them using http://www.desmos.com/calculator

How to plot only a part of some curves?

For example:
Plot of $y=x^2$:


But if i want to plot the curve from $x=1$ to $x=2$ which will look something like:

How to achieve it?


My attempt:
I can only do $[n,\infty)$, that is starting from $x=n$ but ending up in $\infty$. [first limitation]
Lets take a function say $f(x)=x$...
So suppose if i want to plot it from $x=3$...what i do is plot
$y=({\sqrt{x-3}})^2 + 3$
thus giving me :

But it also does not work on even degree equation like $y=x^2$ which gives: [second limitation]
($y=({\sqrt{x^2-3}})^2 + 3$ )

And also does not work with curves like $\sin{x}$ as using $y=({\sqrt{f(x)-n}})^2 + n$ (as i have been using) makes the values non-real if $n\geq 1$. [third limitation]

My 2nd attempt:

I plotted $y=x^2+0{\sqrt{x-1}}^2+0{\sqrt{3-x}}^2$ to get :


which is exactly what i want but i guess the method is a little crude.

Hence final method : $y=f(x)+0{\sqrt{x-a}}^2+0{\sqrt{b-x}}^2$ ... am i right?

 A: The method of restricting the domain depends on your particular software. Here are some examples. Let's graph $y=x^2$ for $0\le x\le 1$.
TI-84 Plus (or similar):
$$y1(x)=x^2/(x\ge 0)/(x\le 1)$$
TI-Nspire:
$$f1(x)=x^2\mid 0\le x\le 1$$
Geogebra:
$$f(x)=\operatorname{If}[0<=x<=1,x^2]$$
Standard math notation:
$$y=x^2\mid _{0\le x\le 1}$$
or
$$y=x^2,\quad\text{for $0\le x\le 1$}$$
Plotting by hand:
Just draw the parts you want and leave out the rest.
Tricky function definition:
$$y=x^2+0\cdot\left(\sqrt{x}+\sqrt{1-x}\right)$$
This method would work in any system that does not "optimize", which leaves out optimizing compilers for computer languages. You could call this a purely mathematical approach that also works in most technology. I just did a quick check on the TI-Nspire, Geogebra, and Desmos, and this works for all of them. A slight adaptation will make this work for a domain other than a closed interval.
These methods other than the last are all more standard, straightforward, understandable, and modifiable than the complicated formulas you are trying to use. Well, I suppose you could dispute the "standard" part, since I did them differently for different technologies.
A: Rory's suggestion is quite good, and it should work for Desmos. But apparently what you want is to stealthily include domain information; that's what it will boil down to, as we'll see.
To this end, you can cook up auxiliary "characteristic functions" that are $1$ at least on the domain you want, and $0$ certain places where you don't want to plot the function.
Thus, we'll let $$\ell_b(x) = \frac{1}{2(x - b)}\bigg(x - b - \lvert x - b\rvert\bigg) = \begin{cases}1, &x < b\\0, &x > b\end{cases}$$
so that $\ell_a(x)$ encodes whether $x \in (-\infty, a)$; that is, whether $x$ is to the $\ell$eft of $a$. Note that $\ell_a(a)$ is not defined (and I don't particularly care to find a way to make it either $1$ or $0$) at $x = b$.
Now, given any function $f(x)$, if you plot $\dfrac{f(x)}{\ell_b(x)}$, you'll get the graph of $f$ only for $x < b$.
You can do something analogous to define a characteristic function for the right-opening ray $(a, \infty)$, defining 
$$r_a(x) = \frac{1}{2(a - x)}\bigg(a - x - \lvert a - x \rvert\bigg) = \begin{cases}0, &x < a\\1, &x > a\end{cases},$$
again noting that $r_b(x)$ is not defined for $x = a$.
Now, if you want to plot the function $f(x)$ for $a < x < b$, this is exactly
$$\frac{f(x)}{2}\bigg(\frac{1}{\ell_b(x)}+\frac{1}{r_a(x)}\bigg),$$
provided $a < b$.
So, it's really just sneakily including domain information, but if it's what you want to do, you can. Things are trickier to define a function on a union of intervals like $(-\infty, a) \cup (b, \infty)$, so I'll let you think about that, if you want. The key is just to figure out a way to divide by $0$ outside of your desired domain, and divide by $1$ on the desired domain (while rescaling, if you need to use a sum).
A: Let $f$ be a function and $[a,b]$ be the domain in which you want to plot the function.
In most programming languages with type conversion between booleans and numbers you could define the desired function as f_restricted(x) = f(x)*(x >= a && x <= b),since (x >= a && x <= b) will be converted to 0 or 1 if it is evaluated to be true or false respectively.
