In [44]:
a=1
b=2
In [45]:
c=a+b
In [46]:
c
Out[46]:
3
In [47]:
d=c+b
In [48]:
d
Out[48]:
5
In [16]:
a=1
b=2
print(a)
print(b)
for count in range(0,30):
    c=a+b
    print(c)
    a=b
    b=c
    
    
1
2
3
5
8
13
21
34
55
89
144
233
377
610
987
1597
2584
4181
6765
10946
17711
28657
46368
75025
121393
196418
317811
514229
832040
1346269
2178309
3524578
In [52]:
P = 110000
rate= 7
L=30
r=rate/100
In [53]:
P*(r/12)/((1-(1+r/12)**(-12*L)))
Out[53]:
731.8327446971007
In [54]:
def Total_payment(t):
    return P*(r/12)/((1-(1+r/12)**(-12*L)))*t*12 
In [55]:
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
In [65]:
X = np.arange(0,31,1/12)
In [66]:
plt.plot(X,Total_payment(X))
plt.show()
In [67]:
plt.plot(X,Total_payment(X))
plt.grid()
plt.title('Total payments')
plt.xlabel('years')
plt.ylabel('Total paid in $')
plt.show()
In [68]:
def Unpaid(t):
    R = P*(r/12)/((1-(1+r/12)**(-12*L)))
    return R*((1-(1+r/12)**(-(L*12-12*t))))/(r/12)
In [69]:
plt.plot(X,Unpaid(X))
plt.grid()
plt.title('Unpaid amount')
plt.xlabel('years')
plt.ylabel('Total paid in $')
plt.show()
In [70]:
plt.plot(X,Unpaid(X),label='unpaid',c='r')
plt.plot(X,Total_payment(X),label='money grubbing banks stole')
plt.grid()
plt.title('interesting graph')
plt.xlabel('years')
plt.ylabel('Total paid in $')
plt.legend()
plt.show()
In [43]:
range(2)
Out[43]:
range(0, 2)
In [ ]: