[sympy] beautify error messages

2012-04-20 Thread smichr
Inspired a bit by the SymPyDeprecationWarning, I am looking at how we might make it easier to write error message in the code. One of the headaches is handling longer error messages. method 1 - use string concatenation within parens; PRO simple CON: you have to remember to add a space at the

Re: [sympy] Trigsimp using groebner bases

2012-04-20 Thread Tom Bachmann
I tried the expressions from https://groups.google.com/d/topic/sympy/3y6orHV2_4k/discussion (see the tarball linked to in the first post). I just tried the small expression with n=1, but it just hung on the reduction step. Any thoughts on how to make this faster? Those expressions would make

Re: [sympy] Trigsimp using groebner bases

2012-04-20 Thread Aaron Meurer
I just remembered something important (I'm not sure why I forgot about it before). It's going to be slow with multiple generators simply because the polys are slow with multiple generators. This is because the recursive dense representation used in the polys is highly inefficient for polynomials

Re: [sympy] Trigsimp using groebner bases

2012-04-20 Thread Tom Bachmann
That could be true. The groebner algorithms actually use a minimal sparse representation internally. But running trigsimp_groebner on smallExpr for me hangs on a * d_hat - b * c_hat - (not even the conversion to sparse or reduction, yet) just a multiplication of (huge) polys. As I said, I'll

Re: [sympy] Trigsimp using groebner bases

2012-04-20 Thread gsagrawal
i want to evaluate this function . can you tell me which branch i need to checkout ? On Fri, Apr 20, 2012 at 1:37 PM, Tom Bachmann e_mc...@web.de wrote: That could be true. The groebner algorithms actually use a minimal sparse representation internally. But running trigsimp_groebner on

Re: [sympy] Trigsimp using groebner bases

2012-04-20 Thread gsagrawal
one quick question .. how to set SYMPY_DEBUG=True ? On Fri, Apr 20, 2012 at 2:31 PM, Tom Bachmann e_mc...@web.de wrote: Absolutely! git pull https://github.com/ness01/**sympyhttps://github.com/ness01/sympytrigsimp The function is called trigsimp_groebner. But please note that I only

Re: [sympy] Trigsimp using groebner bases

2012-04-20 Thread Tom Bachmann
Just bin/isympy (or whatever you use) with this in the environment. E.g.: SYMPY_DEBUG=True bin/isympy On 20.04.2012 11:45, gsagrawal wrote: one quick question .. how to set SYMPY_DEBUG=True ? On Fri, Apr 20, 2012 at 2:31 PM, Tom Bachmann e_mc...@web.de mailto:e_mc...@web.de wrote:

Re: [sympy] Trigsimp using groebner bases

2012-04-20 Thread gsagrawal
i was evaluating this function.Few points which i noticed are below 1. in current TrigonometricFunction we dont have csc and sec which are kind of must in trigonometry simplification ( for now may bwe can have empty classes ..just to use theorems) 2. After 4 or 5 loops this is taking

Re: [sympy] Trigsimp using groebner bases

2012-04-20 Thread gsagrawal
missed the sample code for applying identity def apply_basic_trig_identities(self,expr,get_mapping=True): applied_theorems=[] ''' will apply basic trigonometric identities ''' need_mapping=True a=Wild(a,dummy=True,exclude=[0])

Re: [sympy] Trigsimp using groebner bases

2012-04-20 Thread someone
1. in current TrigonometricFunction we dont have csc and sec which are kind of must in trigonometry simplification ( for now may bwe can have empty classes ..just to use theorems) There are more or less finished classes in the Trigonometric branch and pull request [1]. It's a bit old and

Re: [sympy] Trigsimp using groebner bases

2012-04-20 Thread Tom Bachmann
4. Also , identity like 1-sin(x)**2 = cos(x)**2 are not applied (try trigsimp_groebner((1+sin(x))*(1-sin(x)) . this can be handled if we apply all identity first as mentioned in 3rd point) Yes. Anything beyond reducing the degree is somewhat fiddly. Basically the algorithm excludes certain

Re: [sympy] Trigsimp using groebner bases

2012-04-20 Thread Tom Bachmann
Actually, I was being overzealous. This does't quite work. On 20.04.2012 14:40, Tom Bachmann wrote: 4. Also , identity like 1-sin(x)**2 = cos(x)**2 are not applied (try trigsimp_groebner((1+sin(x))*(1-sin(x)) . this can be handled if we apply all identity first as mentioned in 3rd point) Yes.

Re: [sympy] Re: problem with running test of dual_matrix method--attribute issue

2012-04-20 Thread Comer
Hi, Given that things are somewhat screwed up and given that there are only two files which were changed in the process (sympy/matrices/matrices.py and sympy/matrices/tests/test_matrices.py) I am now thinking it would be simpler to 1. cp the two files somewhere for safe keeping. 2. get a

Re: [sympy] Re: problem with running test of dual_matrix method--attribute issue

2012-04-20 Thread Chris Smith
On Fri, Apr 20, 2012 at 9:20 PM, Comer comer.dun...@gmail.com wrote: Hi, Given that things are somewhat screwed up and given that there are only two files which were changed in the process (sympy/matrices/matrices.py and sympy/matrices/tests/test_matrices.py) I am now thinking it would be

Re: [sympy] Trigsimp using groebner bases

2012-04-20 Thread Aaron Meurer
On Fri, Apr 20, 2012 at 2:07 AM, Tom Bachmann e_mc...@web.de wrote: That could be true. The groebner algorithms actually use a minimal sparse representation internally. But running trigsimp_groebner on smallExpr for me hangs on a * d_hat - b * c_hat - (not even the conversion to sparse or

Re: [sympy] Trigsimp using groebner bases

2012-04-20 Thread Tom Bachmann
Hi, so as promised I ran some timings. Raw data first -- I first tried trigsimp_groebner((sin(n*x)/cos(n*x)).expand(trig=True), hints=[tan, n]) This essentially benchmarks groebner basis computation for ideals with many generators. In [23]: for n in range(1, 8): :

Re: [sympy] Trigsimp using groebner bases

2012-04-20 Thread Tom Bachmann
On 20.04.2012 19:50, Aaron Meurer wrote: On Fri, Apr 20, 2012 at 2:07 AM, Tom Bachmanne_mc...@web.de wrote: That could be true. The groebner algorithms actually use a minimal sparse representation internally. But running trigsimp_groebner on smallExpr for me hangs on a * d_hat - b * c_hat -

Re: [sympy] Trigsimp using groebner bases

2012-04-20 Thread Tom Bachmann
It avoids some (hopefully many...) of the monomials by taking only those not divisible by leading monomials of the groebner basis. (These monomials form a basis of the quotient space, which is the most basic property of groebner bases.) From what I can see, the final result may be smaller,

Re: [sympy] Trigsimp using groebner bases

2012-04-20 Thread Aaron Meurer
On Fri, Apr 20, 2012 at 1:18 PM, Tom Bachmann e_mc...@web.de wrote: It avoids some (hopefully many...) of the monomials by taking only those not divisible by leading monomials of the groebner basis. (These monomials form a basis of the quotient space, which is the most basic property of

Re: [sympy] Trigsimp using groebner bases

2012-04-20 Thread Tom Bachmann
Sure. But I think (possibly contrary to what I said earlier), staircase really isn't the problem. If the result is huge then the next parts (calling reduced(), solving the linear system) are going to take ages as well. Maybe we should run kernprof on it to see what function calls are really

Re: [sympy] Trigsimp using groebner bases

2012-04-20 Thread Aaron Meurer
On Fri, Apr 20, 2012 at 1:22 PM, Tom Bachmann e_mc...@web.de wrote: Sure. But I think (possibly contrary to what I said earlier), staircase really isn't the problem. If the result is huge then the next parts (calling reduced(), solving the linear system) are going to take ages as well.

Re: [sympy] Trigsimp using groebner bases

2012-04-20 Thread Tom Bachmann
On 20.04.2012 20:31, Aaron Meurer wrote: On Fri, Apr 20, 2012 at 1:22 PM, Tom Bachmanne_mc...@web.de wrote: Sure. But I think (possibly contrary to what I said earlier), staircase really isn't the problem. If the result is huge then the next parts (calling reduced(), solving the linear

Re: [sympy] Trigsimp using groebner bases

2012-04-20 Thread Aaron Meurer
On Fri, Apr 20, 2012 at 2:17 PM, Tom Bachmann e_mc...@web.de wrote: On 20.04.2012 20:31, Aaron Meurer wrote: On Fri, Apr 20, 2012 at 1:22 PM, Tom Bachmanne_mc...@web.de  wrote: Sure. But I think (possibly contrary to what I said earlier), staircase really isn't the problem. If the result is

Re: [sympy] Trigsimp using groebner bases

2012-04-20 Thread Tom Bachmann
On 20.04.2012 21:38, Aaron Meurer wrote: I'm sorry ^^. It's cProfile. (I run it via python -m cProfile ... got the letters mixed up in my head). Oh, I know about that one :) But what graph did you get? Well the output is in gprof format, and there is a gprof2dot script floating around on

[sympy] pickling problem

2012-04-20 Thread smichr
In the code below, 'check' is the function listed first in `test_pickling` y = Symbol('y') y.is_commutative True check(Symbol('y', commutative=False)) y.is_commutative False check(Symbol('y', commutative=True)) y.is_commutative False Symbol('y', commutative=True).is_commutative False Why

Re: [sympy] pickling problem

2012-04-20 Thread Ronan Lamy
Le vendredi 20 avril 2012 à 14:21 -0700, smichr a écrit : In the code below, 'check' is the function listed first in `test_pickling` y = Symbol('y') y.is_commutative True check(Symbol('y', commutative=False)) y.is_commutative False check(Symbol('y', commutative=True))

Re: [sympy] DeprecationWarning beautification project

2012-04-20 Thread Ronan Lamy
Le jeudi 19 avril 2012 à 19:05 +0200, Joachim Durchholz a écrit : Am 19.04.2012 15:25, schrieb Ronan Lamy: I'm referring to sympy.utilities, which does import basically all of sympy.core. It's actually not as bad as I thought, but still seems quite dangerous for something as basic as a