On May 25, 2009, at 11:56 AM, Luke wrote:
>
> Here is the link for the Maxima trigsimp() code. It was written in
> 1981, according to the comments!!!
> http://maxima.cvs.sourceforge.net/viewvc/maxima/maxima/share/trigonometry/trgsmp.mac?revision=1.4&view=markup
>
> I emailed the authors of the Fu et al. paper to see if they would be
> willing to share their implementation of the algorithm -- maybe we can
> save ourselves some work this way.
>
> I want to start coding for this, because much of the stuff I am doing
> in PyDy is heavy on kinematics and the expressions become excessively
> long unless intelligent trigsimplification is possible. Many of my
> unittests simply will not work because some results I know to be true
> cannot be achieved with the current state of trigsimp, so this has
> become a significant limitation for me.
>
> What should be the general framework for implementing the 'rules' that
> are laid out in the Fu paper? There are certainly other rules we
> could find, either on Wikipedia, Mathworld, or in a engineering/
> mathematics reference manual.
>
> I have read over how trigsimp() and trigsimp_nonrecursive() are
> currently implemented, and I think I get the gyst of what the approach
> is. Can somebody explain what this is doing exactly:
> for pattern, simp in matchers:
> res = result.match(pattern)
> ....
>
> I'm not 100% clear on the use of the .match() method, does somebody
> have a quick example of use?
>
This should be res = ret.match(pattern).
match() takes a wildcard expression and matches it into a dictionary.
In the code above, pattern is each of the items in the list
((a*sin(b)**2, a - a*cos(b)**2),(a*tan(b)**2, a*(1/cos(b))**2 - a),
(a*cot(b)**2, a*(1/sin(b))**2 - a)) (it runs a for loop). a, b and c
are wild cards, to it will try to take the expression result and find
what a, b, and c are equal to.
For example, consider the first one: a*sin(b)**2. If your ret ==
4*x*sin(x**2)**2, then running res = ret.match(a*sin(b)**2) will
return the dictionary {a: 4*x, b: x**2}. You can then access a and b
from res[a] and res[b].
You should also probably be aware of the exclude option on Wild. If
you do a = Wild('a', exclude=[sin(x)]), then a will not match anything
with sin(x) in it. Do help(x.matches) for another example.
> It seems like the flow of trigsimp (in the case of recursive==False
> and deep==False):
> 1) call trigsimp_nonrecursive(expr, deep==False), store the result in
> 'result'
> 2) do some final pattern matching on 'result', currently this will
> only simplify a*sin(b)**c/cos(b)**c --> a*tan(b)**c
>
> So, should all the rules in Fu et al. be implemented as a tuple of
> length 2 tuples, similar to the existing matchers tuple?
>
> I'm kind of thinking out loud right now and trying to figure out the
> next step to take....
>
> ~Luke
>
>
> On May 21, 7:42 am, Akshay Srinivasan <[email protected]>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---