0

I am a software developer who has run into a wall with a math equation.

I have everything boiled down to this one equation, but I cannot seem to solve for w.

My known variables are r, x, and s, and I need to solve for w.

$$w = \sin(\frac{\pi(r - xw)}{2(r - s)}) * 2r$$

Any help is appreciated.

Thanks!

2 Answers2

2

This is too long for a comment.

The exact way for solving the problem has been given by gt6989b in his/her answer.

Under some conditions, you could approximate the solution.

Let me change notation and define $$y=\frac{\pi (r-w x)}{2 (r-s)}\implies w=\frac{r}{x}-\frac{2 (r-s)}{\pi x}y$$ The equation becomes $$\frac{r}{x}-\frac{2 (r-s)}{\pi x}y=2r \sin(y)$$ For $0\leq y\leq \pi$, a very crude approximation of mine is $$\sin(y)\approx \frac{120 }{\pi ^5}(\pi -y) y$$ which would let you with a quadratic equation in $y$. $$240 r x y^2+ \left(-240 \pi r x-2 \pi ^4 r+2 \pi ^4 s\right)y+\pi ^5 r=0$$

Much better would be, for the same range, the magnificent $$\sin(y) \simeq \frac{16 (\pi -y) \,y}{5 \pi ^2-4 (\pi -y)\, y}\qquad (0\leq y\leq\pi)$$ proposed, more than $1400$ years ago, by Mahabhaskariya of Bhaskara I, a seventh-century Indian mathematician (see here). This will give you a cubic equation to solve.$$8 (s-r)y^3+4 \pi (r (8 x+3)-2 s)y^2+2 \pi ^2 (5 s-r (16 x+7))y+5 \pi ^3 r=0$$

1

I don't think an analytic solution exists. You may do better by defining a function $$f(w) = w - 2r \sin\left(\frac{\pi(r-xw)}{2(r-s)}\right)$$ and doing numerical root-finding to numerically find the value of $w$ which drives your function to $0$, using for example Bisection Method or Newton's Method (since derivative is easy to find analytically and implement as well).

gt6989b
  • 54,422