Giter Site home page Giter Site logo

gsl's Introduction

Gnu Scientific Library

The Library

    A good tool for scientific programmin in C is GNU Scientific Library (GSL). In this page I will leave some codes where some simple functions can be implemented. More informantion can be found in this link.

    If you don't have the library installed, open a terminal and type.

    sudo apt-get update
    sudo apt-get install libgsl-dev

    GSL requires some special flags when compiling, take an example

    gcc programa.c -lgsl -lgslcblas -lm -static

    The last flag is important if you are using some cluster.

Examples

01 - Coupled ODEs

In physics there are some times we find some coupled ODE that we want to solve. Some can be a little bit trick to write an actual algorithm. We can use GSL to solve. In this repo you can find an code where I use the Runge-Kutta-Fehlberg method to solve the SIR epidemiology model. All methods and more info in ODE resolution can be found here.

02 - Random Number Generator

Is not very hard to write linear congruential generator (LCG), but, for cientifical reasons, they can't be taken very serious. GSL library has a list of good RNG that we can use. In this repo you can find an example where I introduce some basic rng functions that GLS has to offer. I choose the Mersenne Twister because it has and period of (219937 - 1) and good proprieties. More options of RNG can be found here.

03 - Numbers Following Distributions

It can be convinient that we generate numbers following some distribution, GSL can do it. This special generators requires and random number as seed, then they return another number following the desired distribution. So we need the RNG, we talked about this above, and we can use one of GSL. We are gonna give the pointer as argument of the function, is not difficult as it sounds. As example there is a code in this repo that uses the Box-Muller method to generate numbers following the Gaussian Distribution. You can check this making and histogram. More information about this generators and more avaiable distributions can be found here.

gsl's People

Contributors

pedhmendes avatar

Stargazers

 avatar  avatar

Watchers

 avatar

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.