3
$\begingroup$

I have to program a software to get radius of a circle with arc and chord

Let's say arc = $9.27$ and chord = $8$, here is what I tried so far:

from the arc formula, I know that:

$$\pi r * \frac{\theta}{180} = 9.27$$

And base on the cosine law:

$$2r^2 - 2r^2\cos\theta = 8^2$$

Currently I'm stuck at how to get the value of r from this two equation, I'm not really sure how to deal with the $\cos()$ here

Or there's easier way to calculate the radius from arc length and chord length?

$\endgroup$
2
  • $\begingroup$ Try rearranging the second equation so that $\theta$ is the subject. Then you can plug it into the first equation. $\endgroup$
    – MathGeek
    Sep 3, 2021 at 14:17
  • $\begingroup$ Start with the last equation in @sea yellow's answer and look at my answer in math.stackexchange.com/questions/4235454/… $\endgroup$ Sep 3, 2021 at 14:25

3 Answers 3

3
$\begingroup$

If you have radius $r$ and angle $\theta$ in rad, then $A = r\theta$ and $C = 2r\sin(\theta/2)$. To get this independent of $r$ lets consider $$ C/A = \frac{2\sin(\theta/2)} \theta$$ This is a function that is falling montonously for $0\leq \theta \leq 2\pi$, so while we cannot invert this exactly we can easily invert this numerically, for example by simple bisection:

  1. Set $l = 0,u = 2\pi$
  2. Set $m = (l+u)/2$
  3. If $(2*sin(m/2))/m = C/A$ we’re done
  4. If $\ldots < C/A$ set $u=m$
  5. Else set $l=m$
  6. If $u-l<\epsilon$ for some $\epsilon$ return $m$, else jump to 2.

So now you know some (numerical) value for $\theta$. Use $A=r\theta$ to get $r$.

EXAMPLE: A=9.27, C=8. Then $C/A=0.86...$.

Set $l=0, u=2\pi,m=\pi$. Then $f(m)$ for $f(\theta)=2\sin(\theta/2)/\theta$ is about $0.64<C/A$. So we set $u=\pi$. So $m=\pi/2$, then $f(m)\approx 0.9>C/A$. So we set $l=\pi/2,m=3/4\pi$. Then $f(m)\approx0.74<C/A$, so we set $u=3/4\pi,m=5/8\pi$, $f(m)\approx0.85$.

We could continue this way to improve this value, but let’s go with $\theta = m = 5/8\pi$. Then $9.27\approx r\theta$, so $r\approx 9.27/(5/8\pi)\approx 4.72$.

So for checking the error we check: $$ 2r\sin(\theta/2)\approx 7.85 \approx C=8 $$

So we are somewhat off, mainly because we calculated $\theta$ only with a precision of $3/4\pi-1/2\pi = \pi/4$, which is kind of large. But you get the point.

EDIT: Of course, instead of bisection we might also use Newton: The derivative of $2\sin(\theta/2)/\theta$ is $\cos(\theta/2)/\theta - 2\sin(\theta/2)/\theta^2$.

So for $Y=C/A$ set $x_0 =\pi$, and set

$$ x_{n+1} = x_n - \frac{\frac{2\sin(x_n/2)}{x_n} - Y}{\frac{\cos(x_n/2)}{x_n} - \frac{2\sin(x_n/2)}{x_n^2}}$$ $$ = x_n - \frac{2x_n\sin(x_n/2) - Yx_n^2}{x_n\cos(x_n/2) - 2\sin(x_n/2)} $$

This should converge faster. Example with $Y=C/A\approx0.86$:

We have $x_0=\pi$. Then $x_1\approx 2.02$ according to the formula above. Then $x_2\approx 1.859$. Then $x_3\approx 1.85266$. With using this for $\theta$ we get $r\approx 5.004$ in only three iterations. With two additional iterations the error is smaller than the precision of a double float.

$\endgroup$
6
  • $\begingroup$ If we use $\epsilon=0.001$ we get a precision of $\pi/4096$ with $\theta\approx 2415/4096\pi\approx 1.85$ and thus $r\approx 5$. Then we get $C\approx 2\cdot 5\sin(1.85/2) \approx 7.986$ or with the unrounded values we get $C\approx 8.0005$, which is not that much off. $\endgroup$
    – Lazy
    Sep 3, 2021 at 14:35
  • $\begingroup$ Where does B come from in step 3? $\endgroup$
    – jiale ko
    Sep 3, 2021 at 19:30
  • $\begingroup$ @jialeko Sorry, that should have been a $C$. That comes from writing $A$ for arc and $C$ for chord, and then just continuing using $A$ and $B$ instead. $\endgroup$
    – Lazy
    Sep 3, 2021 at 21:07
  • $\begingroup$ Tested in program, looks like if $m=l+(l+u)/2$ where $\epsilon=0.001$ will have infinite loop, but $m=(l+u)/2$ work fine, may I know why $+l$ is used here? $\endgroup$
    – jiale ko
    Sep 3, 2021 at 21:29
  • $\begingroup$ I’ve just added a note about using newton method to approximate $\theta$, which converges much faster. Also I’m sorry, that was again a mistake. It should of course be $l+(u-l)/2$ or $(u+l)/2$ (which is the same thing). $\endgroup$
    – Lazy
    Sep 3, 2021 at 21:32
2
$\begingroup$

I think there's no elementary formula for this.

Denote arc and chord as $a$, $b$, then $r\theta=a$, $2r\sin{(\theta/2)}=b$. Divide the first equation by the second, we get $$ \frac{\theta}{2\sin{(\theta/2)}}=\frac{a}{b} \\ \theta=\frac{2a}{b}\sin{(\theta/2)}. $$ Subsitute $\theta/2$ with $u$, we get $$ u=\frac{a}{b}\sin{u} $$ which is an equation you can't give simple solution to.

$\endgroup$
0
$\begingroup$

I was attempting the same thing today as part of developing a calculator program. I posted my solution under a different thread here. I think the mods may frown on me reposting the same answer, but I'll summarize it here:

Working in degrees (not radians), and given the chord length ($C$) and the arc length ($A$), I reduced the formula for the radius ($R$) to:

$$ R=\frac{C}{2\sin\left(\frac{360A}{4\pi R}\right)} $$

But there's the problem of having $R$ on both sides, with no straightforward way to simplify. 🤔

I discovered that my TI-84 Plus calculator has an iterative solver built-in, so I can modify the formula slightly so that it equals zero, and plug it in to the solver.

I believe you can do similar iterative solving in Excel or in other programming languages.

Read the full solution

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .