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)
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))