Re: Sheer frustration with integration of piecewise continuous functions
- To: mathgroup at smc.vnet.net
- Subject: [mg40916] Re: Sheer frustration with integration of piecewise continuous functions
- From: Raibatak Das <rd54 at cornell.edu>
- Date: Thu, 24 Apr 2003 05:25:21 -0400 (EDT)
- References: <b85m4u$ace$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
ms -
are you trying to obtain a numerical estimate for the integral? in that
case following command where you explicitly break up the integral into
its piecewise continuous parts will work
g[x_, L_, fpeak_] := (fpeak/L) Which[((0 <= x) && (x < 0.6 L)),
NIntegrate[t/(0.6), {t, 0, x}], ((0.6 L <= x) && (x <= 0.9 L)),
NIntegrate[t/(0.6), {t, 0, 0.6 L}] +
NIntegrate[L, {t, 0.6 L, x}], ((0.9 L < x) && (x <= L)),
NIntegrate[t/(0.6), {t, 0, 0.6 L}] + NIntegrate[L, {t, 0.6 L, 0.9
L}] +
NIntegrate[10 (L - t), {t, 0.9 L, x}]]
hope this helps.
- rd.
ps. is this madhusudan singh from iitk physics '99?
Madhusudan Singh wrote:
>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 ?
>
>
------------------------------------------------------------------------
* /Raibatak Das / *
Department of Chemistry and Chemical Biology, Cornell University.
Ithaca, NY 14853.
Ph : 1-607-255-6141
email : rd54 at cornell.edu <mailto:rd54 at cornell.edu>