Search code examples
pythonoperatorsoperation

Operations for equivalent interest rates not giving expected result


I am trying to calculate equivalent interest rates like this site and while I believe I wrote all operations correctly I am not getting the same results as the site.

def equivalent_interest_rate(q,r,m):
    return q*((1+(r/m))**(m/q)-1)

print(equivalent_interest_rate(3,12,4))

Does anyone know why this is?


Solution

  • Pay attention to the order and the units.

    def equivalent_interest_rate(r,m,q):
        return q*((1+(r/m))**(m/q)-1)
    
    print(equivalent_interest_rate(0.03,12,4))
    

    -> 0.030075062499999028

    enter image description here