Hard system of symbolic equations

63 views
Skip to first unread message

Andrea Fresu

unread,
Sep 5, 2014, 12:12:14 PM9/5/14
to sy...@googlegroups.com
Hello,
I have to solve a classic system: Ax=b
where
A is a matrix 100*100 of numerical values
b is a vector whose components are hard symbolic expressions with up to 15 differents symbols

I'm using A.LUsolve(b)

This problem is time and ram consuming,  is there some suggestion that you can give to address this problem in an optimal manner?
In particular I noticed from system monitor that only 1 CPU is working,  is there a way to use all the cores?


Thank you very much,
Andrea Fresu

Jason Moore

unread,
Sep 5, 2014, 12:22:00 PM9/5/14
to sy...@googlegroups.com
Is A dense or sparse?

Solving a linear system of 100 equations and 100 unknowns is not something that symbolic solvers are generally good at. For example, I don't think you aren't guaranteed to  have good numerical conditioning for the expressions for x. Is it required that you have symbolic expressions for the values of x? If not then you should probably look to numerical solvers like those available in SciPy.

--
You received this message because you are subscribed to the Google Groups "sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sympy+un...@googlegroups.com.
To post to this group, send email to sy...@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/242af9f7-dd38-4dea-9bc1-204ec1ce36d5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Andrea Fresu

unread,
Sep 5, 2014, 12:28:34 PM9/5/14
to sy...@googlegroups.com
A is dense and symbolic expressions are required for the values of x.
No way.. 
However what about that only 1 CPU is working?
 

Jason Moore

unread,
Sep 5, 2014, 12:33:57 PM9/5/14
to sy...@googlegroups.com
The matrix solvers are not implemented with parallel algorithms.

--
You received this message because you are subscribed to the Google Groups "sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sympy+un...@googlegroups.com.
To post to this group, send email to sy...@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.

Andrea Fresu

unread,
Sep 5, 2014, 12:37:31 PM9/5/14
to sy...@googlegroups.com
Ok, Thank you Jason!

Joachim Durchholz

unread,
Sep 5, 2014, 1:25:34 PM9/5/14
to sy...@googlegroups.com
Am 05.09.2014 um 18:33 schrieb Jason Moore:
> The matrix solvers are not implemented with parallel algorithms.

Worse, Python isn't built for parallelism.
There's a variant called Parallel Python, but it's not mainstream.

Andrea Fresu

unread,
Sep 11, 2014, 8:13:59 AM9/11/14
to sy...@googlegroups.com
I got better results using numpy to calculate the inverse of A, casting the result inside a sympy matrix, and then performing the product.
Using joblib you can easily implement a parallel solution to do the product between matrix and vector

I hope this helps! Bye!
Reply all
Reply to author
Forward
0 new messages