Re: Re: Re: Inverse of "PowerExpand"
- To: mathgroup at smc.vnet.net
- Subject: [mg51740] Re: [mg51726] Re: [mg51703] Re: Inverse of "PowerExpand"
- From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
- Date: Sat, 30 Oct 2004 09:30:24 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
I agree with everything below but in this case a further comment perhaps should also be made. The transformation that is being asked for is not universally valid so it seems rather natural that there is no Mathematica function that would perform it. Of course the same is true of PowerExpand, but that is at least partly just a legacy from the day that Mathematica did not have the ability to use assumptions. Nowadays the best way to accomplish both transformations is to make use of the Assumptions mechanism: FunctionExpand[Log[(a*b)/c], {a > 0, b > 0, c > 0}] Log[a] + Log[b] + Log[1/c] FullSimplify[Log[a] + Log[b] - Log[c], {a > 0, b > 0, c > 0}] Log[(a*b)/c] Unfortunately FunctionExpand does not return quite what what we want, although it comes near enough. In fact can do better by using Simplify with arather perverse ComplexityFunction tries to make expressions more "complex" rather than simpler: (the resulting function should be called Complexify but unfortunately thsis word is already reserved for a different meaning ;-) ) Simplify[Log[(a*b)/c],{a>0,b> 0,c>0},ComplexityFunction->(1/LeafCount[#]&)] log(a)+log(b)-log(c) Andrzej Kozlowski Chiba, Japan http://www.akikoz.net/~andrzej/ http://www.mimuw.edu.pl/~akoz/ On 30 Oct 2004, at 16:48, David Park wrote: > *This message was transferred with a trial version of CommuniGate(tm) > Pro* > Klaus, > > This brings up an interesting point about Mathematica that I think is > often > troubling to new users. That is that Mathematica does not have > commands for > everything, for example there is no command for complete the square. If > Mathematica had commands for everything, since mathematics and > computing > applications are so broad and varied, it would end up having millions > of > commands - and then you would have trouble finding the one you need. > > Mathematica is not so much a tool box for doing mathematics, but a > metatoolbox for making the tools you will need to perform calculations > in > your particular application. > > So it is almost always necessary to make definitions or rules and do > programming while using Mathematica. Many people find it difficult to > adjust > to that point of view and may spend much effort trying to find an > existing > Mathematica command to do what they want, when they could much more > quickly > write the necessary tool. > > Of course, sometimes you may write a tool and later find that > Mathematica > has it - but that is a lesser problem. > > David Park > djmp at earthlink.net > http://home.earthlink.net/~djmp/ > > > From: Klaus G [mailto:Karl_boehme_9 at msn.com] To: mathgroup at smc.vnet.net > To: mathgroup at smc.vnet.net > >> Klaus,> One method... >> Log[a] + 2*Log[b] - Log[c]; >> % //. (a_.)*Log[b_] + (c_.)*Log[d_] -> Log[b^a*d^c] >> >> Log[(a*b^2)/c] > > OK. But you assume that you know how to add logarithms.. > > > Klaus G. > > > >