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 too much time and the final expression is in terms of sin only (converts all cos to sin ) 3. before going to apply ratsimpmodprime function we can call some basic identity substitution (sample code is given in the end) 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) 5. Perhaps in place of passing groebner basis like : sin(x)**2*tan(x) + sin(x)*cos(x) - tan(x) (i dont know how this is generated at first place) ,we should pass only basic formulas (here i think you mean 1+tan(x)**2=1/cos(x)**2 ) 6. And yes sometime it gives very funny expressions
I On Fri, Apr 20, 2012 at 4:19 PM, Tom Bachmann <e_mc...@web.de> wrote: > 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: >> >> Absolutely! >> >> 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_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 happening / if >> it hangs >> - pass quick=True if it hangs at "minsolve: ..." >> - use hints=[...]. This really should be in the docstring. Basically >> put in in what you think the answer should involve. E.g. >> trigsimp_groebner(sin(x)*cos(_**_x)) does nothing. Passing >> >> hints=[sin(2*x)] works. Also hints=[2] does something similar (but >> is way more expensive). Try hints=[tan] to enable looking for tan >> expressions (only necessary if they are not in the input). >> hints=[(sin, x, y)] will try to use the sin(x+y)=sin(x)cos(y) + >> sin(y)cos(x) formula. >> - hyperbolic function simplification does not work, yet >> >> Hope this helps. >> Tom >> >> >> On 20.04.2012 09:23, gsagrawal wrote: >> >> 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 >> <mailto:e_mc...@web.de> >> <mailto:e_mc...@web.de <mailto: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 reduction, yet) just a multiplication >> of >> (huge) polys. >> >> As I said, I'll run some timing tests to figure out the >> bottleneck. >> But I'm not sure this algorithm can work with such huge >> expressions. >> Even the "staircase" function (which just enumerates all >> monomials >> below a certain degree) takes ages (I am not sure why, yet. The >> dense representation does not seem to be a problem.) >> >> >> On 20.04.2012 08:53, Aaron Meurer wrote: >> >> 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 over many variables. This is >> because as a >> "dense" representation, it tends to waste a lot of space, and as a >> "recursive" representation, many of the functions are literally >> written recursively, which is expensive in Python (take >> dmp_mul for >> example). >> >> So we really need to work toward a sparse representation >> in the >> polys >> to start to get a real speedup here. >> >> Aaron Meurer >> >> On Fri, Apr 20, 2012 at 1:29 AM, Tom >> Bachmann<e_mc...@web.de <mailto:e_mc...@web.de> >> <mailto:e_mc...@web.de <mailto:e_mc...@web.de>>> wrote: >> >> >> >> I tried the expressions from >> https://groups.google.com/d/__**__topic/sympy/3y6orHV2_4k/____** >> discussion<https://groups.google.com/d/____topic/sympy/3y6orHV2_4k/____discussion> >> <https://groups.google.com/d/_**_topic/sympy/3y6orHV2_4k/__** >> discussion<https://groups.google.com/d/__topic/sympy/3y6orHV2_4k/__discussion> >> > >> >> >> <https://groups.google.com/d/_**_topic/sympy/3y6orHV2_4k/__** >> discussion<https://groups.google.com/d/__topic/sympy/3y6orHV2_4k/__discussion> >> <https://groups.google.com/d/**topic/sympy/3y6orHV2_4k/** >> discussion<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 good >> stress tests for this. >> >> >> Well these expressions are *huge*. I will run some >> timing >> tests, but I think >> all parts of the algorithm will break down (i.e. become >> infeasible >> computationally) long before that length. >> >> >> -- >> 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 <mailto:sympy@googlegroups.com**> >> <mailto:sympy@googlegroups.com <mailto:sympy@googlegroups.com** >> >__>. >> >> >> To unsubscribe from this group, send email to >> >> sympy+unsubscribe@__googlegrou**__ps.com<http://googlegrou__ps.com> >> <http://googlegroups.com> >> >> <mailto:sympy%2Bunsubscribe@__**googlegroups.com<http://googlegroups.com> >> >> <mailto:sympy%252Bunsubscribe@**googlegroups.com<sympy%25252bunsubscr...@googlegroups.com> >> >>. >> >> >> For more options, visit this group at >> >> http://groups.google.com/____**group/sympy?hl=en<http://groups.google.com/____group/sympy?hl=en> >> >> <http://groups.google.com/__**group/sympy?hl=en<http://groups.google.com/__group/sympy?hl=en> >> > >> >> >> <http://groups.google.com/__**group/sympy?hl=en<http://groups.google.com/__group/sympy?hl=en> >> >> <http://groups.google.com/**group/sympy?hl=en<http://groups.google.com/group/sympy?hl=en> >> >>. >> >> >> >> >> -- >> 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 >> <mailto:sympy@googlegroups.com**> >> <mailto:sympy@googlegroups.com <mailto:sympy@googlegroups.com** >> >__>. >> >> >> To unsubscribe from this group, send email to >> >> sympy+unsubscribe@__googlegrou**__ps.com<http://googlegrou__ps.com>< >> http://googlegroups.com> >> >> <mailto:sympy%2Bunsubscribe@__**googlegroups.com<http://googlegroups.com> >> >> <mailto:sympy%252Bunsubscribe@**googlegroups.com<sympy%25252bunsubscr...@googlegroups.com> >> >>. >> >> >> For more options, visit this group at >> >> http://groups.google.com/____**group/sympy?hl=en<http://groups.google.com/____group/sympy?hl=en> >> >> <http://groups.google.com/__**group/sympy?hl=en<http://groups.google.com/__group/sympy?hl=en> >> > >> >> >> <http://groups.google.com/__**group/sympy?hl=en<http://groups.google.com/__group/sympy?hl=en> >> >> <http://groups.google.com/**group/sympy?hl=en<http://groups.google.com/group/sympy?hl=en> >> >>. >> >> >> >> -- >> 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 >> <mailto:sympy@googlegroups.com**>. >> To unsubscribe from this group, send email to >> sympy+unsubscribe@__googlegrou**ps.com <http://googlegroups.com> >> >> <mailto:sympy%2Bunsubscribe@**googlegroups.com<sympy%252bunsubscr...@googlegroups.com> >> >. >> For more options, visit this group at >> >> http://groups.google.com/__**group/sympy?hl=en<http://groups.google.com/__group/sympy?hl=en> >> >> <http://groups.google.com/**group/sympy?hl=en<http://groups.google.com/group/sympy?hl=en> >> >. >> >> >> -- >> 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 >> <mailto:sympy@googlegroups.com**>. >> To unsubscribe from this group, send email to >> sympy+unsubscribe@__googlegrou**ps.com <http://googlegroups.com> >> >> <mailto:sympy%2Bunsubscribe@**googlegroups.com<sympy%252bunsubscr...@googlegroups.com> >> >. >> For more options, visit this group at >> >> http://groups.google.com/__**group/sympy?hl=en<http://groups.google.com/__group/sympy?hl=en> >> >> <http://groups.google.com/**group/sympy?hl=en<http://groups.google.com/group/sympy?hl=en> >> >. >> >> >> -- >> 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+unsubscribe@**googlegroups.com<sympy%2bunsubscr...@googlegroups.com> >> . >> For more options, visit this group at >> http://groups.google.com/**group/sympy?hl=en<http://groups.google.com/group/sympy?hl=en> >> . >> > > -- > 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+unsubscribe@** > googlegroups.com <sympy%2bunsubscr...@googlegroups.com>. > For more options, visit this group at http://groups.google.com/** > group/sympy?hl=en <http://groups.google.com/group/sympy?hl=en>. > > -- 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...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sympy?hl=en.