# Programming Assignment #7

## Some interesting mathematical functions

### Introduction

Once again, this week's assignment is several smaller problems - in this case, some python functions.  Since we are now working with functions it is possible for us to write more than one piece of code inside of a single python file.  For this assignment you should use IDLE to create a single python file titled "pa7.py"  This file should contain each of the functions described below.

Customer Request #1 (a function called salaryTable() )

You are contacted by Mr. Hiram Cheaply who is the HR director for a local school district. Teachers in his school district are paid on a schedule that provides a salary based on the number of years they have taught in the district. For example, a beginning teacher in the district might make \$40,000 the first year. For each year of experience up to 10 years they recieve a 2.25% increase over the previous year.

Write a function called salaryTable():

• that takes in three parameters, the starting salary, the total number of years of raises, and the percentage raise each year (see example below)
• prints a table of their salary each year (don't worry about crazy decimals
• returns the TOTAL amount of money a teacher would have made after teaching for the provided number of years in the district

For example:

Customer Request #2 (a function called leibniz() )

Your favorite customer - Dr. Al  Gebra - contacts you again.  He reminds you of somewhat well known mathematical function called the Leibniz approximation (http://en.wikipedia.org/wiki/Leibniz_formula_for_pi)  This approximation states that you can estimate pi using the following series:

or

Write a function called leibniz().  Rather than run as an infinite summation this function should take in a single parameter named size.  This parameter represents the number of terms in the summation (the number of times that the loop should execute).  Your function should calculate the approximation of pi (don't forget to handle the denominator of 4) and return this approximation.  For example:

Customer Request #3 (a function called madhava() )

There actually are many historical approximations of pi.  Let's create another one known as the Madhava approximation of pi.  This appoximation is based on the following sequence (written several ways for clarity).

Write a function called madhava().  Again, rather than run as an infinite summation this function should take in a single parameter named size.  This parameter represents the number of terms in the summation (the number of times that the loop should execute).  Your function should calculate the approximation of pi and return this approximation.  For example: