 This topic has 0 replies, 1 voice, and was last updated 7 months, 3 weeks ago by Richard Purvey.

AuthorPosts

February 7, 2022 at 12:06 pm #8914Richard PurveyParticipant
Computer Algorithms For Nine Of The Standard Algorithmic Calculations Currently Included In The Actuarial Life Contingencies Syllabus
In each case, make the first line of the algorithm:
10 DEF FNS(U)=whatever the survival function, S(U), is.
For example, for a Makeham with A equal to 0.00022, B equal to 2.7*10^(6) and c equal to 1.124, make the first line of the algorithm:
10 DEF FNS(U)=EXP(0.00022*U2.7*10^(6)*(1.124^U1)/LN(1.124))
And then;
If you want the algorithm to calculate an nyear temporary curtate life expectancy for (x) when executed then add on the following:
20 INPUT x,n
30 ANSWER=0
40 FOR r=1 TO n
50 ANSWER=ANSWER+FNS(x+r)
60 NEXT r
70 ANSWER=ANSWER/FNS(x)
80 PRINT ANSWER
90 END
Or if you want the algorithm to calculate the actuarial present value of an nyear temporary immediate life annuity, with a discount factor of v, of 1 per year payable once a year for (x) when executed then add on the following:
20 INPUT x,n,v
30 ANSWER=0
40 FOR r=1 TO n
50 ANSWER=ANSWER+v^r*FNS(x+r)
60 NEXT r
70 ANSWER=ANSWER/FNS(x)
80 PRINT ANSWER
90 END
Or if you want the algorithm to calculate the actuarial present value of an nyear temporary life annuity due, with a discount factor of v, of 1 per year payable once a year for (x) when executed then add on the following:
20 INPUT x,n,v
30 ANSWER=0
40 FOR r=0 TO n1
50 ANSWER=ANSWER+v^r*FNS(x+r)
60 NEXT r
70 ANSWER=ANSWER/FNS(x)
80 PRINT ANSWER
90 END
Or if you want the algorithm to calculate the actuarial present value of a death benefit, with a discount factor of v, of 1 payable at the end of the year of death for (x), provided this occurs within n years, when executed then add on the following:
20 INPUT x,n,v
30 ANSWER=0
40 FOR r=0 TO n1
50 ANSWER=ANSWER+v^r*FNS(x+r)
60 NEXT r
70 ANSWER=ANSWER/FNS(x)
80 ANSWER=1v^n*FNS(x+n)/FNS(x)(1v)*ANSWER
90 PRINT ANSWER
100 END
Or if you want the algorithm to calculate the actuarial present value of an endowment insurance, with a discount factor of v, of 1 where the death benefit is payable at the end of the year of death for (x), provided this occurs within n years, when executed then add on the following:
20 INPUT x,n,v
30 ANSWER=0
40 FOR r=0 TO n1
50 ANSWER=ANSWER+v^r*FNS(x+r)
60 NEXT r
70 ANSWER=ANSWER/FNS(x)
80 ANSWER=1(1v)*ANSWER
90 PRINT ANSWER
100 END
Or if you want the algorithm to calculate the actuarial present value of an nyear temporary immediate life annuity, with a discount factor of v, of 1 per year payable m times per year for (x) when executed then add on the following:
20 INPUT x,n,m,v
30 ANSWER=0
40 FOR r=1 TO m*n
50 ANSWER=ANSWER+v^(r/m)*FNS(x+r/m)
60 NEXT r
70 ANSWER=ANSWER/(m*FNS(x))
80 PRINT ANSWER
90 END
Or if you want the algorithm to calculate the actuarial present value of an nyear temporary life annuity due, with a discount factor of v, of 1 per year payable m times per year for (x) when executed then add on the following:
20 INPUT x,n,m,v
30 ANSWER=0
40 FOR r=0 TO m*n1
50 ANSWER=ANSWER+v^(r/m)*FNS(x+r/m)
60 NEXT r
70 ANSWER=ANSWER/(m*FNS(x))
80 PRINT ANSWER
90 END
Or if you want the algorithm to calculate the actuarial present value of a death benefit, with a discount factor of v, of 1 payable at the end of the 1/m year of death for (x), provided this occurs within n years, when executed then add on the following:
20 INPUT x,n,m,v
30 ANSWER=0
40 FOR r=0 TO m*n1
50 ANSWER=ANSWER+v^(r/m)*FNS(x+r/m)
60 NEXT r
70 ANSWER=ANSWER/(m*FNS(x))
80 ANSWER=1v^n*FNS(x+n)/FNS(x)m*(1v^(1/m))*ANSWER
90 PRINT ANSWER
100 END
Or if you want the algorithm to calculate the actuarial present value of an endowment insurance, with a discount factor of v, of 1 where the death benefit is payable at the end of the 1/m year of death for (x), provided this occurs within n years, when executed then add on the following:
20 INPUT x,n,m,v
30 ANSWER=0
40 FOR r=0 TO m*n1
50 ANSWER=ANSWER+v^(r/m)*FNS(x+r/m)
60 NEXT r
70 ANSWER=ANSWER/(m*FNS(x))
80 ANSWER=1m*(1v^(1/m))*ANSWER
90 PRINT ANSWER
100 END
I have written the above algorithms in BBC BASIC.
Richard Purvey, February 2022. Proud of having lived at 15/5 Marytree House, 12 Craigour Green, Edinburgh until the age of 12.

AuthorPosts
 You must be logged in to reply to this topic.