0
pv = float(input("Enter your present value here: "))
pmt = float(input("Enter your periodic payment in an annuity(PMT) here: "))
i = float(input("""Enter your periodic interest rate as decimal number 
ex: 30% = 0.3
Enter your periodic interest rate here: """)
npgpv = -math.log( 1 - ( ( 1 * pv ) / pmt ) ) / math.log( 1 + i ) 
print("Result: ", npgpv)

it's giving me fallowing error:
npgpv = -math.log( 1 - ( i * pv ) ) ValueError: math domain error

What can I do to calculate this formula ?

1 Answers1

0

I think that the error is caused because you are trying to get the log of a negative number; see https://stackoverflow.com/a/15890593/13314450

CircuitSacul
  • 1,594
  • 12
  • 32