Re: [sympy] Re: Convert from a system of linear equations to a matrix

2015-11-13 Thread RCU
Hello. I was very happy to find this thread. I'm using the eqs2matrix(eqs, syms, augment=False) function provided in this thread earlier (see below), in order to take some equations I parsed and build a matrix I can then provide to the function solve_linear_system(resEqs2Matrix, xdst,

Re: [sympy] Re: Convert from a system of linear equations to a matrix

2015-10-10 Thread Jason Moore
This is only available in the development version of SymPy. It will be in the next release. You can install the development version if you want to run that. See: http://docs.sympy.org/0.7.6/install.html for info. Jason moorepants.info +01 530-601-9791 On Sat, Oct 10, 2015 at 5:05 AM, Riku Kivel

Re: [sympy] Re: Convert from a system of linear equations to a matrix

2015-10-10 Thread Riku Kivelä
Stupid question: How do I import this thing? I updated sympy using Anacondas command conda update sympy and this installed me sympy sympy.__version__ Out[14]: '0.7.6.1' I cannot import or use linear_eq_to_matrix sympy.solveset.linear_eq_to_matrix AttributeError: 'module' object has no attribu

Re: [sympy] Re: Convert from a system of linear equations to a matrix

2015-10-09 Thread Adam Leeper
> > Yeah, It's linear_eq_to_matrix in sympy.solvers.solveset. > Looks like it's just sympy.solveset.linear_eq_to_matrix. Thanks! Adam -- 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,

Re: [sympy] Re: Convert from a system of linear equations to a matrix

2015-10-08 Thread AMiT Kumar
Yeah, It's linear_eq_to_matrix in sympy.solvers.solveset. Example: >>> eqns = [x + 2*y + 3*z - 1, 3*x + y + z + 6, 2*x + 4*y + 9*z - 2] >>> A, b = linear_eq_to_matrix(eqns, [x, y, z]) >>> A Matrix([ [1, 2, 3], [3, 1, 1], [2, 4, 9]]) >>> b Matrix([ [ 1],

Re: [sympy] Re: Convert from a system of linear equations to a matrix

2015-10-07 Thread Jason Moore
We've just introduced a function called linsolve from the GSoC work this summer. It has the capability to do this. Jason moorepants.info +01 530-601-9791 On Wed, Oct 7, 2015 at 8:25 AM, Adam Leeper wrote: > Hi all- > > Interested party just wondering if there is any update on this. > > Cheers,

Re: [sympy] Re: Convert from a system of linear equations to a matrix

2015-10-07 Thread Adam Leeper
Hi all- Interested party just wondering if there is any update on this. Cheers, Adam On Tuesday, June 24, 2014 at 10:01:56 AM UTC-7, Aaron Meurer wrote: > > A multidimensional version of collect() would probably be the best > abstraction. > > Aaron Meurer > > On Sun, Jun 15, 2014 at 10:26 AM,

Re: [sympy] Re: Convert from a system of linear equations to a matrix

2014-06-24 Thread Aaron Meurer
A multidimensional version of collect() would probably be the best abstraction. Aaron Meurer On Sun, Jun 15, 2014 at 10:26 AM, James Crist wrote: > We certainly could. The question would then be what the scope of the method > should be. Should it only handle systems that can be expressed as Ax =

Re: [sympy] Re: Convert from a system of linear equations to a matrix

2014-06-15 Thread James Crist
We certainly could. The question would then be what the scope of the method should be. Should it only handle systems that can be expressed as Ax = b? Or should it behave like `CoefficientArrays ` mentioned above, and handle Ax

Re: [sympy] Re: Convert from a system of linear equations to a matrix

2014-06-14 Thread Aaron Meurer
Oh, of course. B is on the rhs. This is probably more natural to me too. Should we make a convenience function that does this? I think this use of jacobian would be lost on most people. Aaron Meurer On Sat, Jun 14, 2014 at 6:29 PM, James Crist wrote: > It's just the convention I'm most used to.

Re: [sympy] Re: Convert from a system of linear equations to a matrix

2014-06-14 Thread James Crist
It's just the convention I'm most used to. Systems that can be expressed as A*x = B I usually solve for x, or if A isn't square, the least squares solution x. In both cases you need A and B in this form. I suppose Ax + B could seem more natural though. On Friday, June 13, 2014 6:45:48 PM UTC-5

Re: [sympy] Re: Convert from a system of linear equations to a matrix

2014-06-13 Thread Aaron Meurer
That's a clever trick. I should have thought of that. Is there any reason you let system = A*x - B instead of A*x + B? The latter seems more natural. Aaron Meurer On Sat, Jun 7, 2014 at 12:28 AM, James Crist wrote: > I just answered this on gitter earlier today, but you can just take the > jaco

[sympy] Re: Convert from a system of linear equations to a matrix

2014-06-06 Thread James Crist
I just answered this on gitter earlier today, but you can just take the jacobian of the system to get its matrix form. For example: In [1]: from sympy import * In [2]: a, b, c, d = symbols('a, b, c, d') In [3]: x1, x2, x3, x4 = symbols('x1:5') In [4]: x = Matrix([x1, x2, x3, x4]) In [5]: syst

[sympy] Re: Convert from a system of linear equations to a matrix

2014-06-05 Thread Andrei Berceanu
Was this implemented into sympy at any point? It could be the equivalent of Mathematica's CoefficientArrays function. On Thursday, November 14, 2013 5:56:22 AM UTC+1, Chris Smith wrote: > > I forgot that as_independent, without the as_Add=True flag will treat Muls > differently. The following wi

[sympy] Re: Convert from a system of linear equations to a matrix

2013-11-13 Thread Chris Smith
I forgot that as_independent, without the as_Add=True flag will treat Muls differently. The following will be more robust: def eqs2matrix(eqs, syms, augment=False): """ >>> s [x + 2*y == 4, 2*c + y/2 == 0] >>> eqs2matrix(s, (x, c)) (Matrix([ [1, 0], [0, 2]]), Matrix([

[sympy] Re: Convert from a system of linear equations to a matrix

2013-11-13 Thread Chris Smith
On Thursday, October 10, 2013 7:49:14 PM UTC-5, Aaron Meurer wrote: > > Is there a function in SymPy that makes it easy to convert from a > system of linear equations in symbolic form to a Matrix? I'm asking > because solve_linear_system takes a Matrix as input. > > You can just pass the syste

Re: [sympy] Re: Convert from a system of linear equations to a matrix

2013-10-24 Thread Cristóvão Duarte Sousa
Hi Aaron, Sorry for the late reply. Yes, the lin_expr_coeffs function can be extended to accept a linear equation system. Feel free, anyone, to take it and make a PR. If I find some time I can do it, but that will not happen soon... On Fri, Oct 11, 2013 at 6:20 PM, Aaron Meurer wrote: > That's u

Re: [sympy] Re: Convert from a system of linear equations to a matrix

2013-10-11 Thread Aaron Meurer
That's useful, we should put that in SymPy, though I personally think it would be more useful if it just took a system and returned a matrix. Aaron Meurer On Fri, Oct 11, 2013 at 4:59 AM, Cristóvão Duarte Sousa wrote: > Hi Aaron, > > I've found Expr.as_coefficients_dict() method useful for that,

[sympy] Re: Convert from a system of linear equations to a matrix

2013-10-11 Thread Cristóvão Duarte Sousa
Hi Aaron, I've found Expr.as_coefficients_dict() method useful for that, although I had to workaround constant and single variable expressions. Check the function lin_expr_coeffs ( https://github.com/cdsousa/PyLMI-SDP/blob/master/lmi_sdp/lm.py#L27) of my PyLMI-SDP package, to see how I used it.