User:This Is M4dn355 300

{|align="right" width="160px" style="background-color: transparent;" |- | Human Languages Programming Languages Mathematics

|} This_Is_M4dn355_300 is your average Wikipedian, serving from the United States. He signed up after many years of using the website to gather information for research papers, then deciding to edit pages for the betterment of the community and the retainment of its usefulness.

He has an aptitude for mathematics as well as programming and information technology; having a poor knowledge of foreign language, he is currently learning to speak Polish, Russian, German, and Greek (with varying levels of success.)

Algorithm for Base Conversion
This is an algorithm created several years ago to turn converting from one base to another an automated process.

The algorithm presented here is stated using pseudo-code:

$$ -1 $$  $$ r $$

$$ 0 $$  $$ n_n $$

$$ n_o \ne 0 $$
 * $$ {b_n}^{r+1} \leq n_o $$
 * $$ r+1 $$  $$ n_o $$
 * $$ {{b_o}^r}+n_n $$  $$ n_n $$
 * $$ -1 $$  $$ r $$

bo is the base you are converting from, bn is the base you are converting from; no is the number you are converting in its original base, nn is the number in the new base. r is used as a manipulatable variable for converting.

Example
Let us convert 9 from decimal (base10) to binary (base2):

$$ r = -1 $$

$$ n_n = 0 $$

$$ n_o = 9 \ne 0 $$
 * $$ {b_n}^{r+1} = 2^0 = 1 \leq 9 = n_o $$
 * $$ r = -1+1 = 0 $$
 * $$ {b_n}^{r+1} = 2^1 = 2 \leq 9 = n_o $$
 * $$ r = 0+1 = 1 $$
 * $$ {b_n}^{r+1} = 2^2 = 4 \leq 9 = n_o $$
 * $$ r = 1+1 = 2 $$
 * $$ {b_n}^{r+1} = 2^3 = 8 \leq 9 = n_o $$
 * $$ r = 2+1 = 3 $$
 * $$ {b_n}^{r+1} = 2^4 = 16 > 9 = n_o $$
 * $$ {n_o}-{b_n}^r = 9-8 = 1 = n_o $$
 * $$ {b_o}^r + n_n = 10^3 = 1000 + 0 = 1000 = n_n $$
 * $$ r = -1 $$

$$ n_o = 1 \ne 0 $$
 * $$ {b_n}^{r+1} = 2^0 = 1 \leq 1 = n_o $$
 * $$ r = -1+1 = 0 $$
 * $$ {b_n}^{r+1} = 2^1 = 2 > 1 = n_o $$
 * $$ {n_o}-{b_n}^r = 1-2^0 = 1-1 = 0 = n_o $$
 * $$ {b_o}^r + n_n = 10^0 = 1 + 1000 = 1 = n_n $$
 * $$ r = -1 $$

$$ n_o = 0 = 0 $$

$$ n_n = 1001_2 = 9_{10} $$

This works with integers only; the easiest way to have a decimal is to convert it to a fraction and convert the numerator and denominator.

Why does it work?
The reason this algorithm works is because of a deviously simple rule: all radix systems operate under the same rules -- other than the number at which to add a digit, of course. You can add, subtract, and, therefore, do anything else -- be it multiplying, dividing, squaring, square-rooting, you name it -- the same way in binary as you do in decimal.

But how does a number get from binary to decimal, and vice-versa?

The answer lies within the difference between these bases. Digits in base10 each represent that power-1 of 10. 1 is 1*100, while 92 is 9*101+2*100. This seems redundant to us, being as how our numerical thoughts are in decimal. It becomes more practical when we apply this to different bases. Take another look at binary. Each digit is for that power of 2. This means that 12 is 110, 102 is 210. 1002 is 410, and so on.

Formula of Areas of regular 2D Objects in r2 Form
The search for this formula ended with trying to find a formula from the original formula for the area of polygons:

$$ A = {1 \over 2}ap $$

Where A is the area of the shape, a is the apothem, and p is the perimeter. This formula was to be merged with the formula for the area of a circle:

$$ A = \pi r^2 $$

Again, A is the area of the shape, but r is the radius. This formula is just a special case for the area of a polygon where these requirements are met:

$$ C = p = 2 \pi r $$

$$ a = r $$

The perimeter, or circumference of a circle, is equal to 2$\pi$r, and the apothem is equal to the radius of the circle. The central angle of the circumscribed circle of the triangle formed with each edge and two vertices of these polygons can be defined as:

$$ c_a = {360^\circ \over n_s} $$

Where ca is the central angle and ns is the number of sides that the shape has. Because the triangles must be isosceles, as the radius (r) of the circumscribed circle is the same across the edges of the shape, a division of these triangles yields twice as many right triangles, where the central angles are: $$ c_a = {360^\circ \over 2n_s} $$

Since r must be the hypotenuse of these right triangles, the height of this triangle is:

$$ h = r \cos c_a $$

Or:

$$ h = r \cos {360^\circ \over 2n_s} $$

Where the base (&frac12; of the base of the isosceles triangle) is:

$$ {1 \over 2}b = r \sin {360^\circ \over 2n_s} $$

Therefore:

$$ b = 2r \sin {360^\circ \over 2n_s} $$

This means that the area of one of these triangles is equal to &frac12;bh. When plugged in, this equals:

$$ A_t = r^2 \sin {360^\circ \over 2n_s} \cos {360^\circ \over 2n_s} $$

And because the number of sides that a polygon has is also the number of possible bases and therefore the number of triangles in the shape, the area of the figure is equal to the number of sides multiplied by the area of each triangle:

$$ A = n_s A_t $$

When expanded, this equals:

$$ A = n_s r^2 \sin {360^\circ \over 2n_s} \cos {360^\circ \over 2n_s} $$

Example
This formula works for every possible 2-dimensional regular shape. For example, the formula for the area of an equilateral triangle in r2 form is:

$$ A = 3r^2 \sin {60^\circ} \cos {60^\circ} $$

Try this out on an imaginary equilateral triangle with side lengths of 1. To find the area using the old formula for the area of a polygon, we must find the height of the polygon:

$$ A = {1 \over 2}bh $$

Since the base of the triangle is already given (1), we must only find the height (h)

$$ A = {1 \over 2}1h = {1 \over 2}h $$

If we have an equilateral triangle, we can split it in two to form two right triangles. From here, we can figure out the height of the equilateral triangle:

$$ h = b \sin 60^\circ = 1 \sin 60^\circ = \sin 60^\circ $$

With this, we can now solve for the area of the triangle:

$$ A = {1 \over 2}h = {1 \over 2}\sin 60^\circ $$

Having obtained the area of the triangle, we can test the formula to see if it holds true:

$$ {\sin 60^\circ \over 2} = 3r^2 \sin 60^\circ \cos 60^\circ $$

To find r2 we must again use trigonometric ratios to find r:

$$ r = {.5 \over \sin 60^\circ} = {1 \over 2\sin 60^\circ} $$

We must square r to be able to plug it into the formula:

$$ r^2 = {{1^2} \over {2^2}{\sin^2 60^\circ}} = {1 \over 4\sin^2 60^\circ} $$

We can now plug the answer in for r2:

$$ {\sin 60^\circ \over 2} = 3 {1 \over 4\sin^2 60^\circ} \sin 60^\circ \cos 60^\circ = {{3 \cos 60^\circ} \over {4 \sin 60^\circ}} $$

This is, indeed, correct. The area of the triangle is equal, about .433 for both formulas:

$$ {\sin 60^\circ \over 2} = {{3 \cos 60^\circ} \over {4 \sin 60^\circ}} $$

Why does it work?
Begin by analyzing the formula for the area of a regular polygon:

$$ A = {1 \over 2}ap $$

This formula obscurely references the formula for the area of a triangle:

$$ A = {1 \over 2}bh $$

In this formula, b is the base and h is the height of the triangle.

The area of a polygon can be considered the addition of the areas of the triangles that can be made out of the polygon, a is the height of each triangle, and p is the addition of all of the bases. The r2 formula can be thought of as doing the same. Height h in the r2 formula is:

$$ h = r \cos {360^\circ \over 2n_s} $$

Whereas base b of one of the triangles is:

$$ h = 2r \sin {360^\circ \over 2n_s} $$

Plug these into the triangle-area formula and you have:

$$ A_t = r^2 \sin {360^\circ \over 2n_s} \cos {360^\circ \over 2n_s} $$

Now, to get the area of the polygon, all you have to do is multiply by the number of triangles -- which is equal to the number of sides. You end up with the r2 formula:

$$ A = {n_s}r^2 \sin {360^\circ \over 2n_s} \cos {360^\circ \over 2n_s} $$

Value for π
Because a curve can be thought of as being composed of infinitely many, infinitely small line segments, a circle can be thought of as being the same. This means that:

$$ A = \infty r^2 \sin {360^\circ \over 2 \infty} \cos {360^\circ \over 2 \infty} $$

Now, we head back to the original formula for the area of a circle:

$$ A = \pi r^2 $$

Dividing by r2, we get:

$$ {A \over r^2} = \pi $$

Therefore, the area of a circle over the square of its radius is equal to π. This can be obtained in the new formula by dividing by r2 again:

$$ {A \over r^2} = \infty \sin {360^\circ \over 2 \infty} \cos {360^\circ \over 2 \infty} $$

We can now substitute π in.

$$ \pi = \infty \sin {360^\circ \over 2 \infty} \cos {360^\circ \over 2 \infty} $$

This is more aptly represented using the limit bound because the graph of this function never touches π:

$$ \lim_{n_s \to \infty} n_s \sin {360^\circ \over 2n_s} \cos {360^\circ \over 2n_s} = \pi $$

What does this mean?
Aside from relating π and ∞, this equation is just another representation of what the r2 formula does: it adds the areas of triangles together to find the area of the shape. This means that there are infinitely many triangles inside a circle, and the central angles of these triangles are 1&frasl;2 of 1&frasl;∞ degrees wide.