[sympy] Re: Identifying repeated subexpressions in systems of equations

2008-07-07 Thread Stéfan van der Walt
2008/7/7 Ondrej Certik [EMAIL PROTECTED]: The docs are here: http://docs.sympy.org/modules/rewriting.html#module-sympy.simplify.cse_main Stefan, what is the preferred way to document things in numpy? I mean what kind of REST markup one should use in docstrings, so that it looks nice in

[sympy] Re: Identifying repeated subexpressions in systems of equations

2008-07-06 Thread Robert Kern
On Tue, Jul 1, 2008 at 10:38, Ondrej Certik [EMAIL PROTECTED] wrote: Any progress on this? I think it's time to make anothe release, let's say on Monday. If you are busy, I propose to put the code that we have in (with my patch and a comment how to proceed with fixing it generally) and when

[sympy] Re: Identifying repeated subexpressions in systems of equations

2008-07-06 Thread Ondrej Certik
On Sun, Jul 6, 2008 at 12:36 PM, Robert Kern [EMAIL PROTECTED] wrote: On Tue, Jul 1, 2008 at 10:38, Ondrej Certik [EMAIL PROTECTED] wrote: Any progress on this? I think it's time to make anothe release, let's say on Monday. If you are busy, I propose to put the code that we have in (with my

[sympy] Re: Identifying repeated subexpressions in systems of equations

2008-07-06 Thread Robert Kern
On Sun, Jul 6, 2008 at 05:45, Ondrej Certik [EMAIL PROTECTED] wrote: On Sun, Jul 6, 2008 at 12:36 PM, Robert Kern [EMAIL PROTECTED] wrote: On Tue, Jul 1, 2008 at 10:38, Ondrej Certik [EMAIL PROTECTED] wrote: Any progress on this? I think it's time to make anothe release, let's say on

[sympy] Re: Identifying repeated subexpressions in systems of equations

2008-07-06 Thread Robert Kern
On Sun, Jul 6, 2008 at 07:13, Ondrej Certik [EMAIL PROTECTED] wrote: diff --git a/sympy/simplify/__init__.py b/sympy/simplify/__init__.py --- a/sympy/simplify/__init__.py +++ b/sympy/simplify/__init__.py @@ -10,3 +10,5 @@ from rewrite import cancel, trim, apart from rewrite import cancel,

[sympy] Re: Identifying repeated subexpressions in systems of equations

2008-07-06 Thread Ondrej Certik
On Sun, Jul 6, 2008 at 2:19 PM, Robert Kern [EMAIL PROTECTED] wrote: On Sun, Jul 6, 2008 at 07:13, Ondrej Certik [EMAIL PROTECTED] wrote: diff --git a/sympy/simplify/__init__.py b/sympy/simplify/__init__.py --- a/sympy/simplify/__init__.py +++ b/sympy/simplify/__init__.py @@ -10,3 +10,5 @@

[sympy] Re: Identifying repeated subexpressions in systems of equations

2008-07-06 Thread Robert Kern
On Sun, Jul 6, 2008 at 07:55, Ondrej Certik [EMAIL PROTECTED] wrote: On Sun, Jul 6, 2008 at 2:19 PM, Robert Kern [EMAIL PROTECTED] wrote: On Sun, Jul 6, 2008 at 07:13, Ondrej Certik [EMAIL PROTECTED] wrote: diff --git a/sympy/simplify/__init__.py b/sympy/simplify/__init__.py ---

[sympy] Re: Identifying repeated subexpressions in systems of equations

2008-07-06 Thread Ondrej Certik
On Sun, Jul 6, 2008 at 2:57 PM, Robert Kern [EMAIL PROTECTED] wrote: On Sun, Jul 6, 2008 at 07:55, Ondrej Certik [EMAIL PROTECTED] wrote: On Sun, Jul 6, 2008 at 2:19 PM, Robert Kern [EMAIL PROTECTED] wrote: On Sun, Jul 6, 2008 at 07:13, Ondrej Certik [EMAIL PROTECTED] wrote: diff --git

[sympy] Re: Identifying repeated subexpressions in systems of equations

2008-07-01 Thread Robert Kern
On Tue, Jul 1, 2008 at 10:38, Ondrej Certik [EMAIL PROTECTED] wrote: Any progress on this? I think it's time to make anothe release, let's say on Monday. If you are busy, I propose to put the code that we have in (with my patch and a comment how to proceed with fixing it generally) and when

[sympy] Re: Identifying repeated subexpressions in systems of equations

2008-06-18 Thread Ondrej Certik
On Wed, Jun 18, 2008 at 11:50 AM, Robert Kern [EMAIL PROTECTED] wrote: On Wed, Jun 18, 2008 at 04:32, Ondrej Certik [EMAIL PROTECTED] wrote: 1) commit your patch as is and wait until someone fixes the x-y problem in a general way 2) commit your patch + my patch + a good comment, that adding

[sympy] Re: Identifying repeated subexpressions in systems of equations

2008-06-18 Thread Fredrik Johansson
I've implemented an evaluate=False option for Add, Mul, Pow and functions (see attachment). This could be useful to suppress default behavior like Sub(x,y) - Add(x,Mul(-1,y)) for code generation etc. As it happens, I need something like this for evalf testing as well. Fredrik

[sympy] Re: Identifying repeated subexpressions in systems of equations

2008-06-18 Thread Ondrej Certik
On Wed, Jun 18, 2008 at 3:26 PM, Fredrik Johansson [EMAIL PROTECTED] wrote: I've implemented an evaluate=False option for Add, Mul, Pow and functions (see attachment). This could be useful to suppress default behavior like Sub(x,y) - Add(x,Mul(-1,y)) for code generation etc. As it happens, I

[sympy] Re: Identifying repeated subexpressions in systems of equations

2008-06-18 Thread Robert Kern
On Wed, Jun 18, 2008 at 05:44, Ondrej Certik [EMAIL PROTECTED] wrote: On Wed, Jun 18, 2008 at 11:50 AM, Robert Kern [EMAIL PROTECTED] wrote: I can probably implement multiple expression support + unit tests + subtraction preprocessing in a few days time. Excellent. In this case, let's go

[sympy] Re: Identifying repeated subexpressions in systems of equations

2008-06-16 Thread Luke
So I think it has become clear what I'm looking to do. There are many levels of subexpressions, and equations may be defined by many different subexpressions. For those of you familiar with classical mechanics, you are probably aware of the explosion of the number of terms that arises as the

[sympy] Re: Identifying repeated subexpressions in systems of equations

2008-06-16 Thread Luke
Robert, The Mathematica link you provided is exactly what I'm trying to do. I haven't tried your python code yet but after reading it I think it should work great. I really appreciate your comments and your help! Thanks, ~Luke On Jun 16, 12:14 pm, Robert Kern [EMAIL PROTECTED] wrote: On

[sympy] Re: Identifying repeated subexpressions in systems of equations

2008-06-15 Thread Ondrej Certik
Hi Luke, On Sun, Jun 15, 2008 at 9:00 PM, Luke [EMAIL PROTECTED] wrote: Ondrej, I know that Sympy has the capability to do symbolic replacement like you described. I guess what I'm looking for is more an algorithm to help identify and automatically collect common subexpressions so that

[sympy] Re: Identifying repeated subexpressions in systems of equations

2008-06-15 Thread Robert Kern
On Sun, Jun 15, 2008 at 16:11, Ondrej Certik [EMAIL PROTECTED] wrote: I don't understand which criteria you use to substitute the subexpressions --- the most frequent subexpression? Here's some help I got a long time ago when I asked about how to do this with Python ASTs. I never followed up

[sympy] Re: Identifying repeated subexpressions in systems of equations

2008-06-15 Thread Robert Kern
On Sun, Jun 15, 2008 at 17:46, Ondrej Certik [EMAIL PROTECTED] wrote: On Mon, Jun 16, 2008 at 12:10 AM, Robert Kern [EMAIL PROTECTED] wrote: Actually, that example is not relevant since there is no repeated subexpression. The idea is to reduce the amount of unnecessarily repeated

[sympy] Re: Identifying repeated subexpressions in systems of equations

2008-06-14 Thread Ondrej Certik
Hi Luke! On Fri, Jun 13, 2008 at 8:45 PM, Luke [EMAIL PROTECTED] wrote: I'm working on some code that symbolically generates equations of motion for mechanical systems. I would like the equations to be computationally efficient in that they don't repeatedly calculate quantities that have