[sympy] sympify(MutableMatrix) -> ImmutableMatrix

2013-11-07 Thread Carsten Knoll
Hi all, I just stumbled on the following behavior: >>> type(eye(2)) >>> type(sympify(eye(2))) Is this supposed to work that way or is it a (minor) Bug? Best regards, Carsten -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe

[sympy] sympify breaks duck typing

2012-05-11 Thread krastanov.ste...@gmail.com
How about adding a check for a _sympify_ attribute in the sympify routine. It will permit 3rd party classes usage in sympy. At the moment if someone want something nontrivial, he needs to add it to sympify. But this is not pythonic. In python just having the same interface should be enough. It wil

Re: [sympy] sympify

2012-02-15 Thread Aaron Meurer
Note that internally, the expression actually is expressed this way: In [54]: print S("x1^-1*x2^-1").args (1/x1, 1/x2) In [55]: srepr(S("x1^-1*x2^-1")) Out[55]: Mul(Pow(Symbol('x1'), Integer(-1)), Pow(Symbol('x2'), Integer(-1))) It's only the printer that represents it as 1/(x1*x2), which is don

Re: [sympy] sympify

2012-02-14 Thread Chris Smith
When symbols are non-commutative they will always appear with negative exponent: >>> var('A B', commutative=False) >>> 1/A/B A**(-1)*B**(-1) Beyond this, I'm not sure of an option other than symbol-trickery (or writing your won printer): >>> a=symbols('(-1)') >>> y**a y**(-1) .c -- You receiv

[sympy] sympify

2012-02-14 Thread Akin
Hi, sympifying the expressions "x1^-1*x2^-1" gives "1/(x1*x2)" which is of course correct, but I was wondering whether one can tell sympify to write it as "x1**(-1)*x2**(-1). I am using the expression in a context where the latter form would be more appropriate. Best, Akin -- You received this

Re: [sympy] sympify with embedded strings ?

2011-08-31 Thread Aaron Meurer
Thanks for reporting this. Can you open an issue in our issue tracker (http://code.google.com/p/sympy/issues/list) for it? I bisected the regression to the commit commit d00c8b214520604fb65bde426cbaf4f4b30dbba0 Author: Mateusz Paprocki Date: Tue Jun 7 01:55:11 2011 -0700 Use new parse_ex

[sympy] sympify with embedded strings ?

2011-08-30 Thread Roberto Colistete Jr.
Hi, I was using SymPy 0.6.7 (on Ubuntu, etc) and now I have installed version 0.7.1. Until SymPy v0.6.7, the following was working well : sympify(u'Limit(sin(x),x,0,dir=\"-\")') But with SymPy 0.7.0 or 0.7.1, it gives "SympifyError: SympifyError: 'could not parse u\'Limit(sin(x),x,

Re: [sympy] sympify with assumptions?

2011-08-12 Thread Aaron Meurer
It could be useful to be able to pass assumptions to sympify which would be applied to any symbols created. Open an issue for it if you want it. Note that this could have unintendent consequences. If you pass a locals() dict to sympify, e.g., sympify(somestr, locals=locals()), then any symbols i

Re: [sympy] sympify with assumptions?

2011-08-11 Thread Mateusz Paprocki
Hi, On 12 August 2011 04:51, Tomo Lazovich wrote: > Hi sympy-folk, > > If I want to sympify some strings to get symbols from them, but I'd also > like to have assumptions along with those symbols (in this case, that they > are real). Is it possible to pass along assumptions to sympify like you >

[sympy] sympify with assumptions?

2011-08-11 Thread Tomo Lazovich
Hi sympy-folk, If I want to sympify some strings to get symbols from them, but I'd also like to have assumptions along with those symbols (in this case, that they are real). Is it possible to pass along assumptions to sympify like you could to symbols? Thanks! Tomo -- You received this message

Re: [sympy] sympify wolfram alt text failed

2010-12-17 Thread Aaron S. Meurer
There is already some function in sympy/parsing/mathematica.py that is supposed to handle the spaces. As far as I remember, though, it isn't integrated in sympify, (and also it could use some improvement). +1 for better parsers for other computer algebra systems. A good Maple parser would b

[sympy] sympify wolfram alt text failed

2010-12-17 Thread smichr
I copied an alt field of the expression displayed at wolfram alpha. It contained escaped slashes so S() failed. Perhaps S could filter those out: h[5] >>> S('1\/2') Traceback (most recent call last): File "", line 1, in File "sympy\core\sympify.py", line 214, in sympify return ast_parser.

[sympy] sympify and lists/tuples/Matrices

2008-06-11 Thread Ondrej Certik
Hi, I think sympify should work on tuples, lists and Matrices and just return tuples, lists and Matrices, with elements converted to sympy expressions. See: http://code.google.com/p/sympy/issues/detail?id=883 What do you think? Ondrej --~--~-~--~~~---~--~~ You

[sympy] sympify and matrices

2008-06-05 Thread Robert Cimrman
Hi, In [16]: sympy.__version__ Out[16]: '0.5.15-hg' In [19]: K = sympy.Matrix(nm.array(1, ndmin = 2)) In [20]: sympy.sympify(K) ... NotImplementedError: matrix support Is there a reason for this? Why a Matrix instance is not just passed along, since it is already a sympy object? Then, what is