octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: About normcdf() function integration method


From: Rik
Subject: Re: About normcdf() function integration method
Date: Mon, 16 Oct 2017 11:46:06 -0700

On 10/16/2017 09:00 AM, address@hidden wrote:
Subject:
About normcdf() function integration method
From:
José Luis García Pallero <address@hidden>
Date:
10/16/2017 06:23 AM
To:
Octave Maintainers <address@hidden>, Octave Maintainers List <address@hidden>
List-Post:
<mailto:address@hidden>
Content-Transfer-Encoding:
quoted-printable
Precedence:
list
MIME-Version:
1.0
Message-ID:
<address@hidden>
Content-Type:
text/plain; charset="UTF-8"
Message:
2

Hello:

I'm teaching this semester some maths and I'll explain numerical
integration methods. In one exercise the students must write a script
in order to compute areas below the normal distribution curve and then
use the normcdf() function to check the results and the theoretical
error level for the Simpson and the trapezoidal methods.

My question is, which method for numerical integration uses Octave in
normcdf()? If uses the trapezoidal or Simpson method, what is the
level of discretization?

Thanks

The function normcdf() is implemented in an m-file which means you can just look at the source to see what Octave is doing.  Inside normcdf.m there is this line

cdf = stdnormal_cdf ((x - mu) / sigma);

So Octave is centering and scaling the distribution, and then using the CDF for the standard normal function with mu = 0, sigma = 1.

stdnormal_cdf is also implemented as an m-file.  Inside that one finds

  cdf = erfc (x / (-sqrt(2))) / 2;

Octave relies on the C++ standard library for the complimentary error function erfc.

For students, definitely have them try trapz() or one of the 1-D integrators (quad, quadv, quadgk, etc.).

--Rik



reply via email to

[Prev in Thread] Current Thread [Next in Thread]