1
$\begingroup$

Is it posible to apply ReplaceAll and Expand repeatedly such as?

expression//.{"substitute", "Expand expression"}

A minimal example

A B //. {A B -> B (C + D) , B C ->  1} 

(* B(C+D) *)

However, I want

A B //. {A B -> B (C + D) , B C ->  1} 

(* BC + BD *) 

and finaly

(* 1+BD *)
$\endgroup$
  • 3
    $\begingroup$ Note C is a protected symbol used to generate integration constants and such. D is the differentiation operator. Generally avoid single capital letters for variables and even beginning variables with capitals. $\endgroup$ – Michael E2 Feb 13 '18 at 13:11
1
$\begingroup$

Perhaps this is helpful

rules = {A B -> B (C + D), B C -> 1};
expr = A B;
FixedPoint[
  Expand[ReplaceRepeated[#, rules]] &, expr]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.