Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2000
*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 2000

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

Search the Archive

Re: NIntegrate within FixedPoint (HoldAll)

  • To: mathgroup at smc.vnet.net
  • Subject: [mg24582] Re: NIntegrate within FixedPoint (HoldAll)
  • From: Albert Maydeu-Olivares <amaydeu at tinet.fut.es>
  • Date: Tue, 25 Jul 2000 00:56:14 -0400 (EDT)
  • Organization: Universitat de Barcelona
  • References: <8lgpvk$1r3@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hello everyone,

I have been able to locate the source of the problem I posted in the
group, but I still do not know how to solve it. In any case, you may
skip my previous message.

Let,

pdf2[h_, k_, x_] := N[E^((-(k*(k/(1 - x^2) - (h*x)/(1 - x^2))) - 
          h*(h/(1 - x^2) - (k*x)/(1 - x^2)))/2)/(2*Pi*Sqrt[1 - x^2]),
16];
cdf1[h_] := Chop[N[(1 + Erf[h/Sqrt[2]])/2, 16]];
cdf2[h_, k_, r_] := Chop[Module[{x}, 
        NIntegrate[E^((-(k*(k/(1 - x^2) - (h*x)/(1 - x^2))) - 
                        h*(h/(1 - x^2) - (k*x)/(1 - x^2)))/2)/(2*Pi*
                  Sqrt[1 - x^2]), {x, 0, r}, PrecisionGoal -> 10] + 
          cdf1[h] cdf1[k]]];

where cdf1 and cdf2 are the uni and bivariate standard normal CDF
functions.

For some values of t1, t2, and r I generate some "data"

In[2] =
t1 = 1.; t2 = -1.; r = .3;
obs = cdf2[t1, t2, r]
Clear[r]

Out[2]=
0.148338

Now, I recover the value r from obs using Newton's method (for fixed t1
and t2)

In[41]:=
step[r_] := r - (cdf2[t1, t2, r] - obs)/pdf2[t1, t2, r];
FixedPointList[step, .2, SameTest -> (Abs[#1 - #2] < 10.^(-6) &)]
Out[42]=
{0.2, 0.293054, 0.299959, 0.3, 0.3}

However, when I divide the step in FixedPoint in parts

a := cdf2[t1, t2, r];
b := obs;
c := pdf2[t1, t2, r];
step[r_] := r - (a - b)/c;
FixedPointList[step, .2, SameTest -> (Abs[#1 - #2] < 10.^(-6) &)]

I obtain the following error

NIntegrate::"nlim": "\!\(x$50\) = \!\(r\) is not a valid limit of \
integration."

I would like to know how can I get this piece of code to work. It's not
working because of the attribute HoldAll.

Any help would be sincerely appreciated.

Albert


  • Prev by Date: Any ideas?
  • Next by Date: Re: Newbie Question - Integrated C++
  • Previous by thread: Re: Any ideas?
  • Next by thread: Manipulating Slot objects in Compile