 Forum index » Science and Technology » Math » num-analysis
Author Message
glare22@gmail.com
science forum beginner

Joined: 12 Jul 2006
Posts: 7 Posted: Wed Jul 12, 2006 9:02 am    Post subject: Is there a program for numerically integrating a PDF to get CDF I want to get the CDF from the integration of a given PDF. Is there any
good codes I can use for this purpose? Currently I use the program
dqk15i.f from the quadpack. But the result is not good. especially, for
the PDF with a sharp peak, it gives totally wrong results. Is there any
other programs which can deal with semi-infinite range? Is there anyone
can help me? Thanks. Torsten Hennig
science forum Guru Wannabe

Joined: 28 Apr 2005
Posts: 136 Posted: Wed Jul 12, 2006 10:27 am    Post subject: Re: Is there a program for numerically integrating a PDF to get CDF Quote: I want to get the CDF from the integration of a given >PDF. Is there any good codes I can use for this purpose? Currently I use >the program dqk15i.f from the quadpack. But the result is not good. >especially, for the PDF with a sharp peak, it gives totally wrong >results. Is there any other programs which can deal with semi-infinite range? >Is there anyone can help me? Thanks.

Hi,

in which form is the pdf given ? analytic formula ?
number of hits in a finite number of intervals resulting
from a monte-carlo-simulation ?

Best wishes
Torsten. glare22@gmail.com
science forum beginner

Joined: 12 Jul 2006
Posts: 7 Posted: Wed Jul 12, 2006 8:40 pm    Post subject: Re: Is there a program for numerically integrating a PDF to get CDF Yes, the PDF has the anaytical funciton as p=
exp(-(u1+sqrt(abs(u1^2+4*u2*(u-u0+u2))))^2/8/u2^2/sqrt(2*pi*abs(u1^2+4*u2*(u-u0+u2))).
u0 is mean, u1 is standard deviation, u2 is the skewness.
what should I do? Thanks.

Liang

Torsten Hennig wrote:
 Quote: I want to get the CDF from the integration of a given >PDF. Is there any good codes I can use for this purpose? Currently I use >the program dqk15i.f from the quadpack. But the result is not good. >especially, for the PDF with a sharp peak, it gives totally wrong >results. Is there any other programs which can deal with semi-infinite range? >Is there anyone can help me? Thanks. Hi, in which form is the pdf given ? analytic formula ? number of hits in a finite number of intervals resulting from a monte-carlo-simulation ? Best wishes Torsten. Torsten Hennig
science forum Guru Wannabe

Joined: 28 Apr 2005
Posts: 136 Posted: Thu Jul 13, 2006 7:11 am    Post subject: Re: Is there a program for numerically integrating a PDF to get CDF Torsten Hennig wrote:
 Quote: I want to get the CDF from the integration of a given >PDF. Is there any good codes I can use for this purpose? Currently I use >the program dqk15i.f from the quadpack. But the result is not good. >especially, for the PDF with a sharp peak, it gives totally wrong >results. Is there any other programs which can deal with semi-infinite range? >Is there anyone can help me? Thanks. Hi, in which form is the pdf given ? analytic formula ? number of hits in a finite number of intervals resulting from a monte-carlo-simulation ? Best wishes Torsten. Yes, the PDF has the anaytical funciton as p= exp(-(u1+sqrt(abs(u1^2+4*u2*(u-u0+u2))))^2/8/u2^2/sqrt>(2*pi*abs(u1^2+4*u2*(u-u0+u2))). u0 is mean, u1 is standard deviation, u2 is the skewness. what should I do? Thanks.

Hi,

let u*>0 be such that the pdf is small for |u|>u*.
Then use an integrator for ordinary differential
equations to solve the problem
F'(u)= exp(-(u1+sqrt(abs(u1^2+4*u2*(u-u0+u2))))
^2/8/u2^2/sqrt(2*pi*abs(u1^2+4*u2*(u-u0+u2))),
with initial condition F(-u*)=0 in the range [-u*,u*].

Good integrators for ODEs automatically choose the
step size adaptively so that sharp gradients
in the cdf should be well resolved.

Of course, because the ODE does not contain the
dependent variable F, the use of quadpack is also

Best wishes
Torsten. glare22@gmail.com
science forum beginner

Joined: 12 Jul 2006
Posts: 7 Posted: Fri Jul 14, 2006 11:44 pm    Post subject: Re: Is there a program for numerically integrating a PDF to get CDF Thank Torsten a lot.

Torsten Hennig wrote:
 Quote: Torsten Hennig wrote: I want to get the CDF from the integration of a given >PDF. Is there any good codes I can use for this purpose? Currently I use >the program dqk15i.f from the quadpack. But the result is not good. >especially, for the PDF with a sharp peak, it gives totally wrong >results. Is there any other programs which can deal with semi-infinite range? >Is there anyone can help me? Thanks. Hi, in which form is the pdf given ? analytic formula ? number of hits in a finite number of intervals resulting from a monte-carlo-simulation ? Best wishes Torsten. Yes, the PDF has the anaytical funciton as p= exp(-(u1+sqrt(abs(u1^2+4*u2*(u-u0+u2))))^2/8/u2^2/sqrt>(2*pi*abs(u1^2+4*u2*(u-u0+u2))). u0 is mean, u1 is standard deviation, u2 is the skewness. what should I do? Thanks. Hi, let u*>0 be such that the pdf is small for |u|>u*. Then use an integrator for ordinary differential equations to solve the problem F'(u)= exp(-(u1+sqrt(abs(u1^2+4*u2*(u-u0+u2)))) ^2/8/u2^2/sqrt(2*pi*abs(u1^2+4*u2*(u-u0+u2))), with initial condition F(-u*)=0 in the range [-u*,u*]. Good integrators for ODEs automatically choose the step size adaptively so that sharp gradients in the cdf should be well resolved. Of course, because the ODE does not contain the dependent variable F, the use of quadpack is also possible. Then follow Peter's advice. Best wishes Torsten. Paul Abbott

Joined: 19 May 2005
Posts: 99 Posted: Mon Jul 17, 2006 7:40 am    Post subject: Re: Is there a program for numerically integrating a PDF to get CDF glare22@gmail.com wrote:

 Quote: Yes, the PDF has the anaytical funciton as p= exp(-(u1+sqrt(abs(u1^2+4*u2*(u-u0+u2))))^2/8/u2^2/sqrt(2*pi*abs(u1^2+4*u2*(u-u 0+u2))). u0 is mean, u1 is standard deviation, u2 is the skewness.

This is inconsistent. Analytic computation of the mean of this PDF yields

mean = u0 - u2 - u1^2/(4 u2)

 Quote: what should I do?

Also, note that other moments of this PDF can be computed in
closed-form. For example, the variance is

(u1^4 BesselK[6, u1/(4 Sqrt[2 Pi] u2^2)])/
(16 u2^2 BesselK[2, u1/(4 Sqrt[2 Pi] u2^2)])

Since you have access to Mathematica, it is straightforward to use
NDSolve to compute the CDF.

Cheers,
Paul

_______________________________________________________________________
Paul Abbott Phone: 61 8 6488 2734
School of Physics, M013 Fax: +61 8 6488 1014
The University of Western Australia (CRICOS Provider No 00126G)
AUSTRALIA http://physics.uwa.edu.au/~paul  Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First
 The time now is Tue Mar 26, 2019 4:21 am | All times are GMT Forum index » Science and Technology » Math » num-analysis
 Jump to: Select a forum-------------------Forum index|___Science and Technology    |___Math    |   |___Research    |   |___num-analysis    |   |___Symbolic    |   |___Combinatorics    |   |___Probability    |   |   |___Prediction    |   |       |   |___Undergraduate    |   |___Recreational    |       |___Physics    |   |___Research    |   |___New Theories    |   |___Acoustics    |   |___Electromagnetics    |   |___Strings    |   |___Particle    |   |___Fusion    |   |___Relativity    |       |___Chem    |   |___Analytical    |   |___Electrochem    |   |   |___Battery    |   |       |   |___Coatings    |       |___Engineering        |___Control        |___Mechanics        |___Chemical

 Topic Author Forum Replies Last Post Similar Topics How to solve linear program with matrix variable ? Fan num-analysis 4 Thu Jul 13, 2006 5:55 am Is there a program for numerically integrating a PDF to g... glare22@gmail.com num-analysis 2 Wed Jul 12, 2006 9:08 am DONT let the CHILD RAPING EVIL AMERICAN GOVT PSYCHOPATHS ... McGinnn Math 2 Sun Jul 09, 2006 10:28 pm Integrating t^(-3/2) * e^(1/t) Konrad Viltersten Math 7 Wed Jul 05, 2006 2:27 pm eCheminfo Drug Discovery Community of Practice Meeting, B... The Ferryman Chem 1 Tue Jun 27, 2006 2:17 pm