applyrule
applying rules
Calling Sequence
Parameters
Description
Examples
applyrule(rule, expr)
applyrule([rule1, rule2, ...], expr)
expr
-
expression the rules are applied to
rule
With applyrule a rule or a list of rules can be applied to a given expression. applyrule computes the fix point, it applies the rules until no rule can be applied any more. It is more powerful than the command subs, but does not do mathematical transformations as algsubs does.
Rules are given as equations or in the syntax of the pattern matcher with parameters. See patmatch.
applyrule⁡a+b=x,f⁡a+b+c
f⁡x+c
applyrule⁡x=y,x2
y2
applyrule⁡x2=y,f⁡x2,exp⁡sin⁡x+2⁢x2
f⁡y,ⅇsin⁡x+2⁢y
applyrule⁡f⁡a::integer⁢x=a⁢f⁡x,f⁡2⁢x+g⁡x−f⁡p⁢x
2⁢f⁡x+g⁡x−f⁡p⁢x
applyrule⁡a::even=even,a::prime=prime,1,2,4,3,5,6,4,8,15,21
1,even,even,prime,prime,even,even,even,15,21
applyrule⁡sin⁡2⁢x=2⁢sin⁡x⁢cos⁡x,sin⁡x+sin⁡2⁢x−cos⁡x
sin⁡x+2⁢sin⁡x⁢cos⁡x−cos⁡x
See Also
algsubs
compiletable
define
patmatch
subs
Download Help Document