[Date Index]
[Thread Index]
[Author Index]
Re: CauchyPrincipalValue questions
*To*: mathgroup at smc.vnet.net
*Subject*: [mg69669] Re: CauchyPrincipalValue questions
*From*: dh <dh at metrohm.ch>
*Date*: Wed, 20 Sep 2006 02:44:31 -0400 (EDT)
*References*: <eeof5i$23f$1@smc.vnet.net>
Hi,
consider the integral of 1/x by NIntegrate from -1 to 1. I assume
CauchyPrincipalValue calulates soemthing like
Ingegrate[1/x,{x,-1,-eps}]+Ingegrate[1/x,{x,eps,1}]. You will see that
the problem of subtracting similar large numbers is lurching here, tat
results in a loss of precision. With default options
WorkingPrecision==MachinePrecision. From the Help you can see that the
evaluation tries to make the PrecisionGoal equal to half the
$MachinePrecision. This goal is never achieved because the result is
zero and Precision is the relative error of the result, what blows up if
the result comes close to 0.
If you read the error message, it says:
"Achieved neither the requested PrecisionGoal nor AccuracyGoal; suspect
one of the following: highly oscillatory integrand or the true value of
the integral is 0.". Mathematica is 100% right. By setting AccuracyGoal
instead of using Precision, we get result.
I can not answer your second question, but I noted that
CauchyPrincipalValue adds these x for any function. Therefore, I do not
think that it has something to do with the pole, but is only some quirck.
Daniel
dimmechan at yahoo.com wrote:
> Hello to all.
>
> I have two questions about the CauchyPrincipalValue package.
>
> Needs["NumericalMath`CauchyPrincipalValue`"]
>
> First
>
> lst = {1/Sqrt[x], Sin[x]/x};
> N[Integrate[lst, {x, 0, 10}]]
> {6.324555320336759, 1.658347594218874}
>
> However
>
> NIntegrate[lst, {x, 0, 10}]
> \!\(NIntegrate::"inum" : "Integrand \!\({1\/\@x,
> Sin[x]\/x}\) is not numerical at \!\({x}\) = {5.`}"\)
> NIntegrate[lst, {x, 0, 10}]
>
> because NIntegrate has the attribute HoldAll
>
> ({#1, Attributes[#1]} & ) /@ {Integrate, NIntegrate}
> {{Integrate, {Protected, ReadProtected}}, {NIntegrate, {HoldAll,
> Protected}}}
>
> As it well known someone must enclose the argument of NIntegrate in
> Evaluate here.
>
> NIntegrate[Evaluate[lst], {x, 0, 10}]
> {6.324555320387874, 1.6583475942188746}
>
> However why the following command fails, since, as the HelpBrowser
> says, CauchyPrincipalValue uses internally the NIntegrate?
>
> lst2 = {1/(x - Pi/2), Tan[x]};
> CauchyPrincipalValue[Evaluate[lst2], {x, 0, {Pi/2}, Pi}]
> NIntegrate::inum : Integrand (the rest of the messages is not
> displayed...)
> CauchyPrincipalValue[{1/Sqrt[x], Sin[x]/x}, {x, 0, {Pi/2}, Pi}]
>
> My query become even bigger considering that
>
> Attributes[CauchyPrincipalValue]
> {Protected}
>
> My second question follows immediately.
>
> Consider the (numerical evaluation) of CPV of 1/x over {x,-1,2}.
>
> aa = Reap[CauchyPrincipalValue[1/x, {x, -1, {0}, 2}, AccuracyGoal ->
> 20,
> WorkingPrecision -> 30, EvaluationMonitor :> Sow[x]]];
>
> This is the value of the integral
>
> aa[[1]]
> 0.69314718055994530942
>
> This the total number of sampled points by NIntegrate
>
> Length[aa[[2,1]]]
> 273
>
> And here are the last 25 sampled points by NIntegrate.
>
> Take[aa[[2,1]], -25]
> {1.492698661756523787149586238081974793655503742219`29.99999998468416,
> 1.382301338243476212850413761918025206344496257781`29.96663056969523,
> 1.465413938559055852040904875211822497115793411141`29.999999992110578,
> 1.409586061440944147959095124788177502884206588859`29.983131270623772,
> x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x}
>
>>From where appeared all these "x" in the last result?
> It seems that NIntegrate (although the result is not affected
> as it is demonstrated below) fails to sampled the integrand for
> same values of x. Why this happens?
>
> N[Integrate[1/x, {x, -1, 2}, PrincipalValue -> True], 20]
> 0.69314718055994530941723212145817656807`20.
>
> Thanks in advance for any help.
>
Prev by Date:
**Re: Why is the negative root?**
Next by Date:
**Re: CauchyPrincipalValue questions**
Previous by thread:
**CauchyPrincipalValue questions**
Next by thread:
**Re: CauchyPrincipalValue questions**
| |