Skip to main content
Made English more idiomatic.
Source Link
m_goldberg
  • 108.6k
  • 16
  • 107
  • 263

I do not have set of rulesa rule, other than to suggest using () for grouping, like this

((x^2 + y + Log[z])^2 /. {y -> x/2} // Expand) /. {z -> E^x} (* x^2/4 + x^3 + x^4 + x Log[E^x] + 2 x^2 Log[E^x] + Log[E^x]^2 *) 

This forces the result of the evaluation of the inner expression, the thing inside (), to be used by the ReplaceAll command after it. So it behaves like

expr /. ReplaceAll 

Which is what you want.

A () pair is not always needed, like here

(x^2 + y + Log[z])^2 /. {y -> x/2} /. z -> E^x 

But if you not sure, just usedo it all the time, it. It won't hurt

( (x^2 + y + Log[z])^2 /. {y -> x/2} ) /. z -> E^x 

The above gives the same answer. But, but it has () to make sure the grouping is as intended.

So, if you want a rule to use, I say usee () to make your intended grouping explicit.

I do not have set of rules, other than to suggest using () for grouping, like this

((x^2 + y + Log[z])^2 /. {y -> x/2} // Expand) /. {z -> E^x} (* x^2/4 + x^3 + x^4 + x Log[E^x] + 2 x^2 Log[E^x] + Log[E^x]^2 *) 

This forces the result of the evaluation of the inner expression, the thing inside (), to be used by the ReplaceAll command after it. So it behaves like

expr /. ReplaceAll 

Which is what you want.

A () is not always needed, like here

(x^2 + y + Log[z])^2 /. {y -> x/2} /. z -> E^x 

But if you not sure, just use it all the time, it won't hurt

( (x^2 + y + Log[z])^2 /. {y -> x/2} ) /. z -> E^x 

The above gives the same answer. But it has () to make sure the grouping is as intended.

So, if you want a rule to use, I say usee () to make your intended grouping explicit.

I do not have a rule, other than to suggest using () for grouping, like this

((x^2 + y + Log[z])^2 /. {y -> x/2} // Expand) /. {z -> E^x} (* x^2/4 + x^3 + x^4 + x Log[E^x] + 2 x^2 Log[E^x] + Log[E^x]^2 *) 

A () pair is not always needed, like here

(x^2 + y + Log[z])^2 /. {y -> x/2} /. z -> E^x 

But if you not sure, just do it all the time. It won't hurt

( (x^2 + y + Log[z])^2 /. {y -> x/2} ) /. z -> E^x 

The above gives the same answer, but it has () to make sure the grouping is as intended.

added 16 characters in body
Source Link
Nasser
  • 156.1k
  • 12
  • 173
  • 396

I do not have set of rules, other than to suggest using () for grouping, like this

((x^2 + y + Log[z])^2 /. {y -> x/2} // Expand) /. {z -> E^x} (* x^2/4 + x^3 + x^4 + x Log[E^x] + 2 x^2 Log[E^x] + Log[E^x]^2 *) 

This forces the evaluation result of the evaluation of the inner expression, the thing inside (), to be used by the ReplaceAll command after it. So it behaves like

expr /. ReplaceAll 

Which is what you want.

A () is not always needed, like here

(x^2 + y + Log[z])^2 /. {y -> x/2} /. z -> E^x 

But if you not sure, just use it all the time, it won't hurt

( (x^2 + y + Log[z])^2 /. {y -> x/2} ) /. z -> E^x 

The above gives the same answer. But it has () to make sure the grouping is as intended.

So, if you want a rule to use, I say usee () to make your intended grouping explicit.

I do not have set of rules, other than to suggest using () for grouping, like this

((x^2 + y + Log[z])^2 /. {y -> x/2} // Expand) /. {z -> E^x} (* x^2/4 + x^3 + x^4 + x Log[E^x] + 2 x^2 Log[E^x] + Log[E^x]^2 *) 

This forces the evaluation result of the inner expression, the thing inside (), to be used by the ReplaceAll command. So it behaves like

expr /. ReplaceAll 

Which is what you want.

A () is not always needed, like here

(x^2 + y + Log[z])^2 /. {y -> x/2} /. z -> E^x 

But if you not sure, just use it all the time, it won't hurt

( (x^2 + y + Log[z])^2 /. {y -> x/2} ) /. z -> E^x 

The above gives the same answer. But it has () to make sure the grouping is as intended.

So, if you want a rule to use, I say usee () to make your intended grouping explicit.

I do not have set of rules, other than to suggest using () for grouping, like this

((x^2 + y + Log[z])^2 /. {y -> x/2} // Expand) /. {z -> E^x} (* x^2/4 + x^3 + x^4 + x Log[E^x] + 2 x^2 Log[E^x] + Log[E^x]^2 *) 

This forces the result of the evaluation of the inner expression, the thing inside (), to be used by the ReplaceAll command after it. So it behaves like

expr /. ReplaceAll 

Which is what you want.

A () is not always needed, like here

(x^2 + y + Log[z])^2 /. {y -> x/2} /. z -> E^x 

But if you not sure, just use it all the time, it won't hurt

( (x^2 + y + Log[z])^2 /. {y -> x/2} ) /. z -> E^x 

The above gives the same answer. But it has () to make sure the grouping is as intended.

So, if you want a rule to use, I say usee () to make your intended grouping explicit.

Source Link
Nasser
  • 156.1k
  • 12
  • 173
  • 396

I do not have set of rules, other than to suggest using () for grouping, like this

((x^2 + y + Log[z])^2 /. {y -> x/2} // Expand) /. {z -> E^x} (* x^2/4 + x^3 + x^4 + x Log[E^x] + 2 x^2 Log[E^x] + Log[E^x]^2 *) 

This forces the evaluation result of the inner expression, the thing inside (), to be used by the ReplaceAll command. So it behaves like

expr /. ReplaceAll 

Which is what you want.

A () is not always needed, like here

(x^2 + y + Log[z])^2 /. {y -> x/2} /. z -> E^x 

But if you not sure, just use it all the time, it won't hurt

( (x^2 + y + Log[z])^2 /. {y -> x/2} ) /. z -> E^x 

The above gives the same answer. But it has () to make sure the grouping is as intended.

So, if you want a rule to use, I say usee () to make your intended grouping explicit.