algorithmic modeling for Rhino
I would like to solve a system of linear equations, such as four equations with four unknowns. basically, I want to solve a matrix. Is this possible in Python component of grasshopper?
Thanks
Tags:
Well then this isn't a Grasshopper question. Normal common English questions posed to Google nearly always results in hits for various Amazon.com-like pages of review of answers for such questions, for any computer language like Python.
Google: system of linear equations Python
https://www.google.com/search?q=system+of+linear+equations+Python&a...
Oh, crap, sorry, it needs the popular Numpy library that you can NO LONGER successfully install in Rhino/Grasshopper due to their use of free "open source" .NET shackled IronPython abandonware ( http://www.grasshopper3d.com/forum/topics/scipy-and-numpy ).
So avoid answers that need Numpy.
Many hits also mention Scipy, the other popular math library. That's not even remotely possibly to install in Rhino/Grasshopper.
Here is one goo answer, where a dedicated user plays it out, then some cocky dude shows up with Numpy:
http://code.activestate.com/recipes/578024-solve-simultaneous-linea...
Thanks for the reply. I actually wanted to know if there is any other way than Numpy and Scipy, since I cannot instally these. It seems that the only solution is whether writing our own solver or using one already writing by someone. I found these two in case someone is interested:
http://martin-thoma.com/solving-linear-equations-with-gaussian-elim...
http://ine.scripts.mit.edu/blog/2011/05/gaussian-elimination-in-pyt...
Hi Lluis, you might want to have a look at the Math.NET library. It looks like it should be capable of doing what you need. Since it's a .NET library it should be possible to implement it in IronPython (the Python version that's used by Rhino). Would be nice with an alternative to Numpy, perhaps this could be an option. Best of luck.
Thanks for the suggestion. I will keep this in mind. In the end, this time, I will not need a math library.
Ah now I see, it was your second link to the pure Python method that worked. Glad it worked out ;)
The solver from the second link works good for me. It just gives me an error ("attempted to divide by "0") if the matrix starts with "0". But in my case, I might be able to live with that...
Nice! I'd love to hear more about your experience with implementing the library if/when you've fiddled with it some more :)
My limited knowledge on linear algebra did not see it before, but now I remember that it is possible to swap the lines of your matrix and put the one starting with "0" not as a first line. So, with this I conclude this threat: yes, with the code provided by Isaac Evans it is possible to easily calculate linear systems of equations in Python or Grasshopper python without the need of installing Numpy, Scipy, etc...
Hi Lluis, hi all,
I wrote a tutorial about using Math.Net Numerics to solve linear equations in GhPython. This should give an idea about how to access its functionality. Otherwise, please feel free to ask.
I hope this is helpful,
Giulio
--
Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 2 Likes
© 2019 Created by Scott Davidson. Powered by