Re: Integrate not very aggressive about taking constants out of integrals
- To: mathgroup at smc.vnet.net
- Subject: [mg81436] Re: [mg81400] Integrate not very aggressive about taking constants out of integrals
- From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
- Date: Sun, 23 Sep 2007 04:34:44 -0400 (EDT)
- References: <200709220723.DAA28788@smc.vnet.net>
On 22 Sep 2007, at 16:23, Darryl Yong wrote: > Try the following three few lines of code in Mathematica: > > temp1 = Integrate[-Exp[p[s]] , {s,0,t}]; > temp2 = Integrate[Exp[p[s]] , {s,0,t}]; > temp1+temp2 > > Out[3] = Integrate[-E^p[s], {s, 0, t}] + Integrate[E^p[s], {s, 0, t}] > > FullSimplify[temp1+temp2] > > Out[4] = Integrate[-E^p[s], {s, 0, t}] + Integrate[E^p[s], {s, 0, t}] > > You'll notice that Mathematica doesn't take the negative sign out of > the integral in temp1, so the result of temp1+temp2 is not zero unless > you define something for p[s] and let it actually work out both > integrals. > > Does anyone know of a way to help Mathematica be more aggressive about > taking constants out of integrals? > > Thanks, Darryl > Actually, Integrate is only "aggressive" about integrating and pretty apathetic about doign anything else. If you really need this for something serious (at least more than you example above) then rather than modifyign Integrate or defining your own version you could take advantage of the fundamental theorem of calculus. To illustrate on a slighly less trivial example, let p = Integrate[f[s], {s, 0, t}] + Integrate[-g[s], {s, 0, t}]; then by the FTC this is the same as: Integrate[D[p, t] /. t -> s, {s, 0, t}] Integrate[f[s] - g[s], {s, 0, t}] Andrzej Kozlowski
- References:
- Integrate not very aggressive about taking constants out of integrals
- From: "Darryl Yong" <darrylyong@gmail.com>
- Integrate not very aggressive about taking constants out of integrals