Re: [sympy] trigsimp on inverse trig functions

2013-05-18 Thread Matthew Rocklin
While the original Fu paper didn't talk about inverse trig simplification there is nothing stopping someone from implementing it. Part of Fu is a well defined set and a well defined ordering of transformations/steps that expand, simplify, and reduce trig expressions. The analogous work would need

Re: [sympy] trigsimp on inverse trig functions

2013-05-16 Thread Aaron Meurer
Hmm, that's too bad. I added a note about the naming of inverse trig functions as acos instead of acrcos to the new tutorial near the section on trig simplification, but it seems out of place without any actual examples using them. Is this planned? Aaron Meurer On Thu, May 16, 2013 at 10:23 PM,

Re: [sympy] trigsimp on inverse trig functions

2013-05-16 Thread Chris Smith
no On Fri, May 17, 2013 at 10:04 AM, Aaron Meurer wrote: > Does the new Fu trigsimp algorithm implement any algorithms to simplify > inverse trig functions? > > Aaron Meurer > > -- > You received this message because you are subscribed to the Google Groups > "sympy" group. > To unsubscribe from

[sympy] trigsimp on inverse trig functions

2013-05-16 Thread Aaron Meurer
Does the new Fu trigsimp algorithm implement any algorithms to simplify inverse trig functions? Aaron Meurer -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sympy+unsu

Re: [sympy] trigsimp bug

2013-05-11 Thread Aaron Meurer
Looks like a definite bug. Could you open an issue for it in the issue tracker, so it isn't forgotten? Aaron Meurer On Fri, May 10, 2013 at 8:49 AM, Alan Bromborsky wrote: > Consider the following code - > > from sympy import symbols, trigsimp, sin, cos > > (r,th) = symbols('r,th') > (e_r,e_th)

[sympy] trigsimp bug

2013-05-10 Thread Alan Bromborsky
Consider the following code - from sympy import symbols, trigsimp, sin, cos (r,th) = symbols('r,th') (e_r,e_th) = symbols('e_r,e_th',commutative=False) #(e_r,e_th) = symbols('e_r,e_th') A = -r*sin(th)**2*e_r - r*sin(th)*cos(th)*e_th print A B = A/(r*sin(th)) print B print trigsimp(B) the outpu

Re: [sympy] trigsimp -> cos(x+y)

2012-12-06 Thread Aaron Meurer
On Wed, Dec 5, 2012 at 1:10 PM, Carsten Knoll wrote: > Hi there, > > > today I stumbled on a trigsimp problem: > > In [4]: trigsimp(cos(x+y).expand(trig=True)) > Out[4]: -sin(x)*sin(y) + cos(x)*cos(y) > > In [5]: simplify(cos(x+y).expand(trig=True)) > Out[5]: -sin(x)*sin(y) + cos(x)*cos(y) > > > I

[sympy] trigsimp -> cos(x+y)

2012-12-05 Thread Carsten Knoll
Hi there, today I stumbled on a trigsimp problem: In [4]: trigsimp(cos(x+y).expand(trig=True)) Out[4]: -sin(x)*sin(y) + cos(x)*cos(y) In [5]: simplify(cos(x+y).expand(trig=True)) Out[5]: -sin(x)*sin(y) + cos(x)*cos(y) In other words: the identity -sin(x)*sin(y) + cos(x)*cos(y) == cos(x+y) i

Re: [sympy] trigsimp applied to a matrix

2012-06-11 Thread Kjetil brinchmann Halvorsen
see inline: On Mon, Jun 11, 2012 at 5:55 PM, Chris Smith wrote: > On Tue, Jun 12, 2012 at 3:20 AM, Kjetil brinchmann Halvorsen > wrote: >> This MUST be a bug: >> >> In [29]: ( sin(s)*sin(t)-cos(s)*cos(t)).trigsimp() >> Out[29]: sin(s)⋅sin(t) - cos(s)⋅cos(t) >> > It works in my trigsimp branch >

Re: [sympy] trigsimp applied to a matrix

2012-06-11 Thread Chris Smith
On Tue, Jun 12, 2012 at 3:20 AM, Kjetil brinchmann Halvorsen wrote: > This MUST be a bug: > > In [29]: ( sin(s)*sin(t)-cos(s)*cos(t)).trigsimp() > Out[29]: sin(s)⋅sin(t) - cos(s)⋅cos(t) > It works in my trigsimp branch (https://github.com/sympy/sympy/pull/772 which I closed for lack of interest):

Re: [sympy] trigsimp applied to a matrix

2012-06-11 Thread Kjetil brinchmann Halvorsen
This MUST be a bug: In [29]: ( sin(s)*sin(t)-cos(s)*cos(t)).trigsimp() Out[29]: sin(s)⋅sin(t) - cos(s)⋅cos(t) Kjetil On Mon, Jun 11, 2012 at 5:17 PM, Kjetil brinchmann Halvorsen wrote: > see inline! > > On Mon, Jun 11, 2012 at 5:10 PM, Sergiu Ivanov > wrote: >> On Tue, Jun 12, 2012 at 12:05 A

Re: [sympy] trigsimp applied to a matrix

2012-06-11 Thread Kjetil brinchmann Halvorsen
see inline! On Mon, Jun 11, 2012 at 5:10 PM, Sergiu Ivanov wrote: > On Tue, Jun 12, 2012 at 12:05 AM, Kjetil brinchmann Halvorsen > wrote: >> >> A follow-upQ : applyfunc seems to only take one argument, the function >> to apply (It also seems to apply only for matrices, which is strange?) >> Now

Re: [sympy] trigsimp applied to a matrix

2012-06-11 Thread Sergiu Ivanov
On Tue, Jun 12, 2012 at 12:05 AM, Kjetil brinchmann Halvorsen wrote: > > A follow-upQ : applyfunc seems to only take one argument, the function > to apply (It also seems to apply only for matrices, which is strange?) > Now, trigsimp do not seem to work (the call works, but the result is > unmodifi

Re: [sympy] trigsimp applied to a matrix

2012-06-11 Thread Kjetil brinchmann Halvorsen
Thanks! A follow-upQ : applyfunc seems to only take one argument, the function to apply (It also seems to apply only for matrices, which is strange?) Now, trigsimp do not seem to work (the call works, but the result is unmodified, although I know it is possible to apply rules for getteing sin/cos(

Re: [sympy] trigsimp applied to a matrix

2012-06-11 Thread Chris Smith
> This must be very easy! >>> m=Matrix([x*(x+1)]) >>> m.applyfunc(expand) [x**2 + x] >>> m [x*(x + 1)] /c -- You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to sympy@googlegroups.com. To unsubscribe from this group, sen

[sympy] trigsimp applied to a matrix

2012-06-11 Thread Kjetil brinchmann Halvorsen
Hola! This miust be very simple, but I still on,.y knows the most basic of Python and sympy. I have a matrix, say E, created with function Matrix(...) which contains many trig functions in its elements, so I want to pass trigsimp over each element, but E.trigsimp() says AttributeError: Matrix ha

Re: [sympy] Trigsimp using groebner bases

2012-04-28 Thread Aaron Meurer
On Sat, Apr 28, 2012 at 12:42 AM, Tom Bachmann wrote: > On 28.04.2012 02:42, Aaron Meurer wrote: >> >> On Fri, Apr 27, 2012 at 2:46 PM, Tom Bachmann  wrote: >>> >>> A quick update: >>> >>> I implemented a much better selection strategy for the groebner basis >>> algorithm ("sugar cube"), implement

Re: [sympy] Trigsimp using groebner bases

2012-04-27 Thread Tom Bachmann
On 28.04.2012 02:42, Aaron Meurer wrote: On Fri, Apr 27, 2012 at 2:46 PM, Tom Bachmann wrote: A quick update: I implemented a much better selection strategy for the groebner basis algorithm ("sugar cube"), implemented the "extended version" (with trasformation matrix) and improved the algorith

Re: [sympy] Trigsimp using groebner bases

2012-04-27 Thread Aaron Meurer
On Fri, Apr 27, 2012 at 2:46 PM, Tom Bachmann wrote: > A quick update: > > I implemented a much better selection strategy for the groebner basis > algorithm ("sugar cube"), implemented the "extended version" (with > trasformation matrix) and improved the algorithm to compute module quotients > to

Re: [sympy] Trigsimp using groebner bases

2012-04-27 Thread Tom Bachmann
A quick update: I implemented a much better selection strategy for the groebner basis algorithm ("sugar cube"), implemented the "extended version" (with trasformation matrix) and improved the algorithm to compute module quotients to use only one groebner basis computation. This sped up the im

Re: [sympy] Trigsimp using groebner bases

2012-04-23 Thread Tom Bachmann
The first algorithm in the paper where ratsimpmodprime was taken from should probably do quite well - as far as I can tell it shoud be about as fast as polynomial=True (maybe two or three times slower, or something of that order - not 100 times), and work quite well (it minimizes the maximum of th

Re: [sympy] Trigsimp using groebner bases

2012-04-22 Thread Tom Bachmann
The first algorithm in the paper where trigsimp was taken from (I mean ratsimpmodprime, not trigsimp.) -- You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to sympy@googlegroups.com. To unsubscribe from this group, send e

Re: [sympy] Trigsimp using groebner bases

2012-04-22 Thread Tom Bachmann
On 22.04.2012 20:23, Aaron Meurer wrote: On Sun, Apr 22, 2012 at 5:08 AM, Tom Bachmann wrote: I implemented a new option "polynomial=True". As explained in the docstring, this essentially just applies reduced(). If given a polynomial, and using a graded order (as by default), this is guaranteed

Re: [sympy] Trigsimp using groebner bases

2012-04-22 Thread Aaron Meurer
On Sun, Apr 22, 2012 at 5:08 AM, Tom Bachmann wrote: > I implemented a new option "polynomial=True". As explained in the docstring, > this essentially just applies reduced(). If given a polynomial, and using a > graded order (as by default), this is guaranteed to return a *polynomial* > equivalent

Re: [sympy] Trigsimp using groebner bases

2012-04-22 Thread Tom Bachmann
I implemented a new option "polynomial=True". As explained in the docstring, this essentially just applies reduced(). If given a polynomial, and using a graded order (as by default), this is guaranteed to return a *polynomial* equivalent to what we started with, of minimal degree, but no other

Re: [sympy] Trigsimp using groebner bases

2012-04-21 Thread Tom Bachmann
O well, I was too quick in replying. This involves all sorts of non-polyonmial expressions and compositions of transcendental functions. I'm afraid the groebner algorithm does not work with this (in the current form, at least, and I don't see how to make it work either). On 21.04.2012 20:48, T

Re: [sympy] Trigsimp using groebner bases

2012-04-21 Thread Tom Bachmann
On 21.04.2012 20:52, Aaron Meurer wrote: I didn't enable cython in the polys, but for me, trigsimp_groebner(smallExpr, quick=True, hints=[2]) takes 194 seconds in your latest branch. On the other hand, smallExpr.rewrite(exp).expand().rewrite(cos).cancel() takes 12 seconds, and produces the same

Re: [sympy] Trigsimp using groebner bases

2012-04-21 Thread Aaron Meurer
I didn't enable cython in the polys, but for me, trigsimp_groebner(smallExpr, quick=True, hints=[2]) takes 194 seconds in your latest branch. On the other hand, smallExpr.rewrite(exp).expand().rewrite(cos).cancel() takes 12 seconds, and produces the same answer. So there's still some work to be d

Re: [sympy] Trigsimp using groebner bases

2012-04-21 Thread Tom Bachmann
Thanks for reporting this, I'll fix it :-). On 21.04.2012 19:06, Ben Goodrich wrote: Hi Tom, On Saturday, April 21, 2012 10:42:42 AM UTC-4, Tom Bachmann wrote: Instead of spamming further I will now really wrap this up and submit a pull request. Thanks for working on this. In the exa

Re: [sympy] Trigsimp using groebner bases

2012-04-21 Thread Ben Goodrich
Hi Tom, On Saturday, April 21, 2012 10:42:42 AM UTC-4, Tom Bachmann wrote: > Instead of spamming further I will now really wrap this up and submit a > pull request. > Thanks for working on this. In the example below, there seems to be a problem with integer constants in rational expressions.

Re: [sympy] Trigsimp using groebner bases

2012-04-21 Thread Tom Bachmann
Ok, so I pushed the changes to my trigsimp branch. There are two commits, WIP and WIP2. The basic idea is the following: suppose there are two sets of variables, x1,..., xn, y1, .., yn, such that none of the xi appears in the generators of the ideal -- they are "free" generators. Then really

Re: [sympy] Trigsimp using groebner bases

2012-04-21 Thread Tom Bachmann
Hi, I implemented some optimizations (not yet pushed) which allowed me to run trigsimp_groebner(smallExpr, quick=True, hints=[2]) in "reasonable" time (~5 minutes). The result is this: ddq1*(sin(q2)*sin(q4)*cos(2*q3) + cos(q2)*cos(q3)*cos(q4)) - ddq2*sin(2*q3)*sin(q4) + ddq3*cos(q3)*cos(q4)

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 t

Re: [sympy] Trigsimp using groebner bases

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

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 Bachmann 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

Re: [sympy] Trigsimp using groebner bases

2012-04-20 Thread Aaron Meurer
On Fri, Apr 20, 2012 at 1:22 PM, Tom Bachmann 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
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 ta

Re: [sympy] Trigsimp using groebner bases

2012-04-20 Thread Aaron Meurer
On Fri, Apr 20, 2012 at 1:18 PM, Tom Bachmann 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
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, bu

Re: [sympy] Trigsimp using groebner bases

2012-04-20 Thread Aaron Meurer
On Fri, Apr 20, 2012 at 1:02 PM, Tom Bachmann wrote: > On 20.04.2012 19:50, Aaron Meurer wrote: >> >> On Fri, Apr 20, 2012 at 2:07 AM, Tom Bachmann  wrote: >>> >>> That could be true. The groebner algorithms actually use a minimal sparse >>> representation internally. But running trigsimp_groebner

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 Bachmann 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 c

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 Aaron Meurer
On Fri, Apr 20, 2012 at 2:07 AM, Tom Bachmann 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 > reduction, ye

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] 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 terms

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 o

Re: [sympy] Trigsimp using groebner bases

2012-04-20 Thread Tom Bachmann
On 20.04.2012 13:55, gsagrawal wrote: 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

Re: [sympy] Trigsimp using groebner bases

2012-04-20 Thread gsagrawal
t; one quick question .. >>> how to set SYMPY_DEBUG=True ? >>> >>> On Fri, Apr 20, 2012 at 2:31 PM, Tom Bachmann >> <mailto:e_mc...@web.de>> wrote: >>> >>>Absolutely! >>> >>>git pull >>> https://github.co

Re: [sympy] Trigsimp using groebner bases

2012-04-20 Thread gsagrawal
tely! >> >>git pull >> https://github.com/ness01/__**sympy<https://github.com/ness01/__sympy> >> >><https://github.com/ness01/**sympy <https://github.com/ness01/sympy>> >> trigsimp >> >>The function is called trigsimp_g

Re: [sympy] Trigsimp using groebner bases

2012-04-20 Thread Tom Bachmann
lutely! git pull https://github.com/ness01/__sympy <https://github.com/ness01/sympy> trigsimp The function is called trigsimp_groebner. But please note that I only wrote it yesterday, so there are probably bugs. Also there is no real docstring (yet). Quick tips:

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 wrote: > Absolutely! > > git pull > https://github.com/ness01/**sympy<https://github.com/ness01/sympy>trigsimp > > The function is called trigsimp_groebner. But please not

Re: [sympy] Trigsimp using groebner bases

2012-04-20 Thread Tom Bachmann
Absolutely! git pull https://github.com/ness01/sympy trigsimp The function is called trigsimp_groebner. But please note that I only wrote it yesterday, so there are probably bugs. Also there is no real docstring (yet). Quick tips: - run with SYMPY_DEBUG=True in order to see what is

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 wrote: > That could be true. The groebner algorithms actually use a minimal sparse > representation internally. But running trigsimp_groebner on smallExpr for > me h

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'l

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
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 goo

Re: [sympy] Trigsimp using groebner bases

2012-04-19 Thread Aaron Meurer
Great. I think the best way to demonstrate new functionality like this is to just create a special function that does it (like trigsimp_groebner) in some branch, and add that to __init__.py. Then, when it is ready to go in, remove it from __init__.py and integrate it directly into the main functi

Re: [sympy] Trigsimp using groebner bases

2012-04-19 Thread manoj babu
@ness01 Cool.This thread is grabbing my attention and myself to get my hands dirty.Anyways 3 more exams and i am done.Will be participating actively. :) On Fri, Apr 20, 2012 at 2:33 AM, Tom Bachmann wrote: > I have pushed a more usable trigsimp_groebner to my new trigsimp branch. > It is probabl

Re: [sympy] Trigsimp using groebner bases

2012-04-19 Thread Tom Bachmann
I have pushed a more usable trigsimp_groebner to my new trigsimp branch. It is probably buggy, but I've had enough for today. Just to let anyone know who might wish to try it out :). Best, Tom -- You received this message because you are subscribed to the Google Groups "sympy" group. To post

Re: [sympy] Trigsimp using groebner bases

2012-04-19 Thread Tom Bachmann
Well if we are being non-rigorous, then being prime basically means that you have *all* the equations. For example the ideal generated by (s**2 + c**2 - 1)**2 is obviously not prime, because we "forgot" to add the equation s**2 + c**2 - 1. I see. My intuition comes partly from the wikipedia pag

Re: [sympy] Trigsimp using groebner bases

2012-04-19 Thread Aaron Meurer
On Thu, Apr 19, 2012 at 11:31 AM, Tom Bachmann wrote: > On 19.04.2012 17:46, Aaron Meurer wrote: >>> >>> The ideal you generate has to be prime :). In particular, if we want to >>> say >>> add tan(x), we would like to prove that the ideal >>>  of CC[s, t, c] is a prime ideal. This sort of >>> pro

Re: [sympy] Trigsimp using groebner bases

2012-04-19 Thread Tom Bachmann
On 19.04.2012 18:52, Sergiu Ivanov wrote: Hello, On Thu, Apr 19, 2012 at 8:31 PM, Tom Bachmann wrote: Probably. I'll try to code up a more coherent routine in the next couple of days which we can then base improvements on. I beg my pardon for not participating in this discussion; I'd be ver

Re: [sympy] Trigsimp using groebner bases

2012-04-19 Thread Sergiu Ivanov
Hello, On Thu, Apr 19, 2012 at 8:31 PM, Tom Bachmann wrote: > > Probably. I'll try to code up a more coherent routine in the next couple of > days which we can then base improvements on. I beg my pardon for not participating in this discussion; I'd be very glad to read the reference article for

Re: [sympy] Trigsimp using groebner bases

2012-04-19 Thread Tom Bachmann
On 19.04.2012 17:46, Aaron Meurer wrote: The ideal you generate has to be prime :). In particular, if we want to say add tan(x), we would like to prove that the ideal of CC[s, t, c] is a prime ideal. This sort of problem can be non-trivial (In fact it's not at all obvious how to proceed here, a

Re: [sympy] Trigsimp using groebner bases

2012-04-19 Thread Aaron Meurer
On Thu, Apr 19, 2012 at 1:24 AM, Tom Bachmann wrote: > On 18.04.2012 23:25, Aaron Meurer wrote: >>> >>> Opts is mostly passed through to polys. You probably shouldn't use the >>> gens=.. option. It is probably a good idea to pass order=grlex or >>> order=grevlex -- for reasons that are not clear t

Re: [sympy] Trigsimp using groebner bases

2012-04-19 Thread Tom Bachmann
I tried adding tan double angle identities to the generators list by adding tan(k*x).rewrite(cos).expand(trig=True), but I couldn't get just sin(x).rewrite(tan) to simplify (though I could get some other stuff to work, like mytrigsimp(tan(2*x).rewrite(cos).expand(trig=True), n=2)). By the way t

Re: [sympy] Trigsimp using groebner bases

2012-04-19 Thread Tom Bachmann
Hi, thanks for the input. I'm thinking about it. Tom On 19.04.2012 06:55, Ronan Lamy wrote: Le mercredi 18 avril 2012 à 22:48 +0100, Tom Bachmann a écrit : [Sherjil, I'm CC-ing you because in my head you are the "linear algebra expert" :-)] One last update for today: I tried to implement cod

Re: [sympy] Trigsimp using groebner bases

2012-04-19 Thread Tom Bachmann
On 18.04.2012 23:25, Aaron Meurer wrote: Opts is mostly passed through to polys. You probably shouldn't use the gens=.. option. It is probably a good idea to pass order=grlex or order=grevlex -- for reasons that are not clear to me the default order in polys is lex. In any case, unless you pass a

Re: [sympy] Trigsimp using groebner bases

2012-04-18 Thread Ronan Lamy
Le mercredi 18 avril 2012 à 22:48 +0100, Tom Bachmann a écrit : > [Sherjil, I'm CC-ing you because in my head you are the "linear algebra > expert" :-)] > > One last update for today: I tried to implement code which finds a > "nice" solution. > > Problem statement: let Ax=0 be a homogeneous sys

Re: [sympy] Trigsimp using groebner bases

2012-04-18 Thread Aaron Meurer
Here's exactly what I changed, by the way: diff --git a/mytrigsimp.py b/mytrigsimp.py index 0b6288d..12715ab 100644 --- a/mytrigsimp.py +++ b/mytrigsimp.py @@ -9,15 +9,18 @@ def build_ideal(x, n): The main tradeoff here is performance: the more expressions we introduce, the slower the si

Re: [sympy] Trigsimp using groebner bases

2012-04-18 Thread Aaron Meurer
On Wed, Apr 18, 2012 at 1:27 PM, Tom Bachmann wrote: > Hi all, > > I managed to improve the situation quite a lot. The new code is this time > attached as a patch, or alternatively see my (ness01) branch trigsimp. > > Executive summary: run mytrigsimp, test the function mytrigsimp. Ignore the > de

Re: [sympy] Trigsimp using groebner bases

2012-04-18 Thread Tom Bachmann
[Sherjil, I'm CC-ing you because in my head you are the "linear algebra expert" :-)] One last update for today: I tried to implement code which finds a "nice" solution. Problem statement: let Ax=0 be a homogeneous system with non-trivial solutions. Find a non-trivial solution with maximal nu

Re: [sympy] Trigsimp using groebner bases

2012-04-18 Thread Tom Bachmann
Hi all, I managed to improve the situation quite a lot. The new code is this time attached as a patch, or alternatively see my (ness01) branch trigsimp. Executive summary: run mytrigsimp, test the function mytrigsimp. Ignore the debugging output, pass order=grlex or grevlex for sensible resul

Re: [sympy] Trigsimp using groebner bases

2012-04-17 Thread Tom Bachmann
Ah, sorry for the spam. It's computing the reduced normal forms. On 17.04.2012 20:47, Tom Bachmann wrote: Actually, solving the systems is quite fast. Not sure what the prolem is so far... On 17.04.2012 20:39, Tom Bachmann wrote: Hi all, so recently we (I ...) pushed the function ratsimpmodpr

Re: [sympy] Trigsimp using groebner bases

2012-04-17 Thread Tom Bachmann
Actually, solving the systems is quite fast. Not sure what the prolem is so far... On 17.04.2012 20:39, Tom Bachmann wrote: Hi all, so recently we (I ...) pushed the function ratsimpmodprime, created by Mateusz' last year's gsoc student. It can be used to simplify fractions modulo prime ideals

[sympy] Trigsimp using groebner bases

2012-04-17 Thread Tom Bachmann
Hi all, so recently we (I ...) pushed the function ratsimpmodprime, created by Mateusz' last year's gsoc student. It can be used to simplify fractions modulo prime ideals, and it was suggested we try to incorporate in into trigsimp. I tried basically that [with little success, see below]. Firs

Re: [sympy] trigsimp of sympy vs trigsimp of maxima

2012-04-17 Thread Tom Bachmann
Hello, I'm afraid trigonometric simplification is a known weakness of sympy. On the other hand, there is good news in your case: *very* recently (yesterday?) we pushed a new function called ratsimpmodprime. It can be used as follows: In [2]: ratsimpmodprime((-sin(x) + 1)/cos(x) + cos(x)/(-si

[sympy] trigsimp of sympy vs trigsimp of maxima

2012-04-17 Thread gsagrawal
if you apply trigsimp on "(-sin(x) + 1)/cos(x) + cos(x)/(-sin(x) + 1)" function sympy result : (-sin(x) + 1)/cos(x) + cos(x)/(-sin(x) + 1) (dosent solve anything) maxima result : 2/cos(x) what am i missing in sympy ? Is there any way i can use maxima under sympy ? Or is there any other way by

Re: [sympy] Trigsimp

2011-08-09 Thread Aaron Meurer
No. Right now, trigsimp() is very weak. It basically just applies the various forms of sin**2 + cos**2 = 1. Improvements would be welcome, though. Aaron Meurer On Tue, Aug 9, 2011 at 12:31 PM, Alan Bromborsky wrote: > Has there been any work to applying trigsimp to hyperbolic trig functions? >

[sympy] Trigsimp

2011-08-09 Thread Alan Bromborsky
Has there been any work to applying trigsimp to hyperbolic trig functions? -- You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to sympy@googlegroups.com. To unsubscribe from this group, send email to sympy+unsubscr...@goo

Re: [sympy] trigsimp bug? (Attempts to implement SICM)

2010-09-05 Thread Aaron S. Meurer
On Sep 4, 2010, at 11:02 AM, Aaron S. Meurer wrote: > On Sep 3, 2010, at 7:21 PM, Rahul Siddharthan wrote: > The other issue that came up is, I see from the archives, again a known problem: if I want to define multiplication for "tuples", a multiplication of a tuple by a scalar (o

Re: [sympy] trigsimp bug? (Attempts to implement SICM)

2010-09-04 Thread Aaron S. Meurer
On Sep 3, 2010, at 7:21 PM, Rahul Siddharthan wrote: >>> The other issue that came up is, I see from the archives, again a >>> known problem: if I want to define multiplication for "tuples", a >>> multiplication of a tuple by a scalar (on the left or the right) is >>> the tuple of each component m

Re: [sympy] trigsimp bug? (Attempts to implement SICM)

2010-09-03 Thread Rahul Siddharthan
>> The other issue that came up is, I see from the archives, again a >> known problem: if I want to define multiplication for "tuples", a >> multiplication of a tuple by a scalar (on the left or the right) is >> the tuple of each component multiplied by the scalar.  I define the >> __mul__ and __rm

Re: [sympy] trigsimp bug? (Attempts to implement SICM)

2010-09-03 Thread Aaron S. Meurer
On Sep 2, 2010, at 11:57 PM, Rahul Siddharthan wrote: > Aaron, Chris, > Thanks for the replies! > > Aaron wrote: >> This is great. SymPy code is *MUCH* easier to read than some lisp, in my >> opinion. > > So far, yes and no. The main thing is that I needed to implement > structured "tuples"

Re: [sympy] trigsimp bug? (Attempts to implement SICM)

2010-09-03 Thread Øyvind Jensen
fr., 03.09.2010 kl. 11.27 +0530, skrev Rahul Siddharthan: > Aaron, Chris, > Thanks for the replies! > > Aaron wrote: > > This is great. SymPy code is *MUCH* easier to read than some lisp, in my > > opinion. > > So far, yes and no. The main thing is that I needed to implement > structured "tupl

Re: [sympy] trigsimp bug? (Attempts to implement SICM)

2010-09-02 Thread Rahul Siddharthan
Aaron, Chris, Thanks for the replies! Aaron wrote: > This is great.  SymPy code is *MUCH* easier to read than some lisp, in my > opinion. So far, yes and no. The main thing is that I needed to implement structured "tuples" as defined in SICM, and functions that take tuples as arguments, and der

Re: [sympy] trigsimp bug? (Attempts to implement SICM)

2010-09-02 Thread Aaron S. Meurer
Hi. On Sep 2, 2010, at 7:48 AM, Rahul Siddharthan wrote: > Hello, > I am trying to re-implement most of the code from "Structure and > Interpretation of Classical Mechanics" (Sussman and Wisdom, > http://mitpress.mit.edu/sicm) in sympy. The original language is > their particular dialect of S

[sympy] trigsimp bug? (Attempts to implement SICM)

2010-09-02 Thread Rahul Siddharthan
Hello, I am trying to re-implement most of the code from "Structure and Interpretation of Classical Mechanics" (Sussman and Wisdom, http://mitpress.mit.edu/sicm) in sympy. The original language is their particular dialect of Scheme. I have had success with most of the first chapter, but with quit

[sympy] Trigsimp branch of sympy

2009-05-31 Thread Luke
I've published my branch of sympy where I started implementing the trig simplification algorithm by Hu et al. I also started working on the .eval() methods of sin, cos, and tan, and wrote a lot of tests for the behavior that Mathematica gives. Currently, py.test sympy/functions/elementary passes

[sympy] trigsimp

2009-05-20 Thread Luke
Last night I was deriving the moment of inertia for a solid torus using Sympy. It mostly worked, except for the step where the determinant of the Jacobian for the change of variables mapping was to be computed, the result was unable to be simplified by trigsimp. I gave it a shot anyway, and it

[sympy] Trigsimp error

2009-04-28 Thread Luke
I'm writing some tests for some code that expresses a Vector expression in the coordinates of a different frame. I am using Sympy's trigsimp to simplify expressions, but the following Sympy expression isn't trigsimplifying: cos(q4)**2 + sin(q3)**2*sin(q4)**2 + cos(q3)**2*cos(q4)**2*tan(q4)**2 It

[sympy] trigsimp

2008-11-10 Thread Alan Bromborsky
How hard would it be to have trigsimp handle hyperbolic trig functions as well as the ordinary ones? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to sympy@googlegr

[sympy] trigsimp

2008-11-01 Thread Alan Bromborsky
Trigsimp should also simplify hyperbolic trigonometric functions! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to sympy@googlegroups.com To unsubscribe from this gr