~ubuntu-branches/ubuntu/quantal/gnumeric/quantal

« back to all changes in this revision

Viewing changes to plugins/fn-stat/functions.c

  • Committer: Bazaar Package Importer
  • Author(s): Gauvain Pocentek
  • Date: 2009-06-22 13:37:20 UTC
  • mfrom: (1.1.20 upstream) (2.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20090622133720-rtdazsiz2lx5q8l7
Tags: 1.9.9-1ubuntu1
* Merge from debian unstable, remaining changes:
  - Promoted gnumeric-doc to Recommends in gnumeric package for help to be
    installed automatically
  - gnumeric-gtk is a transitional package
  - gnumeric conflicts with gnumeric-gtk << 1.8.3-3ubuntu1
  - call initltool-update in po*
  - remove psiconv support (psiconv is in universe):
    o debian/control: remove B-D on libpsiconv-dev
    o debian/rules: don't pass --with-psiconv to ./configure
    o debian/gnumeric-plugins-extra.install: don't install the psiconv
      plugin

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
#include <expr-impl.h>
37
37
#include <func-builtin.h>
38
38
#include <gnm-i18n.h>
39
 
#include <goffice/app/go-plugin.h>
 
39
#include <goffice/goffice.h>
40
40
#include <gnm-plugin.h>
41
41
#include <math.h>
42
42
#include <stdlib.h>
56
56
        { GNM_FUNC_HELP_EXAMPLES, F_("Let us assume that the cells A1, A2, ..., A5 contain number 11.4, 17.3, 21.3, 25.9, and 40.1.")},
57
57
        { GNM_FUNC_HELP_EXAMPLES, F_("Then VARP(A1:A5) equals 94.112")},
58
58
        { GNM_FUNC_HELP_SEEALSO, ("AVERAGE,DVAR,DVARP,STDEV,VAR")},
 
59
        { GNM_FUNC_HELP_EXTREF, F_("wiki:en:Variance") },
 
60
        { GNM_FUNC_HELP_EXTREF, F_("wolfram:Variance.html") },
59
61
        { GNM_FUNC_HELP_END }
60
62
};
61
63
 
82
84
        { GNM_FUNC_HELP_EXAMPLES, F_("Let us assume that the cells A1, A2, ..., A5 contain numbers 11.4, 17.3, 21.3, 25.9, and 40.1.")},
83
85
        { GNM_FUNC_HELP_EXAMPLES, F_("Then VAR(A1:A5) equals 117.64.")},
84
86
        { GNM_FUNC_HELP_SEEALSO, ("VARP,STDEV")},
 
87
        { GNM_FUNC_HELP_EXTREF, F_("wiki:en:Variance") },
 
88
        { GNM_FUNC_HELP_EXTREF, F_("wolfram:Variance.html") },
85
89
        { GNM_FUNC_HELP_END }
86
90
};
87
91
 
110
114
        { GNM_FUNC_HELP_EXAMPLES, F_("Let us assume that the cells A1, A2, ..., A5 contain numbers 11.4, 17.3, 21.3, 25.9, and 40.1.")},
111
115
        { GNM_FUNC_HELP_EXAMPLES, F_("Then STDEV(A1:A5) equals 10.84619749.")},
112
116
        { GNM_FUNC_HELP_SEEALSO, ("AVERAGE,DSTDEV,DSTDEVP,STDEVA,STDEVPA,VAR")},
 
117
        { GNM_FUNC_HELP_EXTREF, F_("wiki:en:Standard_deviation") },
 
118
        { GNM_FUNC_HELP_EXTREF, F_("wolfram:StandardDeviation.html") },
113
119
        { GNM_FUNC_HELP_END }
114
120
};
115
121
 
135
141
        { GNM_FUNC_HELP_EXAMPLES, F_("Let us assume that the cells A1, A2, ..., A5 contain numbers 11.4, 17.3, 21.3, 25.9, and 40.1.")},
136
142
        { GNM_FUNC_HELP_EXAMPLES, F_("Then STDEVP(A1:A5) equals 9.701133954.")},        
137
143
        { GNM_FUNC_HELP_SEEALSO, ("STDEV,STDEVA,STDEVPA")},
 
144
        { GNM_FUNC_HELP_EXTREF, F_("wiki:en:Standard_deviation") },
 
145
        { GNM_FUNC_HELP_EXTREF, F_("wolfram:StandardDeviation.html") },
138
146
        { GNM_FUNC_HELP_END }
139
147
};
140
148
 
261
269
           "B5 23.2, 25.8, 29.9, 33.5, and 42.7.") },
262
270
        { GNM_FUNC_HELP_EXAMPLES, F_("Then COVAR(A1:A5,B1:B5) equals 65.858.") },
263
271
        { GNM_FUNC_HELP_SEEALSO, "CORREL,FISHER,FISHERINV"},
 
272
        { GNM_FUNC_HELP_EXTREF, F_("wiki:en:Covariance") },
 
273
        { GNM_FUNC_HELP_EXTREF, F_("wolfram:Covariance.html") },
264
274
        { GNM_FUNC_HELP_END }
265
275
};
266
276
 
289
299
           "B5 23.2, 25.8, 29.9, 33.5, and 42.7.") },
290
300
        { GNM_FUNC_HELP_EXAMPLES, F_("Then CORREL(A1:A5,B1:B5) equals 0.996124788.") },
291
301
        { GNM_FUNC_HELP_SEEALSO, "COVAR,FISHER,FISHERINV"},
 
302
        { GNM_FUNC_HELP_EXTREF, F_("wiki:en:CorrelationCoefficient.html") },
 
303
        { GNM_FUNC_HELP_EXTREF, F_("wolfram:Covariance.html") },
292
304
        { GNM_FUNC_HELP_END }
293
305
};
294
306
 
341
353
        { GNM_FUNC_HELP_DESCRIPTION, F_("This function is Excel compatible.") },
342
354
        { GNM_FUNC_HELP_EXAMPLES, F_("NORMSDIST(2) equals 0.977249868.") },
343
355
        { GNM_FUNC_HELP_SEEALSO, "NORMDIST"},
 
356
        { GNM_FUNC_HELP_EXTREF, F_("wiki:en:Normal_distribution") },
 
357
        { GNM_FUNC_HELP_EXTREF, F_("wolfram:NormalDistribution.html") },
344
358
        { GNM_FUNC_HELP_END }
345
359
};
346
360
 
357
371
/***************************************************************************/
358
372
 
359
373
static GnmFuncHelp const help_normsinv[] = {
360
 
        { GNM_FUNC_HELP_NAME, F_("NORMSINV:inverse of the cumulative desnity function of the standard normal distribution")},
 
374
        { GNM_FUNC_HELP_NAME, F_("NORMSINV:inverse of the cumulative density function of the standard normal distribution")},
361
375
        { GNM_FUNC_HELP_ARG, F_("p:given probability")},
362
376
        { GNM_FUNC_HELP_NOTE, F_("If @{p} < 0 or @{p} > 1 this function returns #NUM! error.")},
363
377
        { GNM_FUNC_HELP_DESCRIPTION, F_("This function is Excel compatible.") },
364
378
        { GNM_FUNC_HELP_EXAMPLES, F_("NORMSINV(0.2) equals -0.841621234.") },
365
379
        { GNM_FUNC_HELP_SEEALSO, "NORMDIST,NORMINV,NORMSDIST,STANDARDIZE,ZTEST"},
 
380
        { GNM_FUNC_HELP_EXTREF, F_("wiki:en:Normal_distribution") },
 
381
        { GNM_FUNC_HELP_EXTREF, F_("wolfram:NormalDistribution.html") },
366
382
        { GNM_FUNC_HELP_END }
367
383
};
368
384
 
391
407
        { GNM_FUNC_HELP_DESCRIPTION, F_("This function is Excel compatible.") },
392
408
        { GNM_FUNC_HELP_EXAMPLES, F_("LOGNORMDIST(3,1,2) equals 0.519662338.") },
393
409
        { GNM_FUNC_HELP_SEEALSO, "NORMDIST"},
 
410
        { GNM_FUNC_HELP_EXTREF, F_("wiki:en:Log-normal_distribution") },
 
411
        { GNM_FUNC_HELP_EXTREF, F_("wolfram:LogNormalDistribution.html") },
394
412
        { GNM_FUNC_HELP_END }
395
413
};
396
414
 
418
436
        { GNM_FUNC_HELP_DESCRIPTION, F_("This function is Excel compatible.") },
419
437
        { GNM_FUNC_HELP_EXAMPLES, F_("LOGINV(0.5,2,3) equals 7.389056099.")},
420
438
        { GNM_FUNC_HELP_SEEALSO, ("EXP,LN,LOG,LOG10,LOGNORMDIST")},
 
439
        { GNM_FUNC_HELP_EXTREF, F_("wiki:en:Log-normal_distribution") },
 
440
        { GNM_FUNC_HELP_EXTREF, F_("wolfram:LogNormalDistribution.html") },
421
441
        { GNM_FUNC_HELP_END }
422
442
};
423
443
 
444
464
        { GNM_FUNC_HELP_NOTE, F_("If @{x} is a non-number this function returns a #VALUE! error.")},
445
465
        { GNM_FUNC_HELP_DESCRIPTION, F_("This function is Excel compatible.") },
446
466
        { GNM_FUNC_HELP_EXAMPLES, F_("FISHERINV(2) equals 0.96402758.") },
447
 
        { GNM_FUNC_HELP_SEEALSO, "FISHER"},
 
467
        { GNM_FUNC_HELP_SEEALSO, "FISHER,TANH"},
448
468
        { GNM_FUNC_HELP_END }
449
469
};
450
470
 
451
471
static GnmValue *
452
472
gnumeric_fisherinv (GnmFuncEvalInfo *ei, GnmValue const * const *argv)
453
473
{
454
 
       gnm_float y = value_get_as_float (argv[0]);
455
 
 
456
 
       return value_new_float (gnm_expm1 (2 * y) / (gnm_exp (2 * y) + 1.0));
 
474
       return value_new_float (gnm_tanh (value_get_as_float (argv[0])));
457
475
}
458
476
 
459
477
/***************************************************************************/
468
486
        { GNM_FUNC_HELP_EXAMPLES, F_("Let us assume that the cells A1, A2, ..., A5 contain numbers 11.4, 17.3, 11.4, 25.9, and 40.1.") },
469
487
        { GNM_FUNC_HELP_EXAMPLES, F_("Then MODE(A1:A5) equals 11.4.") },
470
488
        { GNM_FUNC_HELP_SEEALSO, "AVERAGE,MEDIAN"},
 
489
        { GNM_FUNC_HELP_EXTREF, F_("wiki:en:Mode_(statistics)") },
 
490
        { GNM_FUNC_HELP_EXTREF, F_("wolfram:Mode.html") },
471
491
        { GNM_FUNC_HELP_END }
472
492
};
473
493
 
493
513
        { GNM_FUNC_HELP_EXAMPLES, F_("Let us assume that the cells A1, A2, ..., A5 contain numbers 11.4, 17.3, 21.3, 25.9, and 40.1.") },
494
514
        { GNM_FUNC_HELP_EXAMPLES, F_("Then HARMEAN(A1:A5) equals 19.529814427.") },
495
515
        { GNM_FUNC_HELP_SEEALSO, "AVERAGE,GEOMEAN,MEDIAN,MODE,TRIMMEAN"},
 
516
        { GNM_FUNC_HELP_EXTREF, F_("wiki:en:Harmonic_mean") },
 
517
        { GNM_FUNC_HELP_EXTREF, F_("wolfram:HarmonicMean.html") },
496
518
        { GNM_FUNC_HELP_END }
497
519
};
498
520
 
518
540
        { GNM_FUNC_HELP_EXAMPLES, F_("Let us assume that the cells A1, A2, ..., A5 contain numbers 11.4, 17.3, 21.3, 25.9, and 40.1.") },
519
541
        { GNM_FUNC_HELP_EXAMPLES, F_("Then GEOMEAN(A1:A5) equals 21.279182482.") },
520
542
        { GNM_FUNC_HELP_SEEALSO, "AVERAGE,HARMEAN,MEDIAN,MODE,TRIMMEAN"},
 
543
        { GNM_FUNC_HELP_EXTREF, F_("wiki:en:Geometric_mean") },
 
544
        { GNM_FUNC_HELP_EXTREF, F_("wolfram:GeometricMean.html") },
521
545
        { GNM_FUNC_HELP_END }
522
546
};
523
547
 
612
636
        { GNM_FUNC_HELP_EXAMPLES, F_("Let us assume that the cells A1, A2, ..., A5 contain numbers 11.4, 17.3, 21.3, 25.9, and 40.1.") },
613
637
        { GNM_FUNC_HELP_EXAMPLES, F_("Then AVERAGE(A1:A5) equals 23.2.")},
614
638
        { GNM_FUNC_HELP_SEEALSO, ("SUM, COUNT")},
 
639
        { GNM_FUNC_HELP_EXTREF, F_("wiki:en:Arithmetic_mean") },
 
640
        { GNM_FUNC_HELP_EXTREF, F_("wolfram:ArithmeticMean.html") },
615
641
        { GNM_FUNC_HELP_END }
616
642
};
617
643
 
1814
1840
        { GNM_FUNC_HELP_NOTE, F_("If @{x} <= -1 or @{x} >= 1, this function returns a #NUM! error.")},
1815
1841
        { GNM_FUNC_HELP_DESCRIPTION, F_("This function is Excel compatible.") },
1816
1842
        { GNM_FUNC_HELP_EXAMPLES, F_("FISHER(0.332) equals 0.345074339.") },
1817
 
        { GNM_FUNC_HELP_SEEALSO, "SKEW"},
 
1843
        { GNM_FUNC_HELP_SEEALSO, "FISHERINV,ATANH"},
1818
1844
        { GNM_FUNC_HELP_END }
1819
1845
};
1820
1846
 
1831
1857
        if (x <= -1.0 || x >= 1.0)
1832
1858
                return value_new_error_NUM (ei->pos);
1833
1859
 
1834
 
        return value_new_float (0.5 * (gnm_log1p (x) - gnm_log1p (-x)));
 
1860
        return value_new_float (gnm_atanh (x));
1835
1861
}
1836
1862
 
1837
1863
/***************************************************************************/
1922
1948
        { GNM_FUNC_HELP_EXAMPLES, F_("Let us assume that the cells A1, A2, ..., A5 contain numbers 11.4, 17.3, 21.3, 25.9, and 40.1.") },
1923
1949
        { GNM_FUNC_HELP_EXAMPLES, F_("Then MEDIAN(A1:A5) equals 21.3.") },
1924
1950
        { GNM_FUNC_HELP_SEEALSO, "AVERAGE,COUNT,COUNTA,DAVERAGE,MODE,SSMEDIAN,SUM"},
 
1951
        { GNM_FUNC_HELP_EXTREF, F_("wiki:en:Median") },
 
1952
        { GNM_FUNC_HELP_EXTREF, F_("wolfram:StatisticalMedian.html") },
1925
1953
        { GNM_FUNC_HELP_END }
1926
1954
};
1927
1955