Usually, this kind of task is not a CAS' strength because simplification
mostly relies on a normal form/representation. Even with rewrite rules I
cannot see a general pattern. However, waht you can do is sketched below,
namely using equations, rules and substitutions. Admittedly, it's more the
way theorem prover assistants works than automated simplifaction. If you
have well defined normal form this method may be turned into an algorithm
as well, of course.
I don't know if you deliberatly used "=" (equations in Fricas) or it simpy
was a typo (:= means assignment), anyway, it was the inspiration for the
lines below:
rs:=rule cos(x)*sin(y)-sin(x)*cos(y) == sin(y-x)
rc:=rule cos(x)*cos(y)-sin(x)*sin(y) == cos(x+y)
eq1:= t1 = cos(x)*sin(y)-sin(x)*cos(y)
eq2:= t2 = cos(x)*cos(y)-sin(x)*sin(y)
eq3:= expr = t1*cos(x3) + 5 + tan(q)*tan(w) + t2*w*cos(a)+ t1*t2*r3
eq4:=expr = subst(rhs eq3,t1=rs rhs eq1)
eq5:=expr_s = subst(rhs eq4,t2=rc rhs eq2)
FriCAS Computer Algebra System
Version: FriCAS 1.3.0
Timestamp: Wed Aug 31 20:31:31 GMT 2016
-----------------------------------------------------------------------------
Issue )copyright to view copyright notices.
Issue )summary for a summary of useful system commands.
Issue )quit to leave FriCAS and return to shell.
-----------------------------------------------------------------------------
(2) -> rs:=rule cos(x)*sin(y)-sin(x)*cos(y) == sin(y-x)
(2) cos(x)sin(y) - cos(y)sin(x) + %B == sin(y - x) + %B
Type:
RewriteRule(Integer,Integer,Expression(Integer))
(3) -> rc:=rule cos(x)*cos(y)-sin(x)*sin(y) == cos(x+y)
(3) - sin(x)sin(y) + cos(x)cos(y) + %C == cos(y + x) + %C
Type:
RewriteRule(Integer,Integer,Expression(Integer))
(4) ->
(4) -> eq1:= t1 = cos(x)*sin(y)-sin(x)*cos(y)
(4) t1 = cos(x)sin(y) - cos(y)sin(x)
Type:
Equation(Expression(Integer))
(5) -> eq2:= t2 = cos(x)*cos(y)-sin(x)*sin(y)
(5) t2 = - sin(x)sin(y) + cos(x)cos(y)
Type:
Equation(Expression(Integer))
(6) -> eq3:= expr = t1*cos(x3) + 5 + tan(q)*tan(w) + t2*w*cos(a)+ t1*t2*r3
(6) expr = tan(q)tan(w) + t1 cos(x3) + t2 w cos(a) + r3 t1 t2 + 5
Type:
Equation(Expression(Integer))
(7) ->
(7) -> eq4:=expr = subst(rhs eq3,t1=rs rhs eq1)
(7) expr = tan(q)tan(w) + (cos(x3) + r3 t2)sin(y - x) + t2 w cos(a) + 5
Type:
Equation(Expression(Integer))
(8) -> eq5:=expr_s = subst(rhs eq4,t2=rc rhs eq2)
(8)
expr_s
=
tan(q)tan(w) + (r3 cos(y + x) + cos(x3))sin(y - x) + w cos(a)cos(y +
x) + 5
Type:
Equation(Expression(Integer))
(9) ->
Reagrding "rules", there is an excellent tutorial by Franz Lehner where you
will find more examples (Section 4.5, though it's in German, but that's not
a problem to undersrand the examples):
https://www.math.tugraz.at/mathc/compmath2/Demo/fricas-tutorium-0.6.pdf
On Tuesday, 24 January 2017 23:38:52 UTC+1, Constantine Frangos wrote:
>
>
> I wanted to ask for some assistance in using fricas to
> perform some specific trigonometric simplifications.
>
> (1) The relevant fricas commands or re-write rules to perform
> the following simplifications.
>
> t1 = cos(x)*sin(y)-sin(x)*cos(y) to sin(y-x),
>
> t2 = cos(x)*cos(y)-sin(x)*sin(y) to cos(x+y).
>
> (2) I have expressions which are sums of products of the
> above-mentioned terms. For example,
>
> expr = t1*cos(x3) + 5 + tan(q)*tan(w) + t2*w*cos(a)
> + t1*t2*r3
>
> How can fricas commands be applied in order to simplify
> expr to
>
> expr_s = sin(y-x)*cos(x3) + 5 + tan(q)*tan(w) +
> cos(x+y)*w*cos(a) + sin(y-x)*cos(x+y)*r3 ?
>
>
> Thanks very much.
>
> Regards,
> Constantine Frangos.
>
--
You received this message because you are subscribed to the Google Groups
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.