Hidden WordScanner
Private scans · No account required

DuckieDai Compound Interest

Solve compound and continuous interest problems: find the final amount, compare two rates, find the starting amount, or find the time needed.

exponential functions · MIT License

Overview

Solve compound and continuous interest problems: find the final amount, compare two rates, find the starting amount, or find the time needed.

  • Owner-tested on a TI calculator
  • Version 1.0.0
  • 1551 bytes
  • Uses math

Before you run it

  • TI-84 Plus CE Python · No calculator OS or Python App version has been verified.
  • TI Connect CE .py transfer to the Python App; the owner's transfer details were not recorded
  • Interest follows A = P(1+r/n)^(nt), or A = Pe^(rt) when n is 0.
  • The rate and compounding stay the same for the whole period.
  • n cannot be negative; the program asks again until it is 0 or more.

Try the DuckieDai calculator screen

Follow the program's prompts and result flow before downloading.

JavaScript is required for the optional browser simulation. Source viewing and downloading remain available without it.

Simulation boundary: This preview uses a reviewed browser adapter. It does not execute the downloaded Python and does not prove TI-Python or calculator compatibility.

Learn the maths

What compound interest is

The idea

Compound interest is interest that earns interest. Each time interest is added, it joins the balance, and the next round of interest is worked out on the new, larger balance. Simple interest, by comparison, is only ever worked out on the amount you started with.

Example: $1,000 at 5% a year for 10 years grows to $1,500.00 with simple interest, and to $1,628.89 when the interest is compounded once a year.

The formula

A = P(1 + r/n)^(nt)

A
the final amount
P
the starting amount, also called the principal
r
the yearly interest rate as a decimal, so 5% is 0.05
n
how many times a year interest is added
t
the time in years

When interest is added continuously, the formula becomes:

A = Pe^(rt)

Common values of n: yearly 1, semiannual 2, quarterly 4, monthly 12, weekly 52, daily 365. In this program, type 0 for continuous.

What each menu choice does

Type the rate as a percent: 5 means 5%. Any number can also be typed as a fraction, such as 1/2 for half a year.

Worked examples

Find the amount: $1,000 at 5%, compounded monthly, for 10 years. Choose 1 and enter P = 1000, rate = 5, n = 12, years = 10.

A = 1000(1 + 0.05/12)^(12*10) = $1647.01

The program shows A = $1647.01 and Interest = $647.01. With n = 0 (continuous) the same inputs give A = $1648.72.

Find the time: how long does $1,000 take to reach $2,000 at 6%, compounded monthly? Choose 4 and enter P = 1000, A = 2000, rate = 6, n = 12. The program shows t = 11.5813 years.

Exact reviewed bytes

Source code

Download .py

View source below, copy it when JavaScript is available, or download the exact .py bytes.

  1. from math import exp,log
  2. def P(s=""):
  3. input(s+"\nPress enter ")
  4. print("\n"*7)
  5. def N(p):
  6. while 1:
  7. s=input(p)
  8. try:
  9. if "/" in s:
  10. u,v=s.split("/")
  11. return float(u)/float(v)
  12. return float(s)
  13. except Exception:
  14. print("Enter a number.")
  15. def R():
  16. r=N("rate %? ")/100
  17. n=-1
  18. while n<0:
  19. n=N("n/yr (0=cont)? ")
  20. return r,n
  21. def G(r,n,t):
  22. if n:return (1+r/n)**(n*t)
  23. return exp(r*t)
  24. def M(v):
  25. return "$"+str(round(v,2))
  26. def S(r,n):
  27. if n:return "A=P(1+r/n)^(nt)"
  28. return "A=Pe^(rt)"
  29. print(" Interest\n __\n ___(o )> quack!\n \\ <_. )\n `---'\n by DuckieDai\nhiddenwordscanner.com")
  30. P()
  31. c=""
  32. while c!="6":
  33. print("1:Find amount A\n2:Compare 2 rates\n3:Find start P\n4:Find time t\n5:n values help\n6:Quit")
  34. c=input("Choice? ")
  35. print("\n"*7)
  36. if c=="1":
  37. p=N("P? ")
  38. r,n=R()
  39. t=N("years? ")
  40. a=p*G(r,n,t)
  41. P(S(r,n)+"\nA = "+M(a)+"\nInterest = "+M(a-p))
  42. elif c=="2":
  43. p=N("P? ")
  44. t=N("years? ")
  45. print("OPTION 1")
  46. r,n=R()
  47. a=p*G(r,n,t)
  48. print("OPTION 2")
  49. r,n=R()
  50. b=p*G(r,n,t)
  51. print("\n1: "+M(a)+"\n2: "+M(b))
  52. if a==b:s="Same amount"
  53. else:s="Option "+("1" if a>b else "2")+" is larger\nby "+M(abs(a-b))
  54. P(s)
  55. elif c=="3":
  56. a=N("A? ")
  57. r,n=R()
  58. t=N("years? ")
  59. P("P = "+M(a/G(r,n,t)))
  60. elif c=="4":
  61. p=N("P? ")
  62. a=N("A? ")
  63. r,n=R()
  64. try:
  65. P("t = "+str(round(log(a/p)/log(G(r,n,1)),4))+" years")
  66. except Exception:
  67. P("No solution.")
  68. elif c=="5":
  69. P("n = times per year\nyearly 1\nsemiannual 2\nquarterly 4\nmonthly 12\nweekly 52\ndaily 365\ncontinuous 0")
  70. print("DuckieDai says:\ndone!")
Filename
COMINT.py
Size
1551 bytes
SHA-256
b78522422d7313cde07597c14d053d475015d4fed1d42c7522874d48d06b9c81

Usage

Inputs

  • One menu choice from 1 to 6
  • Starting amount P or final amount A
  • Annual rate as a percent
  • Compounding periods per year n (0 for continuous)
  • Time in years

Outputs

  • Final amount A and interest earned, with the formula used
  • The larger of two rate options and the difference
  • Starting amount P
  • Time t in years

Units: Money amounts are shown with a dollar sign and rounded to cents; rates are percents per year; time is in years.

Assumptions and limitations

Assumptions

  • Interest follows A = P(1+r/n)^(nt), or A = Pe^(rt) when n is 0.
  • The rate and compounding stay the same for the whole period.

Constraints

  • n cannot be negative; the program asks again until it is 0 or more.
  • Numbers may be typed as decimals or as a fraction such as 1/3.

Known failures

  • Find time reports No solution when the rate is 0, or when A and P do not allow a real answer.
  • Extremely large rates or times produce a number too large for the calculator and stop the program with an error.
  • A menu choice other than 1 to 6 shows the menu again.

Compatibility and review

Review status
Owner-tested on a TI calculator
Tested on
Owner reports personally using this program on a TI-84 Plus CE Python calculator for coursework; the test date, OS version, and Python App version were not recorded
What happened
Owner reported pass on the calculator. Only the line endings were normalised for publication; the program text is unchanged. This exact file has not yet been rerun on a calculator.
Dependencies
math
Suggested calculator name
COMINT — you can give it another valid, unique name when you transfer it
Desktop test cases
Not available for this interactive-only source

This exact source auto-launches an interactive calculator session, so compatibility evidence comes from the recorded physical-device review rather than an importable desktop fixture.

Transfer and launch

  1. Confirm that your calculator is the Python-capable model named above. This release has no verified calculator OS or Python App version; treat transfer and execution as unverified until independently tested.
  2. Download the .py source above and verify its SHA-256 digest if your computer provides that option.
  3. Use TI Connect CE to send the Python file to a compatible calculator. COMINT is a suggested name; you may choose another valid, unique calculator name.
  4. Open the Python App, select the program, and check sample inputs before relying on other results.

Read the complete installation, launch, troubleshooting, and removal guide.

Availability does not mean a teacher, school, or exam permits this program. Follow the applicable rules.

Version history

Any source change requires a new immutable version and digest. Historical downloads remain available only while their review records remain valid.

Independent compatibility resource: Hidden Word Scanner is independent and is not affiliated with or endorsed by Texas Instruments. TI product names describe compatibility only.

Action-count privacy: Successful downloads, preview starts, and preview completions increment same-origin aggregate counters. No entered values, source text, IP address, account, cookie, device identifier, or fingerprint is stored with these counts.