[Date Index]
[Thread Index]
[Author Index]
Re: How to make results from Integrate and NIntegrate agree
*To*: mathgroup at smc.vnet.net
*Subject*: [mg66665] Re: How to make results from Integrate and NIntegrate agree
*From*: Paul Abbott <paul at physics.uwa.edu.au>
*Date*: Fri, 26 May 2006 04:17:35 -0400 (EDT)
*Organization*: The University of Western Australia
*References*: <e510la$8di$1@smc.vnet.net>
*Sender*: owner-wri-mathgroup at wolfram.com
In article <e510la$8di$1 at smc.vnet.net>, riazzi at hotmail.com wrote:
> FrPart[x_]:=(1/2)-ArcTan[Cot[Pi*x]]/Pi
>
> ...
>
> If I integrate this numerically, I get what appears to be the right
> answer, and the plot looks like what I would expect to see:
>
> In[3]=
> nintgrl[x_] := If[x = (1/6), 0, NIntegrate[FrPart[1/u], {u, (1/6),
> x},
> MaxRecursion -> 30, WorkingPrecision -> 30, PrecisionGoal -> 25]]
> Plot[nintgrl[x], {x, 1/6, 1}, PlotStyle -> {Red}];
Instead of using NIntegrate, it is much faster to use NDSolve:
nsol = NDSolve[{y'[x] == 1/2 - ArcTan[Cot[Pi/x]]/Pi, y[1/6] == 0},
y, {x, 1/6, 1}]
Plot[y[x] /. nsol, {x, 1/6, 1}]
> But I don't want to subtract off the contribution of the jumps, nor do
> I want to sum up a (for me infinite) collection of piecewise terms.
Perhaps you could tell us what the real problem is so that other
approaches could be suggested?
> So what I'm looking for is a way to make Integrate produce a closed-form
> expression for my integrand that does not produce these
> discontinuities,
While I'm a big fan of obtaining closed-form expressions, their utility
is variable. Sometimes they are too cumbersome to be useful -- so the
application you have in mind should determine how much work you should
devote to obtaining a closed-form expression.
Note that, since Fr is the fractional part of 1/x, you can compute the
integral (in this simple example) using Piecewise as follows:
g[x_] = Piecewise[Table[{1/x - n, 1/(n + 1) <= x < 1/n]},{n, 5}]]
Integrate[g[x], x]
but this will not work if you have an infinite number of discontinuities.
> plus some insight as to why they appear. I'd guess
> the latter has to do with branch cuts in the complex plane for the
> functions involved, and where the solution might have to do with
> picking a different contour or somesuch, but that's getting into areas
> I've long forgotten or never learned.
David Cantrell and Zdislav V. Kovarik have posted on this topic on
sci.math. Essentially, computer algebra systems often fail to give
continuous antiderivatives for piecewise integrands.
Cheers,
Paul
_______________________________________________________________________
Paul Abbott Phone: 61 8 6488 2734
School of Physics, M013 Fax: +61 8 6488 1014
The University of Western Australia (CRICOS Provider No 00126G)
AUSTRALIA http://physics.uwa.edu.au/~paul
Prev by Date:
**Re: Interval[{a,b}]-Interval[{a,b}] = 0?**
Next by Date:
**RE: scalar field visualization**
Previous by thread:
**Re: How to make results from Integrate and NIntegrate agree**
Next by thread:
**Re: How to make results from Integrate and NIntegrate agree**
| |