[sympy] GSoC Article for PSF and my blog

2010-09-16 Thread Mike Driscoll
Hi, I am working on an article for the Python Software Foundation's blog, http://pyfound.blogspot.com/, about the various Python projects that were worked on during this year's Google Summer of Code program. They want me to write up something about what projects were worked on and what the results

Re: [sympy] GSoC Article for PSF and my blog

2010-09-16 Thread Ondrej Certik
Hi Mike! On Thu, Sep 16, 2010 at 6:42 AM, Mike Driscoll wrote: > Hi, > > I am working on an article for the Python Software Foundation's blog, > http://pyfound.blogspot.com/, about the various Python projects that > were worked on during this year's Google Summer of Code program. They > want me t

Re: [sympy] GSoC Article for PSF and my blog

2010-09-16 Thread Aaron S. Meurer
I will try to finish my writeup today or tomorrow :). Aaron Meurer Sent from my iPod touch. On Sep 16, 2010, at 11:34 AM, Ondrej Certik wrote: Hi Mike! On Thu, Sep 16, 2010 at 6:42 AM, Mike Driscoll wrote: Hi, I am working on an article for the Python Software Foundation's blog, http:/

[sympy] generation of trigonometric multiple angle formulas

2010-09-16 Thread Ondrej Certik
Hi, today I have discovered (by accident), that you can very easily generate all the sin/cos multiple angle formulas, like: sin(2*x) = 2*cos(x)*sin(x) sin(3*x) = -(1 - 4*cos(x)**2)*sin(x) sin(4*x) = (-4*cos(x) + 8*cos(x)**3)*sin(x) cos(2*x) = -1 + 2*cos(x)**2 cos(3*x) = -3*cos(x) + 4*cos(x)**3 co

[sympy] Re: generation of trigonometric multiple angle formulas

2010-09-16 Thread Mateusz Paprocki
Hi, On Thu, Sep 16, 2010 at 04:30:41PM -0700, Ondrej Certik wrote: > Hi, > > today I have discovered (by accident), that you can very easily > generate all the sin/cos multiple angle formulas, like: > > sin(2*x) = 2*cos(x)*sin(x) > sin(3*x) = -(1 - 4*cos(x)**2)*sin(x) > sin(4*x) = (-4*cos(x) + 8

Re: [sympy] Re: generation of trigonometric multiple angle formulas

2010-09-16 Thread Ondrej Certik
On Thu, Sep 16, 2010 at 4:38 PM, Mateusz Paprocki wrote: > Hi, > > On Thu, Sep 16, 2010 at 04:30:41PM -0700, Ondrej Certik wrote: >> Hi, >> >> today I have discovered (by accident), that you can very easily >> generate all the sin/cos multiple angle formulas, like: >> >> sin(2*x) = 2*cos(x)*sin(x)

[sympy] Re: generation of trigonometric multiple angle formulas

2010-09-16 Thread Mateusz Paprocki
Hi, On Thu, Sep 16, 2010 at 04:51:37PM -0700, Ondrej Certik wrote: > On Thu, Sep 16, 2010 at 4:38 PM, Mateusz Paprocki wrote: > > Hi, > > > > On Thu, Sep 16, 2010 at 04:30:41PM -0700, Ondrej Certik wrote: > >> Hi, > >> > >> today I have discovered (by accident), that you can very easily > >> gene

Re: [sympy] Re: generation of trigonometric multiple angle formulas

2010-09-16 Thread Aaron S. Meurer
I get 8.94, 0.01, 0.00 on the first run and 1.31, 0.01, 0.00 on subsequent runs (cache enabled). But more importantly, I get this: In [69]: a = sin(40*x).expand(trig=True) In [70]: b = chebyshevt(40, cos(x)) In [71]: c = chebyshevt_poly(40, cos(x)) In [72]: a == b Out[72]: False In [73]: a =

Re: [sympy] Algebraic rearrangement and obtaining coefficients of variables

2010-09-16 Thread Nicholas Kinar
I think you want the collect() function and the .as_independent method. The easiest way to manipulate Equalities is to first convert them into regular expressions. Then, you would call collect on the expression using x**2. collect collects all powers of the argument by default, but you can

Re: [sympy] Algebraic rearrangement and obtaining coefficients of variables

2010-09-16 Thread Aaron S. Meurer
Hi again. On Sep 16, 2010, at 9:51 PM, Nicholas Kinar wrote: > >>> I think you want the collect() function and the .as_independent method. >>> The easiest way to manipulate Equalities is to first convert them into >>> regular expressions. Then, you would call collect on the expression using

Re: [sympy] Algebraic rearrangement and obtaining coefficients of variables

2010-09-16 Thread Nicholas Kinar
If the second one had given set([M(i, j) ,M(1 + i, j)]), then you could have had something to work with (Chris or Oyvind, do you know why it does this?). Of course, the way I gave again above will still work, if you know what the M's are in the expression: In [104]: expr = expr.lhs - expr.rh

Re: [sympy] Algebraic rearrangement and obtaining coefficients of variables

2010-09-16 Thread Aaron S. Meurer
.atoms() is the standard way to get all the similar kinds of objects in an expression, so it is a shame that it isn't working in this case. I opened issue (2058) for this (see http://code.google.com/p/sympy/issues/detail?id=2058). Feel free to lend your help in fixing it. Something just as

Re: [sympy] Algebraic rearrangement and obtaining coefficients of variables

2010-09-16 Thread Nicholas Kinar
On 10-09-16 10:33 PM, Aaron S. Meurer wrote: .atoms() is the standard way to get all the similar kinds of objects in an expression, so it is a shame that it isn't working in this case. I opened issue (2058) for this (see http://code.google.com/p/sympy/issues/detail?id=2058). Feel free to le

Re: [sympy] Re: generation of trigonometric multiple angle formulas

2010-09-16 Thread Ondrej Certik
On Thu, Sep 16, 2010 at 5:32 PM, Aaron S. Meurer wrote: > I get 8.94, 0.01, 0.00 on the first run and 1.31, 0.01, 0.00 on subsequent > runs (cache enabled). > > But more importantly, I get this: > > In [69]: a = sin(40*x).expand(trig=True) > > In [70]: b = chebyshevt(40, cos(x)) > > In [71]: c =