5
$\begingroup$

I am looking for a closed-form formula for something like this:

semicircle wave

Can anybody help - Thank you!

  • 0
    A [related question](http://math.stackexchange.com/questions/35599). P.S. I edited a bit so that the keyword "semicircle" turns up; this question cannot be seen when the search term "semicircle" is used. I left the linked question to use "half-circles" instead.2011-08-07

1 Answers 1

7

This works (for circles of radius $r$):

$f(x)=(-1)^{\displaystyle\left\lfloor \frac{x}{2r}+\frac{1}{2}\right\rfloor}\sqrt{r^2-\left(x-2r\left\lfloor\frac{x}{2r}+\frac{1}{2}\right\rfloor\right)^2}$

Image for $r=1$:

enter image description here

Mathematica code:

r = 1; Plot[(-1)^Floor[x/(2r) + 0.5] Sqrt[r^2 - (x - (2r)Floor[x/(2r) + 0.5])^2], {x, -3, 3}, AspectRatio -> 1/3] 
  • 0
    @ZevChonoles +1. Good function for moving spacecrafts in computer games.2014-09-20