Neat inverting of log rule
- To: mathgroup at yoda.physics.unc.edu
- Subject: Neat inverting of log rule
- From: rvs at amnesix.kfunigraz.ac.at (Reinhard V.Simonovits)
- Date: Mon, 14 Mar 1994 19:36:43 +0100
Dear MathGroupers!
I am looking for a neat implementation of "inverse log rules";
I tried
Off[General::spell1]
log[a_ b_] = log[a] + log[b]; log[a_^n_] = n log[a];
expr = log[a b^2 c^3]
log[a] + 2 log[b] + 3 log[c]
ok, it works. The goal is to invert the rules, to get log[a b^2 c^3].
Apply[ f, expr, 2]
f[a] + f[ 2, f[b]] + f[3, f[c]]
exprtemp = Apply[f, expr, 2] //. { f[a_] + f[b_] -> f[a b],
f[n_, f[a_] -> f[b^n] }
f[a b^2 c^3]
Apply[ HoldForm[log], exprtemp ]
log[a b^2 c^3]
Ok.
I think, my changing of the label is anyway "unfair".
Can anyone give me an advice how to obtain the same result
using only the log label?
This means to make log forget about its two first learned
rules when inverting the expr.
Reinhard Simonovits,
Univ. Graz, Austria