(09-29-2021 12:34 AM)Claudio L. Wrote: (09-25-2021 05:45 PM)JoJo1973 Wrote: I'm collecting examples beginning from this old post
https://www.hpmuseum.org/forum/thread-97...#pid101856
but when I began experimenting I've found some difficulties: for example I can't get to solve this linear system:
a + x - 3 y + z = 2
-5 a + 3 x - 4 y + z = 0
a + 2 y - z = 1
a + 2 x = 12
(courtesy of Wolfram Alpha)
The solution is a=22/17 x=91/17 y=84/17 z=173/17 but MSOLVE can't converge: I've used {0 0 0 0} {12 12 12 12} as searching range and I got {0 0 0 0} and {-2 0 -1 -12} as residuals
If I constrain the four variables to be >0 I get {2.9999... 5.9646... 6.2512... 15.2711...} (I don't include the residuals.
I've also tried inverting the order of the searching range or adding >0 constraints, but to no avail.
A system of three equations fails to converge too, but a 2 equation system seems to work.
Fixed. I'll see if I can release an update on all ROMs over the weekend so you can start playing with it some more. There was an arbitrary constant in the method that decides how far you go down the gradient and a bug left it too large, so it was throwing the algorithm way off by suggesting a point far from the area being investigated.
Now it converges nicely for your example. Never fails regardless of input, as it should be on a linear system with a unique solution, I threw in a couple of squares and cubes to make it nonlinear and it converged quick too to a valid solution but I did not investigate different inputs to make it converge to other solutions, let's leave it at "it probably works".
I started writing one example at the wiki, but it's so bad that I'd be glad if you take over that writeup altogether. Feel free to replace it completely.
There's one thing I'm not happy about my MES: it doesn't work with units yet but I plan to make it so. Hopefully without making it horribly slow (it's not exactly fast right now but it's one of the more reliable methods out there nowadays).
Cool! I'm almost done with a piece about the numerical integrator, MSOLVE will be next!