Sponsored links: Algebra eBooks
 

Help Index

A

B

C

D

E

F

G

H

I

J

K

L

M

N

O

P

Q

R

S

T

U

V

W

X

Y

Z

The Maxima on-line user's manual

Algebra Calculator

Search:

Defrule

Function: defrule (<rulename>, <pattern>, <replacement>) Defines and names a replacement rule for the given pattern. If the rule named <rulename> is applied to an expression (by apply1, applyb1, or apply2), every subexpression matching the pattern will be replaced by the replacement. All variables in the replacement which have been assigned values by the pattern match are assigned those values in the replacement which is then simplified.

The rules themselves can be treated as functions which transform an expression by one operation of the pattern match and replacement. If the match fails, the rule function returns false.

(%o1)                                true
(%i2) 

Related Examples

defrule-disprule-load-matchdeclare-true

matchdeclare(n, integ...

defrule(fnx, f(nx), n...

disprule(all);

Calculate

defrule-false-simp-true

1/(a*b), simp:true;

1/(a*b), simp:false;

(tellsimp, 1/(a*b), s...

Calculate

defrule-false-simp-tellsimp-tellsimpafter-true

1/(a*b), simp:true;

1/(a*b), simp:false;

tellsimp(1/(a*b), sim...

Calculate

defrule-disprule-matchdeclare-true

matchdeclare(n, integ...

defrule(fnx, f(n*x), ...

disprule(all);

Calculate

defrule-disprule-load-matchdeclare-true

matchdeclare(n, integ...

defrule(fnx, f(nx), n...

disprule(all);

Calculate

defrule-disprule-matchdeclare-true

matchdeclare(n, integ...

defrule(fnx, f(n*x), ...

disprule(all);

Calculate

defrule-disprule-load-matchdeclare-true

matchdeclare(n, integ...

defrule(fnx, f(nx), n...

disprule(all);

Calculate

defrule-false-simp-true

1/(a*b), simp:true;

1/(a*b), simp:false;

(tellsimp, 1/(a*b), s...

Calculate