Re: singular point list (NIntegrate)
- To: mathgroup at smc.vnet.net
- Subject: [mg72214] Re: singular point list (NIntegrate)
- From: "dimitris" <dimmechan at yahoo.com>
- Date: Thu, 14 Dec 2006 05:49:45 -0500 (EST)
- References: <elot8j$p9a$1@smc.vnet.net>
Something like?
nintSing1[f_, {x_, a_, b_, c_}, opts___] := Plus @@ (NIntegrate[f, {x,
#1[[1]], #1[[2]]}, opts] & ) /@ Partition[Range[a, b, c], 2, 1]
nintSing1[x^2*Sin[1/x], {x, -1, 3, 1/5}, MinRecursion -> 6,
MaxRecursion -> 12]
3.820553120346208
Or?
nintSing2[f_, {x_, a_, b_, c___}, opts___] := Plus @@ (NIntegrate[f,
{x, #1[[1]], #1[[2]]}, opts] & ) /@ Partition[{a, c, b}, 2, 1]
nintSing2[x^2*Sin[1/x], {x, -1, 3, 0, 1, 2}]
3.820553120346208
Dimitris
Ï/Ç wtplasar at ehu.es Ýãñáøå:
> Hi,
>
> I want to tell Mathematica to deal with the singular points in a
> numerical integration. In particular, I would like to give easily a
> large number of intermediate points. I would do it like that in a
> trivial example
>
>
> mybounds[xmin_,xmax_,divs_]:=
> Prepend[Table[xmin+i*(xmax-xmin)/divs,{i,0,divs}],x]
>
>
> NIntegrate[x^2 Sin[1/x],Evaluate[mybounds[-1,3,20]]]
>
> but I think my way of doing it is not very time efficient because of
> the Evaluate command, so I wonder if there is a way round it.
>
> Thanks,
>
> Ruth