Module 2: Annuities-Certain: Level and Varying
Turning a stream of payments into one number, and reading every annuity formula as a geometric series
1. One idea behind every annuity
An annuity-certain is a series of payments made at fixed dates for a fixed term, with no uncertainty about whether each payment happens. A mortgage, a coupon stream, a pension paid for a guaranteed term: all are annuities-certain.
Valuing one never needs a new principle. Each payment is moved to the comparison date with (Module 1), and the results are added. What makes annuities worth a module is that the sum is a geometric series, so it collapses to a short closed form. Learn the collapse once and every formula in this module follows.
For any ratio :
Proof. Call the sum . Then , and subtracting, . Divide by .
2. Level annuities
2.1 Annuity-immediate: payments at the end of each period
Payments of 1 at times :
The present value is . Factor out and apply the series with :
using from Module 1.
Reading the formula. Rearranged, . A deposit of 1 today can fund interest payments of every year (worth ) and still return the 1 at time (worth ). That sentence is the formula, and it is the fastest way to rebuild it under exam pressure.
The zero-rate case. At the closed form reads , but the stream itself is perfectly well defined: payments of 1 with no discounting are worth . The limit of as is indeed . A formula that breaks at a special value is a sign to go back to the sum, not that the value is undefined.
The accumulated value at time is the same stream valued years later:
2.2 Annuity-due: payments at the start of each period
Moving every payment one period earlier multiplies each value by :
Two identities are worth knowing because they let you switch types without recomputing: (pay one now, then an immediate annuity of ) and .
Shifting is not extending. Two payments of 100 at times 1 and 2 are worth at 10%. Moving both one year earlier (times 0 and 1) multiplies the value by 1.1: 190.91. Adding a third payment instead (times 1, 2, 3) is a third contract worth 248.69. All three are "annuities of 100", and only the timeline tells them apart.
Immediate versus due: shift the dates, keep the payments
2.3 Perpetuities
Let . Since ,
The first has a one-line meaning: invest and withdraw the interest, 1, forever.
Payments far in the future are worth little today: the first 20 years supply 69% of the perpetuity's value, and years 40 to 60 add less than 7%.
Example 2.1: The full set at 6% for 12 years
| Quantity | Value |
|---|---|
| 8.3838 | |
| 8.8869 | |
| 16.8699 | |
| 17.8821 | |
| 16.6667 |
Check: . Every entry follows from the first.
Example 2.2: A level loan payment
A car loan of 18,000 is repaid by 8 level payments at the end of each year at 5.5%. The payment satisfies , so .
3. Deferred annuities and partial streams
A stream that starts later is a shifted stream. If payments of 1 are made at times :
The right-hand side reads "the long annuity, minus the payments that do not happen". Both forms appear in practice; choose the one that avoids extra computation.
Example 3.1: Payments that begin in year 5
1,000 is paid at the end of years 5 through 14 at 5%. There are 10 payments, and the first is at time 5, so the stream is a 10-year annuity-immediate valued at time 4, then discounted 4 years:
3.1 Splitting a long annuity in two
When annuity equations involve terms with lengths and , use algebraic factorization:
Similarly:
3.2 Balloon and drop payments
When a debt is repaid with level payments , the exact term is rarely an integer. If with :
- Balloon Payment (): Pay at times , plus a single larger final payment at time :
- Drop Payment (): Pay at times , followed by a smaller payment at time :
4. Payments more or less often than interest is credited
4.1 Payable times a year
If is paid at the end of each -year for years (total 1 per year), the same geometric-series argument with ratio gives
The numerator is unchanged; only the rate in the denominator moves to the nominal rate that matches the payment frequency. Because , monthly payments are worth slightly more than annual ones: each payment arrives earlier on average.
4.2 Continuous payments
Let . Payments flow at rate 1 per year and
At 6% for 5 years: , , . The order of these values is the order of how early the money arrives.
A continuous payment rate is measured in money per year, and it enters an integral: . A rate of 120 a year for two years at force 0.04 is worth . Replacing it by two lump sums of 120 at the year ends would value a different timing.
4.3 How the annuity values are ordered
Because discounting takes effect sooner the earlier payments are received:
5. Varying annuities
5.1 Arithmetic increase
Payments of at times have present value .
Derivation. Split the increasing stream into level annuities stacked on top of each other: one paying 1 from time 1 to , one paying 1 from time 2 to , and so on. Their total present value is
The same stacking with payments gives
Interpret it as a perpetuity argument: funds per year forever; subtract , which removes one unit of payment per year as the term runs out.
- Increasing (Ia)
- Decreasing (Da)
Both streams pay 55 in total. At 5% the decreasing stream is worth 45.57 and the increasing one 39.37: the large payments of the decreasing stream come first and are discounted less.
5.2 Increasing plus decreasing
5.3 Any arithmetic progression
Payments starting at at time and changing by each period ():
When , payments decrease arithmetically.
5.4 Increasing perpetuities
Taking the limit as where and :
For a general perpetuity paying :
5.5 Geometric increase
Payments of at times form a geometric series with ratio :
When every term equals and the value is simply . When the formula still holds; both numerator and denominator are negative.
Growing perpetuities. Let . The ratio must be below 1 for the terms to shrink, so a growing perpetuity has a value only when , and then
When the finite stream is worth , which grows without limit as grows: the infinite stream has no value. "Long" and "infinite" are different contracts; replacing one by the other changes the answer, sometimes from a number to nothing.
Example 5.1: A growing payment
A benefit starts at 2,000 at the end of year 1 and grows 3% a year for 15 payments. At 7%:
5.6 Continuously varying payments
Continuous Varying Annuities
A continuously paying annuity where the rate of payment at time is :
The Palindromic Annuity Identity
Consider an annuity paying at times . Its present value satisfies:
6. Case study: what is a Riverstone pension worth?
Riverstone values at an annual effective rate of . A teacher retiring today is promised 2,400 a month for 20 years, guaranteed, whatever happens to her.
Step 1: monthly payments. The rate per month is . Over 240 months,
Step 2: why the timing matters. Paying the year's 28,800 once at each year end would be worth only . The monthly pension is worth 7,665.31 more because most of each year's money arrives earlier.
Step 3: a continuous approximation. Treating the payments as a continuous stream of 28,800 a year gives , within 0.2% of the monthly value. For a large payroll, the continuous annuity is a quick and close estimate.
Step 4: a pension that rises with prices. A different member is paid 28,800 at the start of each year, rising by a year. The payments form a geometric series with ratio :
Indexing adds about a fifth to the cost of the pension.
Step 5: a pension that starts later. A member aged 55 will receive the same monthly pension from age 62. Its value today is the Step 1 value discounted 7 years: .
Sense check. No 20-year pension of 28,800 a year can cost more than a perpetuity of the same size, . All the values above are well below it.
7. Common traps
Trap 1: Off-by-One Deferral Exponent on Deferred Annuities-Immediate
An annuity-immediate values its stream one period before the first payment. Therefore, if the first payment occurs at time , the valuation date of is , and its present value at is (or equivalently ). Using discounts by one period too many!
Trap 2: Counting the Number of Payments Between Inclusive Endpoints
If annual payments occur at times , the total number of payments is , not . For example, payments at the end of years 5 through 18 inclusive consist of payments.
Trap 3: Accumulated Value Valuation Date ( vs. )
gives the accumulated value on the exact date of the final payment (), whereas gives the accumulated value one full period after the final payment. Always verify whether the problem asks for the balance "immediately after the -th deposit" () or "one year after the -th deposit" ().
Trap 4: Using vs. Inside Arithmetic Annuity Formulas
In the standard increasing annuity-immediate (payments ), the numerator contains because the first payment of 1 is already included. In the general P-Q formula (payments ), the numerator of the -term uses because the first increment does not arrive until time .
Trap 5: Dividing by Instead of in Increasing Annuity-Due
For an increasing annuity-due , the formula is : the numerator is identical to , and only the denominator changes from to .
Trap 6: Geometric Annuity Resonance Case ()
When the payment growth rate equals the effective interest rate , the standard geometric annuity formula becomes . Going back to the sum shows immediately that .
Trap 7: First Payment Scaling in Geometric Annuities
Always check whether the first payment at is or . The standard formula assumes the first payment at is . If the problem states "a base salary of at grows by per year, and contributions are made at year-end," the first contribution at is .
Trap 8: Payment Frequency Less Frequent Than Interest Compounding
When payments occur every years (e.g., biennial or triennial payments) while interest is quoted annually as , never multiply or divide by . Compute the multi-year effective interest rate for one payment period of years, and evaluate the annuity at rate over the actual number of payments.
Trap 9: Continuous Varying Stream vs. Discrete
When payments flow continuously at rate per year, the present value is . If instead payments are made continuously within each year at level rate during year , the present value is (numerator , denominator ).
Trap 10: Perpetuity Convergence Requirement ()
A geometric perpetuity converges if and only if . If , the infinite stream diverges to ; any exam problem with must be a finite-horizon -period annuity.
Trap 11: Increasing Perpetuity-Immediate vs. Increasing Perpetuity-Due
For payments starting at , . For payments starting at , .
Trap 12: Palindromic Stream Identification
A payment stream running from to has present value . Recognizing this product saves splitting the stream into an increasing annuity plus a deferred decreasing annuity.
Trap 13: Factorization Shortcut
Whenever an exam problem gives the ratio , immediately write . From , you have and without ever solving for or separately.
Trap 14: Drop Payment vs. Balloon Payment Timing
When solving for the number of full payments to amortize a loan with level payment , a balloon payment is added to the -th payment at time , whereas a drop payment is paid one period later at time .
Trap 15: BA II Plus BGN Flag Left Active After an Annuity-Due Problem
If you switch the BA II Plus to BGN mode ([2nd] [BGN] [2nd] [SET]) to solve an annuity-due, a tiny BGN indicator remains at the top of the screen and will corrupt every subsequent annuity-immediate, loan, or bond calculation. Safer habit: leave the calculator in END mode permanently and multiply by manually for annuity-due questions.
8. Practice problems
Problem 1: Accumulating a savings plan
500 is deposited at the end of each year for 20 years at 4%. Find the balance just after the last deposit.
- A15484.60
- B14889.04
- C6795.16
- D10000.00
- E16103.98
Solution: . Answer (B).
Why the other choices are wrong:
- (A) Treats the deposits as made at the start of each year, .
- (C) Gives the present value instead of the accumulated value.
- (D) Ignores interest and adds the 20 deposits.
- (E) Accumulates each deposit two years too long, .
Problem 2: An annuity-due
Find the present value of 300 paid at the start of each year for 25 years at 5%.
- A4228.18
- B4661.57
- C4439.59
- D6000.00
- E7500.00
Solution: . Answer (C).
Why the other choices are wrong:
- (A) Values the payments as end-of-year, .
- (B) Multiplies by twice.
- (D) Values a perpetuity, , instead of 25 payments.
- (E) Ignores interest and adds the 25 payments.
Problem 3: An increasing stream
Payments of 100, 200, …, 1,500 are made at the end of years 1 to 15. Find the present value at 4.5%.
- A9467.68
- B7715.60
- C8591.64
- D8062.80
- E12000.00
Solution: and , so and the value is 7715.60. Answer (B).
Why the other choices are wrong:
- (A) Values the decreasing stream , .
- (C) Replaces the payments by their average, 800, which ignores that the large payments come last.
- (D) Values the payments at the start of each year, multiplying by .
- (E) Ignores interest and adds the payments.
Problem 4: A deferred perpetuity
A perpetuity pays 1,000 a year with the first payment at the end of year 4. Find its value at 5%.
- A20000.00
- B16454.05
- C17276.75
- D18140.59
- E21000.00
Solution: The first payment at time 4 makes it a perpetuity-immediate valued at time 3: . Answer (C).
Why the other choices are wrong:
- (A) Ignores the deferral and values a perpetuity starting at time 1.
- (B) Discounts 4 years instead of 3; the perpetuity-immediate formula already values one period before the first payment.
- (D) Discounts only 2 years.
- (E) Values a perpetuity-due, , and ignores the deferral.
Problem 5: System of Equations
Problem: An annuity-immediate pays 100 at the end of each year for years. A second annuity-immediate pays 100 at the end of each year for years. The present value of the second annuity is times the present value of the first annuity. Find , and if , determine the annual effective interest rate .
Solution:
- Express the relationship using the factoring identity:
We are given . Therefore:
- Solve for when :
Problem 6: Geometric Annuity with Finite Horizon
Problem: An employee contributes to a retirement account at the end of each year for 25 years. The initial contribution is 5,000. Each subsequent contribution increases by over the previous contribution. The account earns an annual effective interest rate of . Calculate the accumulated balance in the account immediately after the 25th deposit.
Solution:
- Identify the parameters:
- Initial payment .
- Growth rate .
- Interest rate .
- Number of years .
- Compute Present Value at :
- Accumulate to time :
Problem 7: Deferred Annuity with Nominal Quarterly Interest
An annuity pays 600 at the end of every quarter for 6 years, with the first payment occurring 2.25 years (9 quarters) from today. The nominal annual interest rate is convertible quarterly. Calculate the present value of this annuity today.
- A9,685.62
- B9,879.43
- C9,495.80
- D11,348.36
- E9,792.89
Solution:
- Work in quarterly periods: per quarter.
- There are quarterly payments of 600. Since the first payment is at quarters, values the stream at quarters.
- Discount back 8 quarters to :
Answer (A).
Why the other choices are wrong:
- (B) Discounts 7 quarters instead of 8.
- (C) Discounts 9 quarters, to the first payment date, though already values one quarter before it.
- (D) Ignores the deferral and values the payments as if they started next quarter.
- (E) Treats 8% as an effective annual rate, using the quarterly rate instead of .
Problem 8: Arithmetic P-Q Annuity-Immediate
A 12-year annuity-immediate pays 400 at the end of year 1, and each subsequent annual payment increases by 75 over the previous payment. At an annual effective interest rate of , calculate the present value of the annuity.
- A6,378.80
- B7,007.59
- C6,811.87
- D3,353.54
- E9,750.00
Solution:
- Identify , , , .
- Compute and :
- Apply the P-Q formula:
Answer (A).
Why the other choices are wrong:
- (B) Adds to a level 400, which starts the increases one year too early.
- (C) Replaces the payments by their average, 812.50, which ignores that the large payments come last.
- (D) Ignores the increases and values a level 400.
- (E) Ignores interest and adds the payments.
Problem 9: Decreasing Annuity Accumulated Value
Deposits of are placed into a fund at the end of years , respectively. The fund earns an annual effective interest rate of . Calculate the accumulated value of the fund immediately after the 10th deposit at .
- A6,413.57
- B4,556.53
- C5,500.00
- D7,422.11
- E7,793.21
Solution:
- The payment stream is valued at , or valued at .
- Compute :
- Accumulate to by multiplying by :
Answer (D).
Why the other choices are wrong:
- (A) Accumulates the increasing stream , putting the large deposits last.
- (B) Stops at the present value and never accumulates it to time 10.
- (C) Ignores interest and adds the deposits.
- (E) Treats the deposits as made at the start of each year, an extra factor .
Problem 10: Increasing Perpetuity with Initial Level Phase
A perpetuity-immediate pays 200 per year at the end of each of the first 5 years, and then increases by 50 per year thereafter (paying 250 at , 300 at , and so onforever). At an annual effective interest rate of , calculate the present value of the perpetuity.
- A25,000.00
- B20,454.05
- C24,000.00
- D16,454.05
- E17,319.94
Solution:
- Decompose the stream into a level perpetuity of 200 starting at , plus a deferred increasing perpetuity paying starting at (valued at ):
- Since and :
Answer (B).
Why the other choices are wrong:
- (A) Ignores the deferral of the increasing part.
- (C) Uses for the increasing perpetuity instead of , and ignores the deferral.
- (D) Values only the deferred increasing part and drops the level perpetuity of 200.
- (E) Stops the level 200 after year 5, so the increasing part loses its base of 200.
Problem 11: Palindromic Payment Stream Valuation
An annuity-immediate makes 19 annual payments of at the end of years . At an annual effective interest rate of , calculate the present value of this payment stream.
- A5,417.09
- B6,086.64
- C10,000.00
- D5,742.11
- E7,392.48
Solution:
- By the Palindromic Annuity Identity, the stream has present value .
- At and :
- Multiply by the payment scale of 100:
Answer (D).
Why the other choices are wrong:
- (A) Uses and forgets the factor .
- (B) Uses , applying twice.
- (C) Ignores interest and adds the payments.
- (E) Doubles the value of the rising half, as if the falling half were worth the same.
Problem 12: Geometric Annuity Where Growth Rate Equals Interest Rate
A structured settlement pays 5,000 at the end of year 1, and each subsequent annual payment increases by for a total of 15 payments. If the valuation interest rate is an annual effective rate of , calculate the present value of the settlement at time .
- A51,474.92
- B48,561.24
- C75,000.00
- D79,500.00
- E70,754.72
Solution:
- Here , so every discounted payment is .
- Summing 15 identical discounted terms:
Answer (E).
Why the other choices are wrong:
- (A) Ignores the growth and values level payments at the start of each year.
- (B) Ignores the 6% growth and values a level 5,000.
- (C) Ignores interest and the growth, adding 15 payments of 5,000.
- (D) Multiplies by instead of dividing.
Problem 13: Biennial Payments Under Semiannual Compounding
A trust fund pays 2,500 at the end of every 2 years for 20 years (10 payments in total). Interest is credited at a nominal annual rate of convertible semiannually. Calculate the present value of the trust payments at time .
- A14,125.56
- B13,919.81
- C25,000.00
- D13,812.64
- E28,466.47
Solution:
- A 2-year payment period contains 4 semiannual compounding periods of rate .
- Compute the effective 2-year interest rate :
- Value the 10-payment annuity-immediate at rate :
Answer (D).
Why the other choices are wrong:
- (A) Uses for the 2-year rate instead of compounding.
- (B) Treats 6% as an annual effective rate, so the 2-year rate is .
- (C) Ignores interest and adds the 10 payments.
- (E) Pays 2,500 every year, 20 payments, instead of every 2 years.
Problem 14: Continuous Increasing Annuity
A continuous cash flow stream pays at a rate of per year at time for . The constant force of interest is . Calculate the present value of this cash flow stream at time .
- A4,924.16
- B4,715.54
- C5,274.88
- D6,400.00
- E1,318.72
Solution:
- Use the continuous increasing annuity formula with and :
- Substitute into :
- Multiply by 200:
Answer (A).
Why the other choices are wrong:
- (B) Uses for , treating as an effective rate.
- (C) Replaces the rising rate by its average 800 and values a level stream.
- (D) Ignores interest and integrates from 0 to 8.
- (E) Values a level rate of 200, forgetting that the rate grows with .
Problem 15: Balloon and Drop Payment Calculation
A borrower takes out a loan of 50,000 at an annual effective interest rate of , to be repaid by level annual payments of 6,000 at the end of each year for as long as necessary, plus a final smaller drop payment one year after the last regular payment. Calculate .
- A2,343.88
- B5,278.87
- C5,636.97
- D11,278.87
- E5,648.39
Solution:
- Find the number of full 6,000 payments :
Thus full payments of 6,000 are made at , and the drop payment occurs at .
- Accumulate the remaining balance after 12 payments to :
Answer (E).
Why the other choices are wrong:
- (A) Stops at the time-0 shortfall and never accumulates it to the drop date.
- (B) Accumulates the shortfall 12 years instead of 13.
- (C) Pays the fractional 0.946 of a regular payment, ignoring interest on the fractional period.
- (D) Adds the remainder to the 12th payment as a balloon instead of paying a drop at time 13.
Problem 16: Perpetual Scholarship Endowment Paid Every 3 Years
A university donor establishes an endowment today to pay a scholarship of 15,000 every 3 years forever, with the first scholarship awarded 3 years from today. If the endowment earns an annual effective interest rate of , calculate the required initial gift.
- A93,527.45
- B83,333.33
- C65,933.16
- D78,527.42
- E250,000.00
Solution:
- Compute the effective 3-year interest rate :
- Value the perpetuity-immediate of 15,000 per 3-year period:
Answer (D).
Why the other choices are wrong:
- (A) Values a perpetuity-due, with the first award today.
- (B) Uses for the 3-year rate instead of compounding.
- (C) Defers one extra 3-year period, putting the first award at year 6.
- (E) Divides by the annual rate although the payments are 3 years apart.
Problem 17: Ratio of to
At a constant annual effective interest rate , you are given that and . Calculate .
- A15.36
- B9.96
- C18.00
- D11.76
- E13.20
Solution:
- Use the factorization identity :
- Apply the three-block factorization identity :
Answer (D).
Why the other choices are wrong:
- (A) Squares instead of adding .
- (B) Adds itself to instead of .
- (C) Ignores discounting between the blocks, .
- (E) Extends the pattern linearly, adding again.
Problem 18:Equating Annuity-Due and Deferred Annuity-Immediate
For a given interest rate , the present value of an -year annuity-due of 1 per year equals times the present value of an -year annuity-immediate of 1 per year. Calculate the present value of a 10-year annuity-due of 500 per year at this same interest rate.
- A3,913.32
- B3,535.07
- C3,355.04
- D5,000.00
- E3,623.44
Solution:
- Since for any , the ratio directly reveals .
- Compute :
Answer (E).
Why the other choices are wrong:
- (A) Multiplies by a second time.
- (B) Takes 8% as the discount rate instead of the interest rate.
- (C) Values an annuity-immediate, .
- (D) Ignores interest and adds the 10 payments.
Problem 19: Continuous Level Annuity vs. Monthly Annuity-Immediate
At an annual effective interest rate of , calculate the ratio for any positive term .
- A1.0000
- B1.0406
- C1.0444
- D0.9964
- E1.0036
Solution:
- Write both formulas with the common numerator :
Notice that the term cancels completely!
- Evaluate and at :
- Compute the ratio:
Answer (E).
Why the other choices are wrong:
- (A) Assumes continuous and monthly payments are worth the same.
- (B) Compares an annual annuity-immediate with the monthly one, .
- (C) Uses instead of in the ratio.
- (D) Inverts the ratio, .
Problem 20: Varying Annuity With Level Plateau After Ramp-Up
An annuity-immediate pays 100 at the end of year 1, 200 at the end of year 2, , and 800 at the end of year 8. From year 9 through year 20 inclusive, the annuity pays a level 800 at the end of each year. At an annual effective interest rate of , calculate the present value of the 20-year stream.
- A7,542.52
- B13,200.00
- C6,896.19
- D7,313.98
- E9,969.77
Solution:
- Split the stream into scaled by 100 for years 1–8, plus a 12-year level annuity of 800 deferred by 8 years:
- Alternatively, notice the identity : let us compute both pieces directly at :
- Sum the two components:
Answer (A).
Why the other choices are wrong:
- (B) Ignores interest and adds the payments.
- (C) Uses instead of in .
- (D) Defers the level part 9 years instead of 8.
- (E) Pays a level 800 from year 1 and ignores the ramp-up.
Problem 21: A monthly pension
A Riverstone pension pays 1,800 at the end of every month for 15 years. Value it at an annual effective rate of .
- A224,200.61
- B230,227.45
- C229,293.28
- D324,000.00
- E227,619.44
Solution: With , . Answer (C).
Why the other choices are wrong:
- (A) Pays each year's 21,600 once at year end.
- (B) Pays at the start of each month.
- (D) Ignores interest and adds the payments.
- (E) Divides the annual effective rate by 12 instead of taking the 12th root.
Problem 22: A pension that rises each year
A pension pays 24,000 at the start of each year for 10 years, rising by a year. Value it at an annual effective rate of .
- A199,651.29
- B275,133.10
- C187,240.61
- D176,642.09
- E211,630.37
Solution: . Answer (E).
Why the other choices are wrong:
- (A) Pays at the end of each year.
- (B) Ignores interest and adds the rising payments.
- (C) Ignores the 3% increases.
- (D) Ignores both the increases and the advance timing.
Problem 23: A prize that starts later
Riverstone endows a teaching prize of 5,000 a year, forever, with the first prize paid at the end of year 6. Value it at an annual effective rate of .
- A82,270.25
- B78,352.62
- C127,628.16
- D100,000.00
- E74,621.54
Solution: . Answer (B).
Why the other choices are wrong:
- (A) Values a perpetuity-due after the deferral, which pays the first prize at year 5.
- (C) Accumulates over the deferral instead of discounting.
- (D) Ignores the deferral.
- (E) Defers one year too many.
9. Check it in code
def annuity_immediate(i: float, n: int) -> float:
return (1 - (1 + i) ** -n) / i
def increasing(i: float, n: int) -> float:
due = annuity_immediate(i, n) * (1 + i)
return (due - n * (1 + i) ** -n) / i
def by_summing(payments, i: float) -> float:
"""Brute force: discount each payment. Use it to check any closed form."""
return sum(p * (1 + i) ** -(t + 1) for t, p in enumerate(payments))
print(annuity_immediate(0.06, 12)) # 8.3838
print(100 * increasing(0.045, 15)) # 7715.60
print(by_summing([100 * k for k in range(1, 16)], 0.045)) # same answer, no formula neededExtended Algorithmic Verification Suite
"""
Module 2: Annuities Certain Numerical Engine
"""
import math
def annuity_immediate_pv(n: float, i: float) -> float:
"""PV of level annuity-immediate: a_n|i."""
v = 1.0 / (1.0 + i)
return (1.0 - v ** n) / i
def annuity_due_pv(n: float, i: float) -> float:
"""PV of level annuity-due: a_due_n|i."""
d = i / (1.0 + i)
v = 1.0 / (1.0 + i)
return (1.0 - v ** n) / d
def increasing_annuity_pv(n: int, i: float) -> float:
"""PV of increasing annuity-immediate: (Ia)_n|i."""
a_due = annuity_due_pv(n, i)
v = 1.0 / (1.0 + i)
return (a_due - n * (v ** n)) / i
def decreasing_annuity_pv(n: int, i: float) -> float:
"""PV of decreasing annuity-immediate: (Da)_n|i."""
a_imm = annuity_immediate_pv(n, i)
return (n - a_imm) / i
def geometric_annuity_pv(c: float, g: float, i: float, n: int) -> float:
"""PV of geometrically increasing annuity: payments C*(1+g)^(k-1)."""
if abs(i - g) < 1e-12:
return n * c / (1.0 + i)
v_ratio = (1.0 + g) / (1.0 + i)
return c * (1.0 - v_ratio ** n) / (i - g)
if __name__ == "__main__":
n_test = 10
i_test = 0.05
# Check identity: (Ia)_n + (Da)_n == (n+1)*a_n
ia = increasing_annuity_pv(n_test, i_test)
da = decreasing_annuity_pv(n_test, i_test)
sum_rule = (n_test + 1) * annuity_immediate_pv(n_test, i_test)
assert abs((ia + da) - sum_rule) < 1e-9, "Sum rule (Ia) + (Da) violated!"
# Check Palindromic Identity: a_n * a_due_n
a_imm = annuity_immediate_pv(n_test, i_test)
a_due = annuity_due_pv(n_test, i_test)
palindromic_prod = a_imm * a_due
# Direct cash flow sum for palindromic:
v = 1.0 / (1.0 + i_test)
direct_cf = sum(min(k, 2 * n_test - k) * (v ** k) for k in range(1, 2 * n_test))
assert abs(palindromic_prod - direct_cf) < 1e-9, "Palindromic identity violated!"
print("M2 Annuity Identities & Sum Rules Verified Successfully.")