Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试计算 python 中的抵押贷款利率。
我有以下公式。a/{[(1+r)^n]-1}/[r(1+r)^n]=p
这里我有 a ,n , p 的值。
是否可以在 python 中使用这些值计算 r。任何指针都会有所帮助。
你可以看看 Sympy 包,它可能会有所帮助。
from sympy.solvers import solve from sympy import Symbol x = Symbol('x') solve(x**2 - 1, x)
将 x**2 - 1 替换为关于 r 的方程(将 p 移到左侧)。