You are on page 1of 1

#implement the function f(x) = -5 x5 + 69 x2 - 47

def f(x):
return -5*x**5 + 69*x**2 -47
print f(0), f(1),f(2),f(3)

------------------------------------------------------------------------------------

def future_value(present_value, annual_rate, periods_per_year, years):


rate_per_period = annual_rate / periods_per_year
periods = periods_per_year * years
import math
# Put your code here.
return present_value*math.pow(1+rate_per_period,periods)
print "testing future value(500, .04, 10, 10) =" ,future_value(500, .04, 10, 10)
print "$1000 at 2% compounded daily for 3 years yields $", future_value(1000, .0
2, 365, 3)
----------------------------------------------------------------------------------------#Write a function that calculates the area of a regular polygon,
#given the number of sides and length of each side. Submit the area
#of a regular polygon with 7 sides each of length 3 inches. Enter a number
#(and not the units) with at least four digits of precision after the decimal po
int.
def area(number_sides, length_side):
import math
area=0.25*number_sides*length_side**2/math.tan(math.pi/number_sides)
return area
print area(5,7)
---------------------------------------------------------------------------------------------def project_to_distance(point_x ,point_y ,distance):
import math
dist_to_origin = math.sqrt(point_x ** 2 + point_y ** 2)
scale = distance / dist_to_origin
return point_x * scale, point_y * scale
print project_to_distance(2, 7, 4)

You might also like