Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: Getting a desired vector from lsqr in python when solving a linear system
Post: Getting a desired vector from lsqr in python when ...

I am trying to solve a linear system which has multiple solutions. Here is part of my code: from scipy.sparse.linalg import lsqr solution = lsqr(M, b)[0] Now, if the matrix M is this: ...
SJ001 General Coding Help 0 2,422 Feb-21-2019, 04:19 PM
    Thread: Get the variables in a sympy expression
Post: RE: Get the variables in a sympy expression

(Feb-12-2019, 07:16 AM)ichabod801 Wrote: free_syms = sorted(eq1.free_symbols, key = lambda symbol: symbol.name)Thanks a lot! It's working!
SJ001 General Coding Help 8 7,255 Feb-12-2019, 07:25 AM
    Thread: Get the variables in a sympy expression
Post: RE: Get the variables in a sympy expression

(Feb-12-2019, 07:04 AM)ichabod801 Wrote: Then the 'Relational' in your error must refer to the elements of the set: x1 and x2. They are apparently not sortable, although I would expect a different e...
SJ001 General Coding Help 8 7,255 Feb-12-2019, 07:07 AM
    Thread: Get the variables in a sympy expression
Post: RE: Get the variables in a sympy expression

(Feb-12-2019, 06:57 AM)ichabod801 Wrote: print(type(eq1.free_symbols))It says: <class 'set'> Is there a more consistent way to read the variables in an expression?
SJ001 General Coding Help 8 7,255 Feb-12-2019, 07:00 AM
    Thread: Get the variables in a sympy expression
Post: RE: Get the variables in a sympy expression

(Feb-12-2019, 06:44 AM)ichabod801 Wrote: It looks like free_symbols is a set, which has no intrinsic ordering. If you want a consistent ordering you would need to convert it to a list and sort it (s...
SJ001 General Coding Help 8 7,255 Feb-12-2019, 06:49 AM
    Thread: Get the variables in a sympy expression
Post: Get the variables in a sympy expression

Hello! I have some equations which I read from a file, and then turn into sympy expressions and I need the variables that appear in each equation. However, for the purpose of my project, I need them i...
SJ001 General Coding Help 8 7,255 Feb-12-2019, 06:28 AM

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020