Re: Boolean Integral
- To: mathgroup at smc.vnet.net
- Subject: [mg62447] Re: Boolean Integral
- From: Peter Pein <petsie at dordos.net>
- Date: Thu, 24 Nov 2005 06:33:47 -0500 (EST)
- References: <dlupfj$nb2$1@smc.vnet.net> <dm1ah8$hvk$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
dh schrieb:
> Hi Roberto,
> If your function does not behave too exotic, an increase of the number
> of sample points may help: GaussPoints->n, where n is big enough (see
> the manual).
>
> If your function is slightly pathologic, you may help NIntegrate by
> splitting the integral region into pieces, where the function behaves well.
>
> Plot has an adaptive algorithm to determine the plot points. As a last
> resort, you could get the
>
> Daniel
>
LOL: "get the Daniel" :-))
I'm pretty sure you had something like
In[1]:= f[x_] = Boole[12 < -100*BesselJ[1, x] < 16];
In[2]:= Block[{$DisplayFunction = #1 & },
p = Plot[f[x], {x, 0, 20}, PlotPoints -> 1234]];
In[3]:= Length[p[[1,1,1,1]]]
Out[3]= 42732
In[4]:=reduceLine[l_Line] :=
Module[{ll = l[[1]]},
Scan[Function[{firlas},
ll = Flatten[(Union[{First[#1], Last[#1]}] & ) /@
Split[ll, Equal @@ firlas /@ {##1} & ], 1]],
{First, Last}];
Line[ll]]
In[5]:= Show[p2 =
ReplacePart[p, rlin = reduceLine[p[[1,1,1]]], {1, 1, 1}]]
Out[5]= Graphics[]
In[6]:= Length @@ rlin
Out[6]= 26
In[7]:= -Plus @@ Subtract @@@
Partition[Cases[rlin[[1]], {x_, 1.} :> x], 2]
Out[7]= 1.3377339165593574
in mind !?
Peter