Function that graphs repeating upper halves of circles I'm trying to write a periodic function that repeats the upper half of a unit circle, so it would look similar to $|\cos(x)|$ but with the upper half of a circle instead. If anyone could help me out it would be much appreciated.
 A: Try $y = \sqrt{1-\left(\operatorname{mod}\left(\left(x+1\right),2\right)-1\right)^2}$.

A: This does the trick:
$$y = \sqrt{1-\left(\frac{\arccos \left(\cos \left(\pi x\right)\right)}{\pi }\right)^2}$$

A: Old question, but I have a bit to add. I modified Tebbe's formula to allow specifying a radius where $-1 < r < 1$. I came some up with 4 equations that differ slightly depending on your needs.
1.
This formula has the origin at the tangent with disconnected semicircles.
$$y=\sqrt{r^{2}-\left(\operatorname{mod}\left(x-r-1\ ,2\right)-1\right)^{2}}$$
Tangent, disconnected formula
2.
This formula has the origin at the tangent with continuous semicircles.
$$y=\sqrt{r^{2}-\left(\operatorname{mod}\left(x-2r\ ,2r\right)-r\right)^{2}}$$
Tangent, continuous formula
3.
This formula has the origin at the center with disconnected semicircles.
$$y=\sqrt{r^{2}-\left(\operatorname{mod}\left(x-1,2\right)-1\right)^{2}}$$
Center, disconnected formula
4.
This formula has the origin at the center with continuous semicircles (probably what you want).
$$y=\sqrt{r^{2}-\left(\operatorname{mod}\left(x-r\ ,2r\right)-r\right)^{2}}$$
Center, continuous formula
Hope that helps somebody. Sure took me long enough to figure out myself.
