// @(#)root/mathmore:$Id$
// Authors: B. List 29.4.2010

/**********************************************************************
*                                                                    *
* Copyright (c) 2004 ROOT Foundation,  CERN/PH-SFT                   *
*                                                                    *
* This library is free software; you can redistribute it and/or      *
* modify it under the terms of the GNU General Public License        *
* as published by the Free Software Foundation; either version 2     *
* of the License, or (at your option) any later version.             *
*                                                                    *
* This library is distributed in the hope that it will be useful,    *
* but WITHOUT ANY WARRANTY; without even the implied warranty of     *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU   *
* General Public License for more details.                           *
*                                                                    *
* You should have received a copy of the GNU General Public License  *
* along with this library (see file COPYING); if not, write          *
* to the Free Software Foundation, Inc., 59 Temple Place, Suite      *
* 330, Boston, MA 02111-1307 USA, or contact the author.             *
*                                                                    *
**********************************************************************/

// Header file for class VavilovAccurateQuantile
//
// Created by: blist  at Thu Apr 29 11:19:00 2010
//
// Last update: Thu Apr 29 11:19:00 2010
//
#ifndef ROOT_Math_VavilovAccurateQuantile
#define ROOT_Math_VavilovAccurateQuantile

#include "Math/IParamFunction.h"
#include "Math/VavilovAccurate.h"

#include <memory>

namespace ROOT {
namespace Math {

//____________________________________________________________________________
/**
Class describing the Vavilov quantile function.

The probability density function of the Vavilov distribution
is given by:
\f[ p(\lambda; \kappa, \beta^2) =
\frac{1}{2 \pi i}\int_{c-i\infty}^{c+i\infty} \phi(s) e^{\lambda s} ds\f]
where \f$\phi(s) = e^{C} e^{\psi(s)}\f$
with  \f$C = \kappa (1+\beta^2 \gamma )\f$
and \f$\psi(s)&=& s \ln \kappa + (s+\beta^2 \kappa) \cdot \left ( \int \limits_{0}^{1} \frac{1 - e^{\frac{-st}{\kappa}}}{t} \,\der t- \gamma \right ) - \kappa \, e^{\frac{-s}{\kappa}}\f$.
\f$\gamma = 0.5772156649\dots\f$ is Euler's constant.

The parameters are:
- 0: Norm: Normalization constant
- 1: x0:   Location parameter
- 2: xi:   Width parameter
- 3: kappa: Parameter \f$\kappa\f$ of the Vavilov distribution
- 4: beta2: Parameter \f$\beta^2\f$ of the Vavilov distribution

Benno List, June 2010

@ingroup StatFunc
*/

class VavilovAccurateQuantile: public IParametricFunctionOneDim {
public:

/**
Default constructor
*/
VavilovAccurateQuantile();

/**
Constructor with parameter values
@param p vector of doubles containing the parameter values (Norm, x0, xi, kappa, beta2).
*/
VavilovAccurateQuantile(const double *p);

/**
Destructor
*/
virtual ~VavilovAccurateQuantile ();

/**
Access the parameter values
*/
virtual const double * Parameters() const;

/**
Set the parameter values
@param p vector of doubles containing the parameter values (Norm, x0, xi, kappa, beta2).

*/
virtual void SetParameters(const double * p );

/**
Return the number of Parameters
*/
virtual unsigned int NPar() const;

/**
Return the name of the i-th parameter (starting from zero)
*/
virtual std::string ParameterName(unsigned int i) const;

/**
Evaluate the function

@param x The Quantile \f$z\f$ , \f$0 \le z \le 1\f$
*/
virtual double DoEval(double x) const;

/**
Evaluate the function, using parameters p

@param x The Quantile \f$z\f$, \f$0 \le z \le 1\f$
@param p vector of doubles containing the parameter values (Norm, x0, xi, kappa, beta2).
*/
virtual double DoEvalPar(double x, const double * p) const;

/**
Return a clone of the object
*/
virtual IBaseFunctionOneDim  * Clone() const;

private:
double fP[5];

};

} // namespace Math
} // namespace ROOT

#endif /* ROOT_Math_VavilovAccurateQuantile */

VavilovAccurateQuantile.h:1
VavilovAccurateQuantile.h:2
VavilovAccurateQuantile.h:3
VavilovAccurateQuantile.h:4
VavilovAccurateQuantile.h:5
VavilovAccurateQuantile.h:6
VavilovAccurateQuantile.h:7
VavilovAccurateQuantile.h:8
VavilovAccurateQuantile.h:9
VavilovAccurateQuantile.h:10
VavilovAccurateQuantile.h:11
VavilovAccurateQuantile.h:12
VavilovAccurateQuantile.h:13
VavilovAccurateQuantile.h:14
VavilovAccurateQuantile.h:15
VavilovAccurateQuantile.h:16
VavilovAccurateQuantile.h:17
VavilovAccurateQuantile.h:18
VavilovAccurateQuantile.h:19
VavilovAccurateQuantile.h:20
VavilovAccurateQuantile.h:21
VavilovAccurateQuantile.h:22
VavilovAccurateQuantile.h:23
VavilovAccurateQuantile.h:24
VavilovAccurateQuantile.h:25
VavilovAccurateQuantile.h:26
VavilovAccurateQuantile.h:27
VavilovAccurateQuantile.h:28
VavilovAccurateQuantile.h:29
VavilovAccurateQuantile.h:30
VavilovAccurateQuantile.h:31
VavilovAccurateQuantile.h:32
VavilovAccurateQuantile.h:33
VavilovAccurateQuantile.h:34
VavilovAccurateQuantile.h:35
VavilovAccurateQuantile.h:36
VavilovAccurateQuantile.h:37
VavilovAccurateQuantile.h:38
VavilovAccurateQuantile.h:39
VavilovAccurateQuantile.h:40
VavilovAccurateQuantile.h:41
VavilovAccurateQuantile.h:42
VavilovAccurateQuantile.h:43
VavilovAccurateQuantile.h:44
VavilovAccurateQuantile.h:45
VavilovAccurateQuantile.h:46
VavilovAccurateQuantile.h:47
VavilovAccurateQuantile.h:48
VavilovAccurateQuantile.h:49
VavilovAccurateQuantile.h:50
VavilovAccurateQuantile.h:51
VavilovAccurateQuantile.h:52
VavilovAccurateQuantile.h:53
VavilovAccurateQuantile.h:54
VavilovAccurateQuantile.h:55
VavilovAccurateQuantile.h:56
VavilovAccurateQuantile.h:57
VavilovAccurateQuantile.h:58
VavilovAccurateQuantile.h:59
VavilovAccurateQuantile.h:60
VavilovAccurateQuantile.h:61
VavilovAccurateQuantile.h:62
VavilovAccurateQuantile.h:63
VavilovAccurateQuantile.h:64
VavilovAccurateQuantile.h:65
VavilovAccurateQuantile.h:66
VavilovAccurateQuantile.h:67
VavilovAccurateQuantile.h:68
VavilovAccurateQuantile.h:69
VavilovAccurateQuantile.h:70
VavilovAccurateQuantile.h:71
VavilovAccurateQuantile.h:72
VavilovAccurateQuantile.h:73
VavilovAccurateQuantile.h:74
VavilovAccurateQuantile.h:75
VavilovAccurateQuantile.h:76
VavilovAccurateQuantile.h:77
VavilovAccurateQuantile.h:78
VavilovAccurateQuantile.h:79
VavilovAccurateQuantile.h:80
VavilovAccurateQuantile.h:81
VavilovAccurateQuantile.h:82
VavilovAccurateQuantile.h:83
VavilovAccurateQuantile.h:84
VavilovAccurateQuantile.h:85
VavilovAccurateQuantile.h:86
VavilovAccurateQuantile.h:87
VavilovAccurateQuantile.h:88
VavilovAccurateQuantile.h:89
VavilovAccurateQuantile.h:90
VavilovAccurateQuantile.h:91
VavilovAccurateQuantile.h:92
VavilovAccurateQuantile.h:93
VavilovAccurateQuantile.h:94
VavilovAccurateQuantile.h:95
VavilovAccurateQuantile.h:96
VavilovAccurateQuantile.h:97
VavilovAccurateQuantile.h:98
VavilovAccurateQuantile.h:99
VavilovAccurateQuantile.h:100
VavilovAccurateQuantile.h:101
VavilovAccurateQuantile.h:102
VavilovAccurateQuantile.h:103
VavilovAccurateQuantile.h:104
VavilovAccurateQuantile.h:105
VavilovAccurateQuantile.h:106
VavilovAccurateQuantile.h:107
VavilovAccurateQuantile.h:108
VavilovAccurateQuantile.h:109
VavilovAccurateQuantile.h:110
VavilovAccurateQuantile.h:111
VavilovAccurateQuantile.h:112
VavilovAccurateQuantile.h:113
VavilovAccurateQuantile.h:114
VavilovAccurateQuantile.h:115
VavilovAccurateQuantile.h:116
VavilovAccurateQuantile.h:117
VavilovAccurateQuantile.h:118
VavilovAccurateQuantile.h:119
VavilovAccurateQuantile.h:120
VavilovAccurateQuantile.h:121
VavilovAccurateQuantile.h:122
VavilovAccurateQuantile.h:123
VavilovAccurateQuantile.h:124
VavilovAccurateQuantile.h:125
VavilovAccurateQuantile.h:126
VavilovAccurateQuantile.h:127
VavilovAccurateQuantile.h:128
VavilovAccurateQuantile.h:129
VavilovAccurateQuantile.h:130
VavilovAccurateQuantile.h:131
VavilovAccurateQuantile.h:132
VavilovAccurateQuantile.h:133
VavilovAccurateQuantile.h:134
VavilovAccurateQuantile.h:135
VavilovAccurateQuantile.h:136
VavilovAccurateQuantile.h:137
VavilovAccurateQuantile.h:138
VavilovAccurateQuantile.h:139
VavilovAccurateQuantile.h:140
VavilovAccurateQuantile.h:141
VavilovAccurateQuantile.h:142
VavilovAccurateQuantile.h:143