Payment on a monthly loan with an partial first period (0 to 59 days). The cash flow convention is used.
Source: HP 17BII+ Financial Calculator User’s Guide. Ed. 2. Hewlett Packard. San Diego, CA 2004
# 2021-11-14 EWS # odd period from math import * print("Loan with partial period") print("0 - 59 days") print("Monthly Payments") n=float(input("N: n? ")) rate=float(input("I/YR: rate? ")) pv=float(input("PV: loan amt? ")) fv=float(input("FV: balooon pmt? ")) days=float(input("DAYS: odd period? ")) r=rate/1200 if days<30: j=1+r else: j=1 f=days/30-int(days/30) w=r*f+1 # uspv u=(1-(1+r)**(-n))/r # sppv s=(1+r)**(-n) pmt=(pv*w+fv*s)/(j*u) # rounding pmt=-int(pmt*100+.5)/100 # result print("Payment: "+str(pmt))