# Finding derivative of Matrix at different grid points using Finite difference methods/ Cholesky Factorization

I want to code this problem in MATLAB. It would be a huge help if someone can suggest to me how I can approach it. I need to solve the below-highlighted equation, I need dT/drho. For that, I need to solve for dRp/drho. I do have a dependence on rho but I don't have it explicitly. I have grid points, where I know the values ​​of T, P, dP/drho, Rp, Rp^T, Rq and Rq^T (which are all matrices at those grid points). I also know analytical P. How can I find dRp/drho? I do think of finite difference methods. However, I can't calculate dT/drho at the endpoints of the grid, I have to leave either starting or endpoint on the grid(by considering backward difference or forward difference method) Do I have to extend my grid in that case? or is it possible to code this in MATLAB using 'Cholesky factorization' or something? Because the text below mentions the "unique lower triangular solution" which made me think about 'chol' command in MATLAB. So, as I understand there are two ways to solve this problem. 1. Analytic solution using the below equation. 2. Finite difference method to find dT/drho avoiding all these equations.

I would like to understand from you whether it's possible to code these analytical equations. If not, how can I effectively use finite difference methods? Please feel free to ask questions if you are unclear about the question.

Thank you!

• It's really hard to follow your question. Please avoid posting pictures instead of writing or equation. We have LaTeX available here that you could write the equations. – Alone Programmer Jan 31 at 16:01

dP/drho = (dRp/drho)*Rp' + Rp*(dRp/drho)'

((dRp/drho)*Rp' + Rp*(dRp/drho)' -dP/drho) >=0