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 theorems)

Indeed we have no csc and sec. In any case, the algorithm cannot really deal with them (because csc and 1/sin look "equally good" to it).

   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 )

What do you mean loops. Passing hint=[5] or so? Then yes, this is going to get slow, for various reasons. It should never produce worse results though, at least in terms of (1) the total degree of the result, and (2) the number of terms. It will eventually turn things like sin(x)**3 into linear expressions of sin(3x) etc, though.

   3. before going to apply ratsimpmodprime function we can call some
      basic identity substitution (sample code is given in the end)

That's what the curent trigsimp does. There really isn't much point in applying identities this algorithm knows about. What the code should do is replace occurrences of e.g. cot(x) by 1/tan(x), and then perhaps in the end undo such things if the result gets somehow "nicer"

   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 (in this case cos(x)**2) if it can be rewritten in terms of smaller or equal degree. One could try to do a final optimization step where *all* terms of said degree are used, but this is going to get slow even faster...

In any case, thank you for pointing this issue out, I'm taking note of it.

   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 )

No this does not work. The formulas have to be polynomials. In fact, the formulas we "pass" are those listed under "ideal". The groebner basis computation is essentially some magic. It generates many more formulae which are needed for complicated reasons.

   6. And yes sometime it gives very funny expressions


Examples?

I

Thank you :-).

--
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sympy?hl=en.

Reply via email to