File indexing completed on 2024-05-12 15:27:09
0001 /*************************************************************************** 0002 File : nsl_sf_stats.c 0003 Project : LabPlot 0004 Description : NSL special statistics functions 0005 -------------------------------------------------------------------- 0006 Copyright : (C) 2016-2017 by Stefan Gerlach (stefan.gerlach@uni.kn) 0007 0008 ***************************************************************************/ 0009 0010 /*************************************************************************** 0011 * * 0012 * This program is free software; you can redistribute it and/or modify * 0013 * it under the terms of the GNU General Public License as published by * 0014 * the Free Software Foundation; either version 2 of the License, or * 0015 * (at your option) any later version. * 0016 * * 0017 * This program is distributed in the hope that it will be useful, * 0018 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0019 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 0020 * GNU General Public License for more details. * 0021 * * 0022 * You should have received a copy of the GNU General Public License * 0023 * along with this program; if not, write to the Free Software * 0024 * Foundation, Inc., 51 Franklin Street, Fifth Floor, * 0025 * Boston, MA 02110-1301 USA * 0026 * * 0027 ***************************************************************************/ 0028 0029 #include "nsl_sf_stats.h" 0030 #include "nsl_common.h" 0031 0032 const char* nsl_sf_stats_distribution_name[] = {i18n("Gaussian (Normal)"), i18n("Gaussian Tail"), i18n("Exponential"), i18n("Laplace"), 0033 i18n("Exponential Power"), i18n("Cauchy-Lorentz (Breit-Wigner)"), i18n("Rayleigh"), i18n("Rayleigh Tail"), i18n("Landau"), i18n("Levy alpha-stable"), 0034 i18n("Levy skew alpha-stable"), i18n("Gamma"), i18n("Flat (uniform)"), i18n("Log-normal (Galton)"), i18n("Chi-squared"), i18n("F (Fisher-Snedecor)"), 0035 i18n("Student's t"), i18n("Beta"), i18n("Logistic (sech-squared)"), i18n("Pareto"), i18n("Weibull"), i18n("Gumbel Type-1 (maximum value; log-Weibull)"), 0036 i18n("Gumbel Type-2"), i18n("Poisson"), i18n("Bernoulli"), i18n("Binomial"), i18n("Negative binomial"), i18n("Pascal"), i18n("Geometric"), 0037 i18n("Hypergeometric"), i18n("Logarithmic"), i18n("Maxwell-Boltzmann"), i18n("Hyperbolic secant (sech)"), i18n("Levy"), i18n("Frechet (inverse Weibull)")}; 0038 const char* nsl_sf_stats_distribution_pic_name[] = { 0039 "gaussian", "gaussian_tail", "exponential", "laplace", "exponential_power", "cauchy_lorentz", "rayleigh", "rayleigh_tail", "landau", 0040 "levy_alpha_stable", "levy_skew_alpha_stable","gamma", "flat", "lognormal", "chi_squared", "fdist", "students_t", "beta", "logistic", 0041 "pareto", "weibull", "gumbel1", "gumbel2", "poisson", "bernoulli", "binomial", "negative_binomial", "pascal", "geometric", 0042 "hypergeometric", "logarithmic", "maxwell_boltzmann", "sech", "levy", "frechet"}; 0043 const char* nsl_sf_stats_distribution_equation[] = { 0044 "a/sqrt(2*pi)/s * exp(-((x-mu)/s)^2/2)", "2*A/sqrt(2*pi)/s/erfc(a/sqrt(2)/s) * exp(-((x-mu)/s)^2/2) * theta(x-mu-a)", "a*l*exp(-l*(x-mu))", 0045 "a/(2*s) * exp(-fabs((x-mu)/s))", "a/(2*s*gamma(1+1/b))*exp(-fabs((x-mu)/s)^b)", "a/pi * g/(g^2 + (x-mu)^2)", 0046 "a * x/s^2 * exp(-(x/s)^2/2)", "a*x/s^2 * exp((mu^2-x^2)/2/s^2)", "a*landau(x)", 0047 "Levy alpha-stable", "Levy-skew", "a/gamma(k)/t^k * x^(k-1)*exp(-x/t)", 0048 "A/(b-a)*theta(b-x)*theta(x-a)", "a/sqrt(2*pi)/x/s * exp(-( (log(x)-mu)/s )^2/2)", "a * x^(n/2.-1.)/2^(n/2.)/gamma(n/2.) * exp(-x/2.)", 0049 "a * fdist(x, n1, n2)", "a*gamma((n+1)/2)/sqrt(pi*n)/gamma(n/2) * (1+x^2/n)^(-(n+1)/2)", "A*gamma(a+b)/gamma(a)/gamma(b) * x^(a-1) * (1-x)^(b-1)", 0050 "a/4/s * sech((x-mu)/2/s)**2", "a/b * (b/x)^(a+1) * theta(x-b)", "a * k/l * ((x-mu)/l)^(k-1) * exp(-((x-mu)/l)^k)", 0051 "a/s * exp(-(x-mu)/s - b*exp(-(x-mu)/s))", "A*a*b * (x-mu)^(-a-1) * exp(-b*(x-mu)^(-a))", "a * l^x/gamma(x+1) * exp(-l)", 0052 "Bernoulli", "a * binomial(x, p, n)", "a * negative_binomial(x, p, n)", 0053 "a * pascal(x, p, n)", "a * geometric(x, p)", "a * hypergeometric(x, n1, n2, t)", 0054 "a * logarithmic(x, p)", "a*sqrt(2/pi) * x^2/s^3 * exp(-(x/s)^2/2)", "a/2/s * sech(pi/2*(x-mu)/s)", 0055 "a * sqrt(g/(2*pi))/pow(x-mu, 1.5) * exp(-g/2./(x-mu))", "a * g/s*((x-mu)/s)^(-g-1) * exp(-((x-mu)/s)^(-g))"}; 0056