My code:
r5 = 47000;
vcc = 3.3;
hfe = 420; (* BC337-40: 250 *)
vbe = 0.6;
r4 = vbe/2*^-6;
ctr = 1;
r1 = 1000000; r2 = r1;
vrms = 230;
vled = 1.5;
v0[t_] := Max[vcc - r5 ic[t], 0.2]
ic[t_] := Min[hfe ib[t] + 0.000005, vcc/r5]
ib[t_] := idar[t] - ir4[t]
ir4[t_] := Min[idar[t], vbe/r4]
idar[t_] := Abs[iled[t]] ctr
iled[t_] := Max[Sign[vi[t]] (Max[Abs[vi[t]] - vled, 0])/(r1 + r2), 0]
vi[t_] := vrms Sqrt[2] Sin[2 Pi t/20]
pmains[t_] := vi[t] iled[t]
pvcc[t_] := vcc idar[t] + vcc ic[t]
power[t_] := pmains[t] + pvcc[t]
pvccavg = Integrate[pvcc[t], {t, 0, 20}]/20
MMA gives me this result:

which is my list of nested function calls written as one single function. Why doesn't Integrate work here? Note that it does give me results if I split the [0,20] interval in [0,10] and [10,20].


NIntegrategives you the answer in less than a second – rm -rf Jul 16 '12 at 16:40Absand/orMaxI'm using? – stevenvh Jul 16 '12 at 16:59