CoCalc Public FilesProjects / S21 / bis_Proj7 / Project 7.ipynb
Authors: Dylan Cortes, Johann Thiel
Views : 88
Compute Environment: Ubuntu 20.04 (Default)

Intro

The goal of this activity is to use the Bisection Method or Newton’s Method to determine the interest rate (to within an error of 0.0001) being charged in order to purchase this refrigerator. Assume that the interest rate is compounded monthly. For simplicity, ignore any taxes or the $15 promotion. How much would you have to pay to Rent-A-Center in the form of interest? Discuss how the Rent-a-Center payment plan would compare with simply saving$95.30 per month until you can afford to buy the same refrigerator.

In [1]:
import numpy as np
import matplotlib.pyplot as plt

In [2]:
def bisection(a,b,f,err): #This is the code for the bisection method.
c = (a+b)/2
while c - a > err:
if f(c) == 0:
return c
elif f(a)*f(c) > 0:
a = c
else:
b = c
c = (a+b)/2
return c

In [3]:
x =np.linspace(1,2,1000) #We are graphing our compound interest formulaa to get a sense of our boundards a and b for our bisection code.
y = 787.5*(1+x/12)**19 - ((-95.3*12)/x)*(1-(1+x/12)**19)
plt.plot(x,y)
plt.show()

In [4]:
def f(x): #We are defining the function to which the bisection code will run on.
return 787.5*(1+x/12)**19 - ((-95.3*12)/x)*(1-(1+x/12)**19)

In [5]:
bisection(1,2,f,0.0001) #Interest Rate.

1.22222900390625

Conclusion

It would appear in every persons best interest to buy the refrigerator one time, then to pay the monthly layaway cost. If you can't buy it one time but have about 100 bucks to part with every month then the layaway is a good idea. The layaway cost about double the original price.

In [ ]:


In [ ]:


In [ ]: