Many math students have to use the same formulas over and over again. This article is going to show you how to build a script to do one formula and then how to add more and more.

## Slope Script[]

In math class, we all learned the following formula:

Since we are creating a script to solve for an unknown value, we need to ask the user to input the values needed to solve for the unknown. In this case, we need the user to input X_{1}, Y_{1}, X_{2}, and Y_{2}. After the user has given those values, the value of the unknown needs to be displayed.

Now that you know exactly what you need to do, try writing the script by yourself. If you get stuck or want to check your work, the source code can be found here.

## Distance Script[]

Another common formula in math is the distance formula:

As with the slope script, we as the programmers don't know the coordinates. We need some input from the user so we can use the formula. Try writing the script and if you get stuck, you can find the source code here.

## Interior Angles of a Polygon[]

### Sum of the Interior Angles of Polygon[]

One thing that is a common occurrence in Geometry is finding the sum of the interior angles present in a polygon. This can be done in a simple formula:

Where *n* is the number of sides. As you can see, this is fairly simple and only requires a few calculations. This is a nice script for novices to try and write by themselves. If you get stuck, an example of a script can be found here.

### Interior Angle of a Regular Polygon[]

As a variation of the above, you can find the measure of each individual angle in a regular (ie. each side is congruent) polygon. The formula is below:

Where again, *n* is the amount of sides. The source code for this is just a slight variation of this one, but you can find it here