Skip to main content
5 of 5
added 1 character in body
Ying Zhang
  • 343
  • 1
  • 8

Turn definitions into rules

I know that this seems to be unnecessary, but here I have a bunch of assignments, like around 50, and I want to create rules for all these to have the freedom to apply these rules only on certain expressions. However I can't find an efficient way to do this. Please help.

Here's an example:

I want to turn the following assignment expressions:

a = Cosh[ξ0];
b = Sinh[ξ0];
d = Coth[ξ0];
c = 1/((Sinh[ξ0])^2*Cosh[ξ0])^(1/3);
...

into a rule:

subabcd = {
   a -> Cosh[ξ0],
   b -> Sinh[ξ0],
   d -> Coth[ξ0],
   c -> 1/((Sinh[ξ0])^2*Cosh[ξ0])^(1/3)
   };

Problem is I got more then 50 of the definitions..

Clear is also not efficient because I have to put in all those names of the variables.

Ying Zhang
  • 343
  • 1
  • 8