Re: Integration of "Which"
- To: mathgroup at smc.vnet.net
- Subject: [mg32123] Re: [mg32113] Integration of "Which"
- From: BobHanlon at aol.com
- Date: Fri, 28 Dec 2001 02:41:39 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
In a message dated 12/27/01 5:03:29 AM, klepachd at yahoo.com writes: >This is as a follow up to my last question about integration of Which . >My problem is alittle more complicated: > >W[i_, x_]:= Which[[i == 1,Which[0 <= x <= 1/2, 0, 1/2 < x <= 1,2(x - >1)], > i == 2,Which[0 <= x <= 1/2, 2x, 1/2 < x <= 1, 2(1 - x)] > i == 3,Which[0 <= x <=\ 1/2, 1 - 2x, 1/2 < x <= 1,0 ]]; >k[x_] := 1 + x; > >K[i_, j_, x_] := > N[-(Integrate[D[W[j, x], x]* > D[W[i, x], x]*k[x], > {x, 0, 1/2}] + > Integrate[D[W[j, x], x]* > D[W[i, x], x]*k[x], > {x, 1/2, 1}])] >so I can`t use UnitStep , maybe ramp will work? >Anyway I can`t integrate this , is there a way to solve this ? > Needs["Graphics`Colors`"]; The three components of W are Plot[{2(x-1)UnitStep[x-1/2], 2(x+(1-2x)UnitStep[x-1/2]), (1-2x)(1-UnitStep[x-1/2])}, {x,0,1}, PlotStyle -> {Red, Green, Blue}, Frame -> True, Axes -> False]; The index i merely functions as a selector switch W[i_, x_] := (i-2)(i-3)(x-1)UnitStep[x-1/2] - (i-1)(i-3)2(x + (1-2x)UnitStep[x-1/2]) + (i-1)(i-2)/2(1-2x)(1-UnitStep[x-1/2]); Plot[{W[1,x], W[2,x], W[3,x]}, {x,0,1}, PlotStyle -> {Red, Green, Blue}, Frame -> True, Axes -> False]; k[x_] := 1+x; Since you integrate out the dependence on x, K is only a function of i and j K[i_,j_]:= Evaluate[ Module[{dj = Simplify[D[W[j,x],x]], di = Simplify[D[W[i,x],x]]}, -Integrate[ Simplify[dj*di*k[x]],{x,0,1}]]]; The case i=j=1 is handled separately K[1,1] = -Integrate[D[2(x-1), x]^2*k[x], {x,1/2,1}]; Table[K[i,j],{i,3},{j,3}] {{-(7/2), 1/2, 0}, {1/2, -6, 5/2}, {0, 5/2, -(5/2)}} Bob Hanlon Chantilly, VA USA