Post Closed as "duplicate" by Mr.Wizard of
3 Breaking the line before /. makes the code invalid. Breaking after /. would be okay.
source | link

I tried to do something below

Log[PDF[NormalDistribution[m, s], x]] 
 /.  Log[u_[x__] ] :> Plus @@ Log[List[x]]

which gives a desirable result that splits the expression into pieces. Note that PDF[NormalDistribution[m, s], x] was evaluated of the form Times[a,b,c] and thus u was identified as Times.

However, if I replace u_ by Times, i.e.,

Log[PDF[NormalDistribution[m, s], x]] 
 /.  Log[Times[x__] ] :> Plus @@ Log[List[x]]

then, I got an unexpected result that does not change the expression. Can you explain why I should not use Times even though I know that u_ will match Times in the first example?

I tried to do something below

Log[PDF[NormalDistribution[m, s], x]] 
 /.  Log[u_[x__] ] :> Plus @@ Log[List[x]]

which gives a desirable result that splits the expression into pieces. Note that PDF[NormalDistribution[m, s], x] was evaluated of the form Times[a,b,c] and thus u was identified as Times.

However, if I replace u_ by Times, i.e.,

Log[PDF[NormalDistribution[m, s], x]] 
 /.  Log[Times[x__] ] :> Plus @@ Log[List[x]]

then, I got an unexpected result that does not change the expression. Can you explain why I should not use Times even though I know that u_ will match Times in the first example?

I tried to do something below

Log[PDF[NormalDistribution[m, s], x]] /. Log[u_[x__] ] :> Plus @@ Log[List[x]]

which gives a desirable result that splits the expression into pieces. Note that PDF[NormalDistribution[m, s], x] was evaluated of the form Times[a,b,c] and thus u was identified as Times.

However, if I replace u_ by Times, i.e.,

Log[PDF[NormalDistribution[m, s], x]] /. Log[Times[x__] ] :> Plus @@ Log[List[x]]

then, I got an unexpected result that does not change the expression. Can you explain why I should not use Times even though I know that u_ will match Times in the first example?

2 added 130 characters in body
source | link

I tried to do something below

Log[PDF[NormalDistribution[m, s], x]] 
 /.  Log[u_[x__] ] :> Plus @@ Log[List[x]]

which gives a desirable result that splits the expression into pieces. Note that PDF[NormalDistribution[m, s], x] was evaluated of the form Times[a,b,c] and thus u was identified as Times.

However, if I replace u_ by Times, i.e.,

Log[PDF[NormalDistribution[m, s], x]] 
 /.  Log[Times[x__] ] :> Plus @@ Log[List[x]]

then, I got an unexpected result that does not change the expression. Can you explain why I should not use Times even though I know that u_ will match Times in the first example?

I tried to do something below

Log[PDF[NormalDistribution[m, s], x]] 
 /.  Log[u_[x__] ] :> Plus @@ Log[List[x]]

which gives a desirable result that splits the expression into pieces.

However, if I replace u_ by Times, i.e.,

Log[PDF[NormalDistribution[m, s], x]] 
 /.  Log[Times[x__] ] :> Plus @@ Log[List[x]]

then, I got an unexpected result that does not change the expression. Can you explain why I should not use Times even though I know that u_ will match Times in the first example?

I tried to do something below

Log[PDF[NormalDistribution[m, s], x]] 
 /.  Log[u_[x__] ] :> Plus @@ Log[List[x]]

which gives a desirable result that splits the expression into pieces. Note that PDF[NormalDistribution[m, s], x] was evaluated of the form Times[a,b,c] and thus u was identified as Times.

However, if I replace u_ by Times, i.e.,

Log[PDF[NormalDistribution[m, s], x]] 
 /.  Log[Times[x__] ] :> Plus @@ Log[List[x]]

then, I got an unexpected result that does not change the expression. Can you explain why I should not use Times even though I know that u_ will match Times in the first example?

1
source | link

A puzzling result of the `ReplaceAll`

I tried to do something below

Log[PDF[NormalDistribution[m, s], x]] 
 /.  Log[u_[x__] ] :> Plus @@ Log[List[x]]

which gives a desirable result that splits the expression into pieces.

However, if I replace u_ by Times, i.e.,

Log[PDF[NormalDistribution[m, s], x]] 
 /.  Log[Times[x__] ] :> Plus @@ Log[List[x]]

then, I got an unexpected result that does not change the expression. Can you explain why I should not use Times even though I know that u_ will match Times in the first example?