I'm writing a program that's going to visualize the accuracy of the shape of a circle, given approximated values of pi. My method of drawing the "circle" shape is to draw an arc, and connect the two endpoints with a line. The perimeter of the shape will be:
$$p = d \cdot \pi_a$$
Where "p" is the perimeter, "d" is the diameter of the circle, and "pi sub a" is the approximate value of pi.
The end result of the shape will be something like the following, where the shape is constructed of line x and arc y:
If I were to use 3 instead of 3.14159 for "pi sub a", then the perimeter of this shape would be 6 instead of 6.28318.
Now, line X in the above image is technically a chord. To properly draw the shape, I need to find the apothem of that chord. But, in order to find the apothem, I need to know the length of the chord (the value of X).
I needed to do a proof-of-concept and see if I can accurately draw a shape using this method. So, I decided to approximate pi as 3, meaning that the perimeter of the shape would be 6 (on a circle with radius of 1).
The length of a chord is:
$$2\sin(a/2)$$
So, this led me to using Wolfram Alpha to solve the following equation:
$$2\pi - a + 2\sin(a/2) = 6$$
The result for the chord length (α) was 1.92367, which resulted in an apothem (r) of 0.27364.
Now, the little program I'm making; I would like to animate the shape of the approximated circle, given a constantly changing approximation of pi.
Part of the code needs to define a variable in order to draw the shape correctly. The variable is "x" in the function below:
$$2\pi - x + 2\sin(x/2) = y$$
How do we solve for x?
Trig was never my strong suit in school, let alone equations that require a solution for a variable that's inside and outside a trigonometric function.
Could someone help run me through the solution?

