Re: [sympy] logic module: stop silently transforming expressions?

2012-07-26 Thread Alex
Seems good to me. I'm just a little unsure about what counts as a "most trivial simplification". Do you count A | ~A <=> True as a trivial simplification the constructor should do? Isn't that potentially going to confuse the user? To me, a boolean expression as inputed, and its simplified form a

Re: [sympy] logic module: stop silently transforming expressions?

2012-07-26 Thread Aaron Meurer
On Thu, Jul 26, 2012 at 8:37 PM, Alex wrote: > As mentioned in my previous post, I'm working on a simplify function > for Boolean (and eventually relational) objects. The idea is to have the > following behavior: > >>> simplify(A|((C|B)&A)) > A > >>> simplify(((A>>B) & (B>>C)) >> (A>>C)) #proving

[sympy] logic module: stop silently transforming expressions?

2012-07-26 Thread Alex
As mentioned in my previous post, I'm working on a simplify function for Boolean (and eventually relational) objects. The idea is to have the following behavior: >> simplify(A|((C|B)&A)) A >> simplify(((A>>B) & (B>>C)) >> (A>>C)) #

Re: [sympy] code generation and simplification

2012-07-26 Thread Matthew Rocklin
SymPy may be able to help by counting operations in a given expression. I don't think you want it controlling the optimization search though. I'm not very familiar with the relevant modules but I don't think it will be easy to perform this optimization within SymPy. To the best of my knowledge It

Re: [sympy] code generation and simplification

2012-07-26 Thread Aaron Meurer
One thing you can try is to use the cse() function to group common subexpressions so that they are only evaluated once. Aaron Meurer On Thu, Jul 26, 2012 at 4:43 PM, Matthew Emmett wrote: > Hi everyone, > > I have some sympy code that generates Fortran code, and was wondering > if there a good w

[sympy] code generation and simplification

2012-07-26 Thread Matthew Emmett
Hi everyone, I have some sympy code that generates Fortran code, and was wondering if there a good way of simplifying the sympy expressions in order to minimize the number of floating point operations that are required to evaluate them numerically. Any suggestions? Thanks, Matt -- You received

Re: [sympy] FiniteSet.sort_key and the ordering of .args

2012-07-26 Thread Ronan Lamy
Le mardi 24 juillet 2012 à 18:37 +0300, Sergiu Ivanov a écrit : > On Mon, Jul 23, 2012 at 9:52 PM, Aaron Meurer wrote: > > On Jul 23, 2012, at 12:33 PM, Sergiu Ivanov > > wrote: > > > >> On Mon, Jul 23, 2012 at 9:17 PM, Aaron Meurer wrote: > >>> On Jul 23, 2012, at 2:20 AM, Sergiu Ivanov > >>

Re: [sympy] FiniteSet.sort_key and the ordering of .args

2012-07-26 Thread Ronan Lamy
Le mardi 24 juillet 2012 à 18:44 +0300, Sergiu Ivanov a écrit : > On Mon, Jul 23, 2012 at 9:51 PM, Tom Bachmann wrote: > > > > I'm sorry, I know I'm somewhat late to the party, and replying at this > > position in the thread is rather arbitrary, but how about the following: > > > > 1) don't sort .