Coder Social home page Coder Social logo

christianbender / statistic Goto Github PK

View Code? Open in Web Editor NEW
8.0 1.0 0.0 14 KB

This repository contains a statistic library for the C programming language which prepare useful functions for dealing with average, standard deviation etc.

License: MIT License

C 100.00%
statistics statistic library c for average standard-derivation standard derivation median

statistic's Introduction

Statistic-library for C

This repository contains a statistic library for the C programming language which prepare useful functions for dealing with average, standard deviation etc. The library is platform-independent. So you can use this library with any C-compiler.

Usage

You needed to put in the files statistic.h and statistic.c in your project directory. After that you include the header file statistic.h in your project. Then you can use the functions of this library. You will find the files statistic.h and statistic.c in the directory src.

Overview about the functions

The first int-argument represents the size of the sample (double-array).

/*
    Computes the average of a given sample.
    The sample is a set of double values.
    The average-function gets a variable number of arguments. 
    The first argument must be the number of arguments!
    The averageArray-function instead gets a double-array of values and a int-number that
    represents the size of the double-array.
*/
double average_Array(int,const double[]);
double average(int,...);
/* 
    Computes the standard deviation (n-1)
*/
double standard_deviation(int,...);
double standard_deviation_array(int, const double[]);

/*
    Computes the standard deviation (n)
*/
double standard_deviation_N(int,...);
double standard_deviation_N_array(int, const double[]);
/*
    variance: computes the variance (n-1)
    variance_N: computes the variance (n)
*/
double variance(int, const double[]);
double variance_N(int, const double[]);
/*
    gets the max (min) element of the sample 
*/
double max(int, const double[]);
double min(int , const double[]);
/*
    computes the median of the sample
*/
double median(int, const double[]);
/*
    adds up all values of the sample.
*/
double sum(int,const double[]);
/* 
    computes the range of the sample.
*/
double range(int, const double[]);
/*
    gets the frequency of the last argument (double) of that sample.
*/
double frequency_of(int, const double[], double);
/* 
    quartile_I: computes the first quartile.
    quartile_III: computes the third quartile.
    The second quartile is the median!
*/
double quartile_I(int, const double[]);
double quartile_III(int, const double[]);
/*
    computes the quartile distance
*/
double quartile_distance(int, const double[]);

Running the tests

You navigate in the directory of this repository and type in the console:

gcc -o myTests test/test.c src/statistic.c  -lcunit -lm  && ./myTests

Dependencies for tests

  • CUnit
  • gcc

statistic's People

Contributors

christianbender avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

statistic's Issues

Calculate percentile

Hello,
Could you tell me how to create a percentile calculator function and not just a quartile calculator function?
Many thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.