# Matrix operations - linear equations

Hello
I am trying to do simple matrix operations, to solve linear equations like

z1 * 5 + z2 * 1551 + z3 * 15 = 1557
z1 * 149 + z2 * 19 + z3 * 19= 159
z1 * 0 + z2 * 550 + z3 * 50 = 505
z1 + z2 + z3 = 1

z1 = ?
z2 = ?
z3 = ?

Any idea ?
Look like i could use LU decomposition with SciPy or numpy but how …?

Enthought has made some SciPy and NumPy packages for .NET here. I haven’t tested them with Dynamo, but they’re made specifically for IronPython so in theory they should work.

EDIT: In theory it should work. It doesn’t work in Dynamo (as stated below), but for a different reason. I was able to successfully install Enthought’s IronPython version of numpy and scipy, but was not able to get it to work in Dynamo.

I’ve been able to successfully load the NumpyDotNet DLL in Dynamo, but once I try to import numpy, it raises the following exception:

Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.
Traceback (most recent call last):
File "<string>", line 12, in <module>
File "C:\Program Files (x86)\IronPython 2.7\Lib\site-packages\numpy\__init__.py", line 155, in <module>
File "C:\Program Files (x86)\IronPython 2.7\Lib\site-packages\numpy\core\__init__.py", line 6, in <module>
File "C:\Program Files (x86)\IronPython 2.7\Lib\site-packages\numpy\core\multiarray.py", line 11, in <module>
File "<string>", line 11, in <module>
File "C:\Program Files (x86)\IronPython 2.7\Lib\site-packages\numpy\__init__.py", line 155, in <module>
File "C:\Program Files (x86)\IronPython 2.7\Lib\site-packages\numpy\core\__init__.py", line 6, in <module>
File "C:\Program Files (x86)\IronPython 2.7\Lib\site-packages\numpy\core\multiarray.py", line 11, in <module>
File "<string>", line 12, in <module>
File "C:\Program Files (x86)\IronPython 2.7\Lib\site-packages\numpy\__init__.py", line 155, in <module>
File "C:\Program Files (x86)\IronPython 2.7\Lib\site-packages\numpy\core\__init__.py", line 6, in <module>
File "C:\Program Files (x86)\IronPython 2.7\Lib\site-packages\numpy\core\multiarray.py", line 11, in <module>
File "<string>", line 8, in <module>
File "C:\Program Files (x86)\IronPython 2.7\Lib\site-packages\numpy\__init__.py", line 155, in <module>
File "C:\Program Files (x86)\IronPython 2.7\Lib\site-packages\numpy\core\__init__.py", line 6, in <module>
File "C:\Program Files (x86)\IronPython 2.7\Lib\site-packages\numpy\core\multiarray.py", line 11, in <module>
File "<string>", line 8, in <module>
File "C:\Program Files (x86)\IronPython 2.7\Lib\site-packages\numpy\__init__.py", line 155, in <module>
File "C:\Program Files (x86)\IronPython 2.7\Lib\site-packages\numpy\core\__init__.py", line 6, in <module>
File "C:\Program Files (x86)\IronPython 2.7\Lib\site-packages\numpy\core\multiarray.py", line 11, in <module>
File "<string>", line 9, in <module>
File "C:\Program Files (x86)\IronPython 2.7\Lib\site-packages\numpy\__init__.py", line 155, in <module>
File "C:\Program Files (x86)\IronPython 2.7\Lib\site-packages\numpy\core\__init__.py", line 6, in <module>
File "C:\Program Files (x86)\IronPython 2.7\Lib\site-packages\numpy\core\multiarray.py", line 11, in <module>
File "C:\Program Files (x86)\IronPython 2.7\Lib\site-packages\scipy\__init__.py", line 78, in <module>
File "<string>", line 9, in <module>
File "C:\Program Files (x86)\IronPython 2.7\Lib\site-packages\numpy\__init__.py", line 155, in <module>
File "C:\Program Files (x86)\IronPython 2.7\Lib\site-packages\numpy\core\__init__.py", line 6, in <module>
File "C:\Program Files (x86)\IronPython 2.7\Lib\site-packages\numpy\core\multiarray.py", line 11, in <module>
SystemError: The type initializer for 'NumpyDotNet.NpyCoreApi' threw an exception.

numpy.dyn (5.0 KB)

1 Like

I believe Numpy doesn’t work with Dynamo, don’t ask me why but someone else thought so too… Add .dll reference to get the Intellisense

Hope that’s of interest,

Mark

Edit: better link… IronPython 2.7 for Dynamo

1 Like