Hi all,
I was trying to figure out how does BackSolve work. Does anyone have experience on this?
I thought it should be solving M*x = b. (given M and b solve x)
https://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_Geometry_Matrix_BackSolve.htm
First reduce M to upper triangular with unit diagonal matrix.
M.RowReduce(0, b)
x = M.BackSolve(0, b)
and it suppose return x?, but it doesn’t seem to give me the correct result after comparing with MatLab solver.
Am I doing anything wrong? Is there any other better way of doing Matrix calculation in Rhino?
Regards,
Jason
https://trace.tennessee.edu/cgi/viewcontent.cgi?article=1081&context=utk_gradthes
BTW: Practice is closed (so I don’t have access to my things) plus I’m in vacations … but found this entry level linear solver in the laptop. Obviously you can modify it in order to work with any Matrix.
Linear_Equations_Solver_V1.gh (120.7 KB)
Thanks Peter!
So does that mean we cannot use BackSolve in RhinoCommon?
jason.chen:
we cannot use
No but it does mean that you can have a look on the insides (if you are familiar with C#).
Is there anyone else can help me with this? Any reason why BackSolve doesn’t work the way we wanted?
Since you haven’t uploaded your file:
For some reason it is working on my machine.
1 Like
Sorry I didn’t upload the file. Please find below file as attached.
backsolve.gh (5.7 KB)
Thanks. This is strange, it seems exactly the same. Can you kindly help try out the one I had?..not sure why it’s not working.
I just noticed I have a typo in my M matrix.
2,2 where I have -1 instead of 2:
your matrix with the 2 results in the following:
Since the rank is 4, the matrix you have is not solvable by this method.
I think there might be something wrong with the row reduce.