Re: Simplification During Integration
- To: mathgroup at smc.vnet.net
- Subject: [mg21480] Re: [mg21391] Simplification During Integration
- From: Andrzej Kozlowski <andrzej at tuins.ac.jp>
- Date: Tue, 11 Jan 2000 04:17:58 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Allan: You are right of course, but my point was rather different. I meant to point out that it is not desirable *in general* to try to stop mathematica changing the terms not involving the variable of integration because such transformations may be really needed to perform the integration. (Moreover, your trick applies only to this particular case and will have to be changed each time it is used). To see my point, just consider the following simple example: y = (Sin[2g]*Log[Sin[t]] - 2Sin[g]*Cos[g]Log[Sin[t]] + t)/Sqrt[1 + t]; Letting Mathematica do it by itself gives: In[2]:= Integrate[y, t] // Timing Out[2]= 4 2 t {0.0833333 Second, (-(-) + ---) Sqrt[1 + t]} 3 3 Adapting your trick to account for the presence of 2g and g among the parameters gives: In[3]:= Timing[Integrate[y /. p:_[(k_.) g] :> A[p], t] /. A[p_] -> p] Out[3]= 4 2 t {2.31667 Second, (-(-) + ---) Sqrt[1 + t]} 3 3 If you look at the Trace of this you will see that all you have done is given Mathemaitca lots of extra work without any benefit. I think in general your trick is only safe to use in very simple cases which can be done by hand. The best approach is, in my opinion, th eone suggested by Bob Hanlon: to use Simplify both before and after the integration. > From: "Allan Hayes" <hay at haystack.demon.co.uk> To: mathgroup at smc.vnet.net > Date: Mon, 10 Jan 2000 16:02:19 -0000 > To: "Andrzej Kozlowski" <andrzej at tuins.ac.jp> > Subject: [mg21480] Re: [mg21391] Simplification During Integration > > Andrzej: > > With > Integrate[Factor[y], t] > > Sin[g]^2*(2*t*Cos[g/2]^3*Sec[g]*Sin[g/2] - > Cos[g/2]*Sec[g]*Sin[g/2]^3*Sin[2*t])*Tan[g]^2 > > we still have some changes. > But we can use > > > Integrate[y /. p : _[g] :> A[p], t] /. A[p_] -> p > > (1*Sin[g]^2*Sin[2*t]*(Sin[g] - Tan[g])*Tan[g]^2)/4 + > (1*t*Sin[g]^2*Tan[g]^2*(Sin[g] + Tan[g]))/2 > > > Allan > --------------------- > Allan Hayes > Mathematica Training and Consulting > Leicester UK > www.haystack.demon.co.uk > hay at haystack.demon.co.uk > Voice: +44 (0)116 271 4198 > Fax: +44 (0)870 164 0565 > > > > "Andrzej Kozlowski" <andrzej at tuins.ac.jp> wrote in message > news:84s751$q6r at smc.vnet.net... >> This happen only in rather special cases, usually involving triginometric >> functions. If you prefer you can make Mathematica factor out the common >> terms, e.g. : >> >> In[14]:= >> Integrate[Factor[y], t] >> Out[14]= >> 2 g 3 g >> Sin[g] (2 t Cos[-] Sec[g] Sin[-] - >> 2 2 >> >> g g 3 2 >> Cos[-] Sec[g] Sin[-] Sin[2 t]) Tan[g] >> 2 2 >> >> You can't however in general stop Mathematica transforming the remaining >> terms (even those that do not depend on the variable of integration) since >> it is often the case that one can reduce an integral to a form that can > be >> integrated only by performing such transformations. >> >> >>> From: Joel Storch <jstorch at earthlink.net> To: mathgroup at smc.vnet.net >>> Organization: EarthLink Network, Inc. >>> Date: Mon, 3 Jan 2000 03:12:24 -0500 (EST) >>> To: mathgroup at smc.vnet.net >>> Subject: [mg21480] [mg21391] Simplification During Integration >>> >>> In performing a definite or indefinite integral, Mathematica performs >>> transformations on parameters which are not dependent upon the variable >>> of integration. How do I supress this type of behavior ? >>> >>> Example: Consider the two term expression >>> >>> y=Tan[g]^2 Sin[g]^3 Cos[t]^2 + Tan[g]^3 Sin[g]^2 Sin[t]^2 >>> >>> Integrate[y,{t,0,a}] results in an expression in which the >>> trigonometric functions of g have been transformed. I would >>> expect Mathematica to recognize that these factors are independent of t >>> and simply "pull them out" from the integral. Integrating either of the > >>> terms separately, does not result in these type of transformations. >>> >> >> > > >