I am trying to put into practice the finite difference method using commons math 2.0. I am in reference to the following book: "Options, futures and other derivatives" by John Hull. I have attached a gif of page 445 of the 6th edition of the book. Note that I assume that the discretisation of the differential equation has already being achieved.

I am at a loss about how to NUMERICALLY resolve the system of equations in section (17.31). As I will have a system of M-1 equations each having three terms on the left-hand side member, it is not possible to use a square matrix.

Can anyone please point me to the relevant parts of the commons math API and give me clues as to how to numerically resolve the equation system please?

Thanks in advance,

Julien.