Re: log expression not simplified
- To: mathgroup at smc.vnet.net
- Subject: [mg115698] Re: log expression not simplified
- From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
- Date: Tue, 18 Jan 2011 05:53:23 -0500 (EST)
On 17 Jan 2011, at 11:41, Praeceptor wrote: > Sorry, can anybody help me understand why > > Simplify[Log[a/b]/Log[b/a], Assumptions -> {a > 0, b > a}] > > doesn't reduce to -1 ?? > Thanks (it's for a simple Carnot cycle calculation...)! > Simplify can verify that this is indeed the case Simplify[Log[a/b]/Log[b/a] == -1, Assumptions -> {a > 0, b > a}] True However, it is hard to get it to simplify the expression to -1 because the only way to do so seems to involve temporarily increasing the default complexity. Thus, to get it to work we need a craftily designed custom complexity function, like, for example, this one: f[expr_] := -2 Count[expr, _Log, {0, Infinity}] + LeafCount[expr] This function "rewards" Simplify for expanding logs and, in this case, the "incentive" works: Simplify[Log[a/b]/Log[b/a], Assumptions -> {a > 0, b > a}, ComplexityFunction -> f] -1 But trying to find the right function is clearly not worth the effort; a much better way is to use PowerExpand with Assumptions followed by Simplify: PowerExpand[Log[a/b]/Log[b/a], Assumptions -> {a > 0, b > a}] // Simplify -1 (Using PowerExpand without Assumptions does not guarantee that the answer is correct). Andrzej Kozlowski