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
so I say
and Maple promptly goes into an infinite loop somewhere. It works if I use an intermediate name different from cos (in this example):
and then in a 2nd step replace Cos with cos using another applyrule. E.g.:
I concluded that applyrule must work in a looping (or maybe recursive) fashion replacing terms until it can do no more. The docs hint at that. The double-application of the rule seems inefficient and clumsy.
I know I can use simplify with side relations to get a similar effect but sometimes that isn't what one wants. Neither subs nor algsubs work for arbitrary arguments like applyrule so they cannot substitute for applyrule.
Is there any known way to prevent applyrule from looping?