Re: Difference between the following integrals....

*To*: mathgroup at smc.vnet.net*Subject*: [mg66155] Re: Difference between the following integrals....*From*: Bill Rowe <readnewsciv at earthlink.net>*Date*: Mon, 1 May 2006 01:30:51 -0400 (EDT)*Sender*: owner-wri-mathgroup at wolfram.com

On 4/30/06 at 4:21 AM, ashesh.cb at gmail.com (ashesh) wrote: >Would like to integrate Abs[x]*(x+3y^2) for {x,-2,2} and {y,-1,2}. >Have four different ways of doing this integration as follows: >f1 = Abs[x](x + 3y y); >Integrate[f3, {x, -2, 2}, {y, -1, 2}] I assume there is a typo here and you actually did Integrate[f1, {x, -2, 2}, {y, -1, 2}] >f2[a_, b_] := Piecewise[{{a*(a + 3*b*b), a > 0}, {-a*(a + 3*b*b), a >< 0}}] ii = Integrate[f2[a, b], {a, -2, 2}, {b, -1, 2}] >f3[p_, q_] := Which[p < 0, -p*(p + 3*q*q), p > 0, p*(p + 3*q*q)] >Integrate[f3[p, q], {p, -2, -2}, {q, -1, 2}] <snip> >As I understand all these 4 are performing the same operation, but >why does f3 become = 0. Look at the integration limits you set for p. They run from -2 to -2 causing the answer to be zero. I assume you meant to have the integration limits set to run from -2 to 2. Making that change results in the same answer as the other methods. -- To reply via email subtract one hundred and four