5
$\begingroup$

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

semicircle wave

Can anybody help - Thank you!

  • 0
    And I'm assuming you don't want the closed form in terms of a piecewise definition.2011-06-09
  • 0
    Have you tried to use the Fourier transform? Or would you object to the resulting infinite sums?2011-06-09
  • 0
    @jspecter: No, please no piecewise def. @Theo: Infinite sums are ok, I think even necessary for the nearly perpendicular inflection points (=infinite slope).2011-06-09
  • 0
    Almost: $\sqrt{1 - \bigg(\frac{2}{\pi}\sin^{-1}\Big(\cos\big(\frac{\pi}{2}x\big)\Big)\bigg)^2}$, [WolframAlpha plot](http://www.wolframalpha.com/input/?i=sqrt%281+-+%282%2Fpi+asin%28cos%28pi%2F2+x%29%29%29%C2%B2%29)2011-06-09
  • 0
    I now remember that I stumbled upon this phenomenon when you iterate trig funcs: http://www.wolframalpha.com/input/?i=plot+sin%28sin%28sin%28sin%28sin%28sin%28sin%28sin%28x%29%29%29%29%29%29%29%29 - perhaps this helps and can be combined with some of the other ideas here?!?2011-06-09
  • 1
    Just curious: Why do you want to avoid a piecewise definition?2011-08-07
  • 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
    @Zev: I don't know how to fix this, but I think it goes into the right direction. Floor func is ok.2011-06-09
  • 0
    WA-plot: http://www.wolframalpha.com/input/?i=Plot+%28-1%29^%28Floor%5B%28x%2F2+%2B+0.5%29%5D%29+Sqrt%5B1+-+%28x+-+2+Floor%5Bx%2F2+%2B+0.5%5D%29^2%5D - How did you find it?2011-06-09
  • 0
    @vonjd: I figured we needed a $(-1)^{\text{something}}$ to get the flipping about the $x$-axis, figured out what the something was based on the period we needed, and then used the subtracting-the-floor-function trick to shift each segment $[r(2n-1),r(2n+1)]$ of the $x$-axis down to the $[-r,r]$ segment, then used the formula for the (upper half of a) circle on the segment $[-r,r]$.2011-06-09
  • 0
    (in general, $a\lfloor\frac{b}{a}\rfloor$ is the largest multiple of $a$ less than $b$, so subtracting it from $b$ gives the "remainder")2011-06-09
  • 0
    Zev: If you use four blank spaces as indentation instead of the `>` then you get a `code` block, which makes your code a bit easier to read because a monospace font is used. (you need to do the line breaks manually to avoid a scroll bar)2011-06-09
  • 0
    @Theo: Good suggestion, thanks!2011-06-09
  • 0
    @ZevChonoles +1. Good function for moving spacecrafts in computer games.2014-09-20