Re: Integration problem
- To: mathgroup at smc.vnet.net
- Subject: [mg27452] Re: [mg27417] Integration problem
- From: BobHanlon at aol.com
- Date: Sun, 25 Feb 2001 20:55:59 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Tx1[i_] := ((1/a)*(1 - Abs[x - i*a]/a))*(UnitStep[x - (i - 1)*a] - UnitStep[x - (i + 1)*a]); Ty1[j_] := (UnitStep[y - (j - 1)*b] - UnitStep[y - j*b]); You need to define L and W. L = 5; W = 9; JsxT = Table[Ty1[p]*Tx1[m], {m, L-1}, {p, W}]; JsxSum = Simplify[Sum[JsxT[[m, p]], {m, 1, 4}, {p, 1, 9}]]; The Simplify is used to speed up calculation of the following integral Clear[soln]; soln[a_ /; a != 0, b_] := Evaluate[FullSimplify[Integrate[JsxSum, {x, 0, a}, {y, 0, b}], Element[a, Reals]]] ; Table[soln[a, b], {a, -3, 3}, {b, -3, 3}] {{63/2, 21, 21/2, 0, 21/2, 21, 63/2}, {63/2, 21, 21/2, 0, 21/2, 21, 63/2}, {63/2, 21, 21/2, 0, 21/2, 21, 63/2}, {soln[0, -3], soln[0, -2], soln[0, -1], soln[0, 0], soln[0, 1], soln[0, 2], soln[0, 3]}, {3/2, 1, 1/2, 0, 1/2, 1, 3/2}, {3/2, 1, 1/2, 0, 1/2, 1, 3/2}, {3/2, 1, 1/2, 0, 1/2, 1, 3/2}} a /: a != 0 = True; For a > 0, Simplify[soln[a, b], a > 0] /. {UnitStep[a, b_] -> UnitStep[b], UnitStep[-a, b_] -> 0} /. UnitStep[-b] -> UnitStep[b] - Sign[b] (1/2)*b*Sign[b] Since FullSimplify[b*Sign[b] == Abs[b], Element[b, Reals]] True Then, soln[a_?Positive, b_] := Abs[b]/2; For a <0, FullSimplify[soln[a, b], a < 0] /. {UnitStep[a, b_] -> 0, UnitStep[-a, b_] -> UnitStep[b]} /. UnitStep[-b] -> UnitStep[b] - Sign[b]//Simplify (21/2)*b*Sign[b] Then, Clear[soln]; soln[a_?Positive, b_] := Abs[b]/2; soln[a_?Negative, b_] := 21*Abs[b]/2; Bob Hanlon In a message dated 2001/2/25 1:29:29 AM, drek1976 at yahoo.com writes: >I am presently experiencing some problems with the use of integration in >Mathematica, and I do not understand what could be wrong. >I defined 2 functions as follow: > >Tx1[i_] := ((1/a)*(1 - Abs[x - i*a]/a))*(UnitStep[x - (i - 1)*a] - >UnitStep[x - (i + 1)*a]) >Ty1[j_] := (UnitStep[y - (j - 1)*b] - UnitStep[y - j*b]) > >where a, b are any assigned real values. > >I then formed a matrix as follows: > >JsxT := Table[Ty1[p]*Tx1[m], {m, L - 1}, {p, W}] > >which is then followed by: > >JsxSum = Sum[JsxT[[m,p]], {m, 1, 4}, {p, 1, 9}] > >I then try to integrate JsxSum with respect to x and y in the following >way: > >Integrate[JsxSum, {x, 0, a}, {y, 0, b}] > >When Mathematica (I'm using version 4) tries to work out this last >expression, it outputs the following message: > >"Unique::usym : -0.43661971830985913 is not a symbol or a valid sumbol >name" > >before giving an output. > >This problem occurs whatever values I may use for a and b. >Does someone know why? >