flonk
flonk

Reputation: 3876

simplify an expression with given rules which are functional relations

In maple one can simplify expression using self-defined rules, like for example

> simplify(x*y,{x=y+1})
y^2+y

In contrast, what I need is the ability to pass rules which are in functional form, i.e. something like

> wantedcommand(f(a)*f(b), f(x)=g(x+3))
g(a+3)*g(b+3)

Does somebody know how to achieve this?

Upvotes: 2

Views: 194

Answers (2)

Carl Love
Carl Love

Reputation: 1471

applyrule(f(x::anything)= g(x+3), f(a)*f(b));

Upvotes: 3

acer
acer

Reputation: 7246

ee := f(a)*f(b):

applyrule(f(x::anything)=g(x+3), ee);

                           g(a + 3) g(b + 3)

subsindets(ee,specfunc(anything,f),t->g(op(t)+3));

                           g(a + 3) g(b + 3)

Upvotes: 1

Related Questions