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 <[email protected]> wrote: > see inline! > > On Mon, Jun 11, 2012 at 5:10 PM, Sergiu Ivanov > <[email protected]> wrote: >> On Tue, Jun 12, 2012 at 12:05 AM, Kjetil brinchmann Halvorsen >> <[email protected]> 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 >>> unmodified, >>> although I know it is possible to apply rules for getteing >>> sin/cos(theta+/- psi) from difference/sum of product of form >>> sin(theta)cos(psi) etc, but they are not applied! >> >> What are your expressions? It may happen that trigsimp does not know >> how to handle them. >> >>> Now trigsimp has some further arguments, like deep, but they cannot be >>> given with applyfunc? >> >> Use something like: >> >> M.applyfunc(lambda x: trigsimp(x, deep=True)) >> >> Just off the top of my head; I haven't tested it, but it should work. > > works, but does not simplify. My expressions are: > > In [1]: t,s = symbols('t s',real=True) > > In [2]: l1,l2 = symbols(' l1 l2', real=True) > > In [3]: O= Matrix([[cos(t), -sin(t)],[sin(t), cos(t)]] > ...: ) > > In [4]: V=Matrix([[cos(s),-sin(s)],[sin(s),cos(s)]]) > > In [5]: L = Matrix([[l1**2,0],[0,l2**2]]) > > In [23]: E = O * V * L * V.transpose() > > In [24]: E.applyfunc(lambda x: trigsimp(x,deep=True)) > Out[24]: > ⎡ 2 2 > ⎢l₁ ⋅(-sin(s)⋅sin(t) + cos(s)⋅cos(t))⋅cos(s) - l₂ ⋅(-sin(s)⋅cos(t) - sin(t)⋅co > ⎢ > ⎢ 2 2 > ⎣l₁ ⋅(sin(s)⋅cos(t) + sin(t)⋅cos(s))⋅cos(s) - l₂ ⋅(-sin(s)⋅sin(t) + cos(s)⋅cos > > 2 2 > s(s))⋅sin(s) l₁ ⋅(-sin(s)⋅sin(t) + cos(s)⋅cos(t))⋅sin(s) + l₂ ⋅(-sin(s)⋅cos(t > > 2 2 > (t))⋅sin(s) l₁ ⋅(sin(s)⋅cos(t) + sin(t)⋅cos(s))⋅sin(s) + l₂ ⋅(-sin(s)⋅sin(t) > > ⎤ > ) - sin(t)⋅cos(s))⋅cos(s)⎥ > ⎥ > ⎥ > + cos(s)⋅cos(t))⋅cos(s) ⎦ > > Kjetil > > > > >> >> Sergiu >> >> -- >> 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. >> > > > > -- > "If you want a picture of the future - imagine a boot stamping on the > human face - forever." > > George Orwell (1984) -- "If you want a picture of the future - imagine a boot stamping on the human face - forever." George Orwell (1984) -- 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.
