I am looking for a closed-form formula for something like this:
Can anybody help - Thank you!
I am looking for a closed-form formula for something like this:
Can anybody help - Thank you!
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$:
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]