<t>Hello,There seems to be an issue with discounting.The line of code almost at the end: discValue = discValue + CashFlow(i, j)*exp(-0.06*j);should include the time spacing parameter dt discValue = discValue + CashFlow(i, j)*exp(-0.06*j*dt);Below a simple implementation of LSM algo in Python.Yves </t>