Search for notes by fellow students, in your own course and all over the country.

Browse our notes for titles which look like what you need, you can preview any of the notes via a sample of the contents. After you're happy these are the notes you're after simply pop them into your shopping cart.

My Basket

You have nothing in your shopping cart yet.

Title: Python non-build functions for annuity certain using loops
Description: The notes give the non-build function that calculates the present value functions of level annuity, increasing level annuity and compound increasing annuity

Document Preview

Extracts from the notes are below, to see the PDF you'll receive please use the links above


Python non-build functions for annuity certain using loops
Simion Makola
01/03/2022

Abstract
The document seeks to demonstrate non-build present value functions for term certainty annuity using
python for the level annuity, level increasing annuity, and compound increasing annuity
...
Furthermore, the function
demonstrated basic skills such as iterations with for loops, storing objects into an array, and if statements
for control structure
...


Introduction
An annuity is a financial contract between the financial institution and investor (holder) such that the
investor receives a series of payments from the financial contract at the exchange of a single lump or series
of payments (premiums)
...
Bond repayments, bond repayments, and dividends are examples of annuities
...

The furthermore assumption about annuity certain is that the payments and their timing are certain and
deterministic
...


ο‚·

The timing and size of the cash payments are deterministic
...


ο‚·

The level of payments might be level, varies over time like level increasing/decreasing, or
compound increasing/decreasing
...


ο‚·

The further assumption of annuity is that the interest rate is constant over time or deterministic
...
Payments could
occur monthly, quarterly, semiannual, biennially, triennially, or any possible patterns
...


Mathematical Formula derivations and formulas
The formulas are an essential part of the geometric series derivations that form part of the Calculus
...

π‘ŽΜˆ 𝑛 βˆ’π‘›π‘£ 𝑛
𝑖

= 𝑣 + 2𝑣 2 + β‹― + n𝑣 𝑛 = βˆ‘π‘›π‘˜=1 π‘˜π‘£ π‘˜ where π‘ŽΜˆ 𝑛 =

1βˆ’π‘£ 𝑛
(

𝑖
)
1+𝑖

is the present value of one payable in

advance
...


1βˆ’((1+π‘Ÿ)𝑣)𝑛
1βˆ’(1+π‘Ÿ)𝑣

= 𝑣 + (1 + π‘Ÿ)𝑣 2 + β‹― + (1 + π‘Ÿ)π‘›βˆ’1 𝑣 𝑛 = βˆ‘π‘›π‘˜=1(1 + π‘Ÿ)π‘˜βˆ’1 𝑣 π‘˜ where is π‘Ÿ is the rate of the

increase compounded per period
...


Python Scripts
Present Value Annuity Function in Arrears
...
The lines
of the code π‘₯ = [ ] create an empty array that stores the values of 𝑣, 𝑣 2 , … , 𝑣 𝑛 using the for loop, which
starts from index of 0 to 𝑛 βˆ’ 1, for that reason variable π‘Ž is to the exponent β„Ž + 1
...
Similarly,𝑦 = [ ] does the same
thing as π‘₯ = [ ] but it creates an array that consists of 1's
...
π‘Žπ‘Ÿπ‘Ÿπ‘Žπ‘¦(π‘₯) helps us to transpose
the array into a row vector with the line π‘Ÿ = π‘Žπ‘Ÿπ‘Ÿ
...
The last
part of the function tries to select the function out for different scenarios
...

2

Else if the interest rate is zero while the period of the annuity is non-zero then the return value will be the
amount*period
...
append(a**(h+1))
for h in range(n):
y
...
array(x)
r=arr
...
dot(r,y)
if((interestRate!=0 and n!=0)==True):
return(pv)
elif((interestRate==0 and n!=0)==True):
return(Amount*n)
else:
return(0)
Function Call testing with different arguments
The function call requires the function name and function arguments
...


Different Cases Interest Rates Period
Present Values
1
5%
10
7721,73
2
0
10
10000,00
3
0
0
0,00
4
5%
0
0,00
PresentValue(Amount=1000,interestRate=0
...
73492918481
PresentValue(Amount=1000,interestRate=0,n=10)
## 10000
PresentValue(Amount=1000,interestRate=0
...

Everything else is the same as the previous coding except the fact that column vector 𝐡 = [1,2,3,4, … , 𝑛]
...

import numpy as np
def LevelIncreasingPresentValue(Amount,interestRate,n):
x=[]
y=[]
a=1/(1+interestRate)
for i in range(n):
x
...
append(h+1)
arr = np
...
T
pv=Amount*np
...
5*n*(n+1))
else:
return(0)
Function Call
Since the mathematical formula of the present value of the level increasing annuity then πΌπ‘Žπ‘› =
here are the excel calculations below to verify the python function
...
05,n=10)
## 39373
...
0
LevelIncreasingPresentValue(Amount=1000,interestRate=0
...
For simplicity’s sake,
if the period is zero then the present value of the compound increasing annuity is zero because there is no
payment
...
A further possibility is that when everything
else is non-zero except the interest rate the present value will be π΄π‘šπ‘œπ‘’π‘›π‘‘ βˆ— βˆ‘π‘›π‘˜=1(1 + π‘Ÿ)π‘˜βˆ’1
...
append(a**(k+1))
for j in range(n):
y
...
append(1)
for k in range(n):
A
...
array(x)
y1=np
...
array(A)
y2=x1*y1
p1=y2
...
T
pv1=Amount*np
...
dot(p2,z)
pv3=Amount*np
...
05,r=0
...
657450536086
CompoundIncreasingPresentValue(Amount=1000,interestRate=0,r=0
...
424601000008
CompoundIncreasingPresentValue(Amount=1000,interestRate=0
...
1,n=0)
## 0
CompoundIncreasingPresentValue(Amount=1000,interestRate=0
...
73492918481
CompoundIncreasingPresentValue(Amount=1000,interestRate=0,r=0,n=10)
## 10000

Different Cases Interest Rates r
1
5%
2
0
3
0
4
5%
5
5%
6
0

Period
10%
10%
0
0
10%
0

1+i
10
10
10
10
0
0

1+r
105%
100%
100%
105%
105%
100%

110%
110%
100%
100%
110%
100%

PresentValues
11846,65745
159374,25
10000
7721,734929
0
0

Conclusion
The python function evaluates the present values of different annuities for any type of payment pattern
...
The solutions can help
businesses and individuals to make rational investment and financing decisions
...


References
Dawson, M
...
Python Programming (3rd ed
...

Gowrishankar S, V
...
(2019)
...
New York: Taylor & Francis Group,
LLC
...
(2014)
...
Stamford, USA: Cengage Learning
...
(2008)
...
Belmont, USA: Thomson
Learning
Title: Python non-build functions for annuity certain using loops
Description: The notes give the non-build function that calculates the present value functions of level annuity, increasing level annuity and compound increasing annuity