MATLAB: Using inv(A)*B instead of A\B

differential equationsMATLABode45odefunctionsymbolicsymbolic mathssymbolic toolbox

I am trying to solve some differential equations numerically. I followed the steps in this documentation
So, I got the 'M' and the 'F' matrices. There are 33 equations, and they are quite long in length. Dimensions of M are 33×33, those of F are 33×1. I am stuck at the step
f = M\F;
I think due to long expressions and many variables, my Matlab stops responding. However, I read in the 'mldivide,\' documentation that
'If A is a square matrix, then A\B is roughly equal to inv(A)*B, but MATLAB processes A\B differently and more robustly.'
I tried doing f = inv(M)*F, and it took almost no time. I got my results pretty quick.
I wanted to know if changing that step would have any major consequences on the results. Can I use 'inv(M)*F' instead of 'M\F', if the former one gives me results faster? Since I don't really know what the results should look like, I have no way of validating whether they are correct. I just want to know if changing this step does not alter the result majorly.
Thank you

Best Answer

In the case where you know that M is the square identity matrix with the same number of columns as F has rows, then you can skip f = M\F and go directly to f = F; . That is because in the case of a square matrix the definition of the M\F operator is "as if" inv(M)*F except with higher numeric precision, and you can be sure that inv() of an identity matrix is the same as the identity matrix, leaving you the identity matrix times F, which is going to be just F.
I will create a support case to recommend an improvement to the detection algorithm to make this situation faster.