Close
Close window
applyrule examples - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Mozilla Firefox.
Maplesoft logo
Maplesoft logo

Online Help

All Products Maple MapleSim


[フレーム] [フレーム]

Applyrule

Introduction

With applyrule , a rule or a list of rules can be applied to a given expression. applyrule computes the fix point; it applies the rule until it cannot be applied anymore. It is more powerful than the command subs , but does not do mathematical transformations as algsubs does.

>

restart

Examples

Syntax: applyrule(rule, expression) where rule is a rule or a set of rules.
The syntax for rule is the same as that used in the pattern matcher. (For more details, see the help page of patmatch .)

A simple manipulation:

>

applyrulea+b=x,fa+b+c

fx+c

(2.1)
>

applyrulex=y,x2

y2

(2.2)
>

applyrulex2=y,fx2,ⅇsinx+2x2

fy,ⅇsinx+2y

(2.3)

One can use parameters in applyrule:

>

applyrulefa::integerx=afx,f2x+gxpfx

2fx+gxpfx

(2.4)

applyrule can be used over data structures:

>

applyrulea::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

(2.5)
>

applyrulesin2x=2sinxcosx,sinx+sin2xcosx

sinx+2sinxcosxcosx

(2.6)

Return to Example Worksheet Index


Download Help Document

AltStyle によって変換されたページ (->オリジナル) /