mathf.hpp
Go to the documentation of this file.
1 /* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  Copyright (C) 2006 Ferdinando Ametrano
4 
5  This file is part of QuantLib, a free-software/open-source library
6  for financial quantitative analysts and developers - http://quantlib.org/
7 
8  QuantLib is free software: you can redistribute it and/or modify it
9  under the terms of the QuantLib license. You should have received a
10  copy of the license along with this program; if not, please email
11  <quantlib-dev@lists.sf.net>. The license is also available online at
12  <http://quantlib.org/license.shtml>.
13 
14  This program is distributed in the hope that it will be useful, but WITHOUT
15  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16  FOR A PARTICULAR PURPOSE. See the license for more details.
17 */
18 
19 
20 #ifndef qla_mathf_hpp
21 #define qla_mathf_hpp
22 
23 #include <oh/libraryobject.hpp>
24 #include <ql/math/distributions/normaldistribution.hpp>
25 
26 namespace QuantLibAddin {
27 
28  inline double normDist(double x,
29  double mean,
30  double stdDev,
31  bool cumulative) {
32  if (cumulative) {
33  return QuantLib::CumulativeNormalDistribution(mean, stdDev)(x);
34  } else {
35  return QuantLib::NormalDistribution(mean, stdDev)(x);
36  }
37  }
38 
39  inline double normSDist(double x) {
40  return QuantLib::CumulativeNormalDistribution(0.0, 1.0)(x);
41  }
42 
43  inline double normInv(double prob,
44  double mean,
45  double stdDev) {
46  return QuantLib::InverseCumulativeNormal(mean, stdDev)(prob);
47  }
48 
49  inline double normSInv(double prob) {
50  return QuantLib::InverseCumulativeNormal(0.0, 1.0)(prob);
51  }
52 
53 }
54 
55 #endif
56 
double normSDist(double x)
Definition: mathf.hpp:39
double normInv(double prob, double mean, double stdDev)
Definition: mathf.hpp:43
double normDist(double x, double mean, double stdDev, bool cumulative)
Definition: mathf.hpp:28
Definition: abcd.hpp:38
double normSInv(double prob)
Definition: mathf.hpp:49