Re: Piecewise Integration Woes

• To: mathgroup at smc.vnet.net
• Subject: [mg63399] Re: [mg63388] Piecewise Integration Woes
• From: pdesai1 at umbc.edu
• Date: Thu, 29 Dec 2005 02:57:30 -0500 (EST)
• References: <200512280855.DAA28668@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```>  mathgroup at smc.vnet.net; Tue, 27 Dec 2005 17:33:45 -0600 (CST)
> From: Bruce Colletti <vze269bv at verizon.net>
To: mathgroup at smc.vnet.net
> Subject: [mg63399] [mg63388] Piecewise Integration Woes
>
> Re Mathematica 5.2 under WinXP.
>
> h, g, and (presumably f) are continuous functions.
>
> So, what causes the  NIntegrate::slwcon warning?  Although continuous,
> g(h(x)) isn't always differentiable.  Could this be the cause?
>
> Thankx.
>
> Bruce
>
> ------------
>
>
> T = {{16, 113.32}, {20, 68.11}, {900, 0.15}, {1000, 0.13}};
>
> f = Interpolation@T;
>
> h[r_] := Piecewise[{{T[[1, 2]], r < T[[
> 1, 1]]}, {f@r, T[[1, 1]] <= r < T[[-1, 1]]}}, T[[-1, 2]]];
>
> g[x_] := Piecewise at {{0.99, 29 <= x}, {0.99(x - 14.5)/(29 -
>             14.5), 14.5 <= x < 29}}
>
> NIntegrate[g[h@r], {r, 14, 40}, MaxRecursion -> 30]
>
>
Have you tried PiecewiseExpand

NIntegrate[g[h@r]//PiecewiseExpand, {r, 14, 40}, MaxRecursion -> 30]
it seems to work without spitting any error

Version 5.1.1 for windows

Hope this helps

Pratik

```

• Prev by Date: Function creation slows code >10X
• Next by Date: Re: PaddedForm-like behavior for GridBox[]
• Previous by thread: Function creation slows code >10X
• Next by thread: Re: Piecewise Integration Woes