NIntegrate singularity problem v4.0 vs v5.0
- To: mathgroup at smc.vnet.net
- Subject: [mg44412] NIntegrate singularity problem v4.0 vs v5.0
- From: soummer at stsci.edu (Remi Soummer)
- Date: Sat, 8 Nov 2003 04:50:54 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Hi, the following code runs on v4.0.1 but not on v5.0, because of the changes in NIntegrate function. It seems that v5.0 cannot handle the conditional definition of the function K[]. There is a singularity for r=xi and I tried to use the new option in v5.0, removing the conditional definition of K[] and giving the singularity point r=x directly to NIntegrate : \!\(Terme[x_, \[Alpha]_, \[Lambda]_] := \(\((2 \[Pi])\)\^2\) NIntegrate[r\ \ K[r, x, \[Alpha], \[Lambda]], {r, 0, x, 1\/2}]\) it works fine for this function, but produces an other error in the following integrals. If someone has ideas about this problem or could help me, I will greatly appreciate ! Thanks, Rémi here is the code: \!\(K[r_, \[Xi]_, \[Alpha]_, \[Lambda]_] := \(1\/\(2\ \[Pi]\ \[Lambda]\ \ \((r\^2 - \[Xi]\^2)\)\)\) \((r\ \[Alpha]\ BesselJ[ 0, \(2\ \[Pi]\ \[Alpha]\ \[Xi]\)\/\[Lambda]]\ BesselJ[ 1, \(2\ \[Pi]\ r\ \[Alpha]\)\/\[Lambda]] - \[Alpha]\ \[Xi]\ \ BesselJ[0, \(2\ \[Pi]\ r\ \[Alpha]\)\/\[Lambda]]\ BesselJ[ 1, \(2\ \[Pi]\ \[Alpha]\ \[Xi]\)\/\[Lambda]])\) /; UnsameQ[r, \[Xi]]\n K[r_, \[Xi]_, \[Alpha]_, \[Lambda]_] := \(\[Alpha]\^2\ \((BesselJ[0, \(2\ \ \[Pi]\ \[Alpha]\ r\)\/\[Lambda]]\^2 + BesselJ[1, \(2\ \[Pi]\ \[Alpha]\ r\)\/\ \[Lambda]]\^2)\)\)\/\(2\ \[Lambda]\^2\) /; SameQ[r, \[Xi]]\n Terme[x_, \[Alpha]_, \[Lambda]_] := \(\((2 \[Pi])\)\^2\) NIntegrate[r\ \ K[r, x, \[Alpha], \[Lambda]], {r, 0, 1\/2}]\n \(PsiC[x_, r1_, r2_, z1_, z2_, \[Lambda]_] := 1 + Terme[x, r2, \[Lambda]] \((\[ExponentialE]\^\(\[ImaginaryI]\ \ 2 \[Pi]\ 2\ \ z2/\[Lambda]\) - 1)\) + Terme[x, r1, \[Lambda]] \((\[ExponentialE]\^\(\[ImaginaryI]\ \ 2 \[Pi]\ 2\ \ z1/\[Lambda]\) - \[ExponentialE]\^\(\[ImaginaryI]\ \ 2 \[Pi]\ 2\ z2/\ \[Lambda]\))\);\)\n \(Cr[r1_, r2_, z1_, z2_] := NIntegrate[ NIntegrate[ 2 \[Pi]\ x\ Abs[PsiC[x, r1, r2, z1, z2, \[Lambda]]]\^2, {x, 0, .5}], {\[Lambda], .8, 1.2}];\)\n Cr[ .3, .5, 2.1, 1.5]\)