Re: Sheer frustration with integration of piecewise continuous functions
- To: mathgroup at smc.vnet.net
- Subject: [mg40911] Re: Sheer frustration with integration of piecewise continuous functions
- From: bobhanlon at aol.com (Bob Hanlon)
- Date: Thu, 24 Apr 2003 05:24:22 -0400 (EDT)
- References: <b85m4u$ace$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
This will work much better if you use UnitStep
f[x_,L_,fpeak_]:=
fpeak/L(5x/3*UnitStep[x]+
(L-5x/3)*UnitStep[x-3L/5]+
(10(L-x)-L)*UnitStep[x-9L/10]-
10(L-x)*UnitStep[x-L]);
Plot[f[x,1,1],{x,-0.1,1.1},
PlotStyle -> {AbsoluteThickness[2], RGBColor[1, 0, 0]}];
FullSimplify[Integrate[f[x,L,fpeak],{x,0,L}], L>=0]
(-(13/20))*fpeak*L*(-1 + UnitStep[-L])
However, since
Simplify[%, L==0]
0
The result is just
FullSimplify[%%, L>0]
(13*fpeak*L)/20
Bob Hanlon
In article <b85m4u$ace$1 at smc.vnet.net>, Madhusudan Singh
<spammers-go-here at yahoo.com> wrote:
<<
Subject: Sheer frustration with integration of piecewise continuous
functions
From: Madhusudan Singh <spammers-go-here at yahoo.com>
To: mathgroup at smc.vnet.net
Date: Wed, 23 Apr 2003 09:24:46 +0000 (UTC)
Clear["'*"];
(*ClearAttributes[Which, HoldAll];*)
f[x_, L_, fpeak_] := (fpeak /L) Which[((0 <= x) && (x < 0.6 L)), x/(0.6
),((0.6 L <= x) && (x <= 0.9 L)), L, ((0.9 L < x) && (x <= L)) , 10 (L
-x)];
Plot[f[x, 1, 1], {x, 0, 1}];
Print[Integrate[f[x, L, fpeak], {x, 0, L}, Assumptions -> {L >= 0, fpeak >=
0, x >= 0, x <= L}]];
I have struggled with the above integration (believe me, its just a test
case, I have a much more complicated function) for an hour now.
What is missing above ? The plot evaluates but the integral does not. Why
does Mathematica make it so damned difficult to work with piecewise
continuous functions ?
>><BR><BR>