Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

CauchyPrincipalValue questions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg69644] CauchyPrincipalValue questions
  • From: dimmechan at yahoo.com
  • Date: Tue, 19 Sep 2006 05:44:52 -0400 (EDT)

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: attention 64 bit Mathematica users - would you please test a command for me?
  • Next by Date: Re: question about DiracDelta
  • Previous by thread: Re: an equation containg radicals
  • Next by thread: Re: CauchyPrincipalValue questions