In [3]:
from sympy import *
init_printing()
from IPython.display import display
var('fv pv pmt np ir')
vt = (fv,pv,pmt,np)
eq = Eq(fv,(-ir*pv*(ir + 1)**np - pmt*(ir + 1)**np + pmt)/ir)
fdic = {}
for v in vt:
    sol = Eq(v,solve(eq,v)[0])
    display(sol)
    vl = list(vt)+[ir]
    vl.remove(v)
    fdic[v] = Lambda(vl,sol.rhs)
$$fv = \frac{1}{ir} \left(- ir pv \left(ir + 1\right)^{np} - pmt \left(ir + 1\right)^{np} + pmt\right)$$
$$pv = \frac{1}{ir} \left(ir + 1\right)^{- np} \left(- fv ir - pmt \left(ir + 1\right)^{np} + pmt\right)$$
$$pmt = - \frac{ir \left(fv + pv \left(ir + 1\right)^{np}\right)}{\left(ir + 1\right)^{np} - 1}$$
$$np = \frac{\log{\left (\frac{- fv ir + pmt}{ir pv + pmt} \right )}}{\log{\left (ir + 1 \right )}}$$
In [2]:
fvr = fdic[fv](0,-100,120,.01)
pvr = fdic[pv](fvr,-100,120,.01)
pmtr = fdic[pmt](fvr,0,120,.01)
npr = fdic[np](fvr,0,-100,.01)
print("%.2f %.2f %.2f %.2f" %  (fvr,pvr,pmtr,npr))
23003.87 -0.00 -100.00 120.00