Re: simplify a trig expression
- To: mathgroup at smc.vnet.net
- Subject: [mg65456] Re: simplify a trig expression
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Mon, 3 Apr 2006 06:59:21 -0400 (EDT)
- Organization: The Open University, Milton Keynes, UK
- References: <200603311109.GAA15029@smc.vnet.net> <200604011038.FAA07301@smc.vnet.net> <e0o58m$1vf$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Murray Eisenberg wrote: > OK, now how about the following--another case where Mathematica gives a > more complicated looking answer than the typical paper-and-pencil direct > substitution would provide? > > Mathematica gives: > > Integrate[Sin[x]/(1 - Cos[x]), x] > 2*Log[Sin[x/2]] > > I'd like an answer in the form of Log[1-Cos[x]] (plus a constant, to > actually equal the above). The best I've been able to do so far is: > > (Integrate[Sin[x]/(1 - Cos[x]), x] > // Simplify[# /. a_*Log[b_]:>Log[b^a]] & > //MapAt[TrigReduce, #, 1]&) /. (Log[c_ b_]->Log[b]+Log[c]) > -Log[2] + Log[1 - Cos[x]] > > Is there some easier way? > > Andrzej Kozlowski wrote: >> This is one of those cases where FullSimplify will not work because >> it lacks a suitable transformation function. In this particular case >> the transformation function is of the form: >> >> f[n_*Log[a_]] := Log[a^n] >> >> Of course this is only valid with various assumptions on n and a, but >> I won't bother with this here. Anyway, observe that: >> >> >> FullSimplify[Integrate[Cos[x]/(Sin[x] + 1), x], >> TransformationFunctions -> {Automatic, f}] >> >> >> Log[Sin[x] + 1] >> >> Note also that Simplify will not work even when you add f. >> >> I am not sure if there are good reasons for adding a version of f >> (taking account of suitable assumptions) to the default >> transformation functions of FullSimplify. It may however be a good >> idea to have another possible value for the option >> TransformationFunctions besides only Automatic and user defined ones. >> In fact I have suggested in the past one or two other useful >> TransformationFunctions; perhaps it might be a good idea to define >> more and collect them into a single option value or maybe several. >> >> Andrzej Kozlowski >> >> >> >> >> >> >> On 31 Mar 2006, at 13:09, Murray Eisenberg wrote: >> >>> A direct substitution (with paper and pencil) gives that the >>> integral of >>> Cos[x]/(Sin[x] + 1) is Log[Sin[x] + 1]. This is valid provided >>> Sin[x] >>> is not -1. >>> >>> Mathematica gives: >>> >>> Integrate[Cos[x]/(Sin[x] + 1), x] >>> 2 Log[Cos[x/2] + Sin[x/2]] >>> >>> Is there some simple way to coerce the latter Mathematica-supplied >>> result into the paper-and-pencil answer? >>> >>> The closest I could get is: >>> >>> Log[TrigExpand[Expand[(Cos[x/2] + Sin[x/2])^2]]] /. >>> {Sin[x/2] -> Sqrt[(1 - Cos[x])/2], >>> Cos[x/2] -> Sqrt[(1 + Cos[x])/2]} >>> Log[1 + Sqrt[1 - Cos[x]]*Sqrt[1 + Cos[x]]] >>> >>> Am I not seeing some easier TrigExpand or TrigReduce method? Hi Murray, What about the following? In[1]:= Integrate[Sin[x]/(1 - Cos[x]), x] /. (n_)*Log[x_] :> PowerExpand[Log[TrigReduce[x^n]]] Out[1]= -Log[2] + Log[1 - Cos[x]] In[2]:= Integrate[Cos[x]/(Sin[x] + 1), x] /. (n_)*Log[x_] :> PowerExpand[Log[TrigReduce[x^n]]] Out[2]= Log[1 + Sin[x]] Best regards, JM
- References:
- Re: simplify a trig expression
- From: Andrzej Kozlowski <akoz@mimuw.edu.pl>
- Re: simplify a trig expression