Items tagged with applyrule applyrule Tagged Items Feed

Question about applyrule

February 04 2013 by jeilerts 25 Maple

Hi,

I have an expression which contains terms like cos(3*x)*cos(x) + sin(3*x)*sin(x). In this expression, I replace the prevous terms by using applyrule as:

applyrule([cos(3*x)*cos(x)=1/2*(cos(2*x)+cos(4*x)), sin(3*x)*sin(x)=1/2(cos(2*x)-cos(4*x))],expr);

 

Is there a way to generalize this so that I may replace all forms of sin(n*x)*sin(m*x) = 1/2(cos((n-m)*x)-cos((n+m)*x))?

 

Thanks for your help.

I have a question about the "applyrule" function. I have an expression that looks like:

 

exprsn1:=sin(z)(Acos(z) + Bcos(x)cos(2z) + Ccos(x));

 

I would like to express cos(2z)sin(z) in the form 1/2(sin(3z)-sin(z)). However, when I use the "applyrule" as:

exprsn2 := applyrule(sin(z)cos(2z)=1/2(sin(3z)-sin(z), exprsn1);

it returns the same expression. Is there something else I should be doing before I use applyrule?

Following an earlier thread (Collect-And-Sqrt) where a solution using applyrule was proposed (and that solution works), I tried to use applyrule to implement some of the trig half-angle relationships. Immediately I ran into trouble:

Say I want to use the rule

r:=cos(th::algebraic)=2*cos(th/2)^2-1;

so I say

applyrule(r,cos(alpha));

and Maple promptly goes into an...

here is an equation

eq := I*`ℏ`*(sum((diff(c[n](t), t))*f[n](r)*exp(-I*omega[n]*t), n = l .. k)) = (1/2)*E[0](e_.r_)*e*(sum(c[n](t)*f[n](r)*omega[n]*(exp(I*t*(-omega[n]+Omega))+exp(-I*t*(omega[n]+Omega))), n = l .. k))

req := Int(conjugate(f[m](r))*rhs(eq), r)

leq := Int(conjugate(f[m](r))*lhs(eq), r)

sup:=Int(conjugate(f[m](r))*f[n](r), r) = delta[m, n]

ans:=applyrule(sup,leq=req)

how can get the result as

ans := I*`ℏ`*(diff(c[m...

applyrule

November 24 2010 by acer 8701

@Alejandro Jakubi Alejandro this is something like the 3rd time in as many weeks that you have used applyrule to nice effect, deftly providing a more general solution.

This is great because applyrule deserves more notice, if not as a bug-free command then certainly as representative of a symbolic problem-solving methodology. (And heavier use can lead to more bug...

Page 1 of 1