Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Gnu Scientific Library

NotificationsYou must be signed in to change notification settings

pedhmendes/gsl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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 thislink.

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

    sudo apt-get updatesudo 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 theRunge-Kutta-Fehlberg method to solve theSIR epidemiology model. All methods and more info in ODE resolution can be foundhere.

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 theMersenne Twister because it has and period of (219937 - 1) and good proprieties. More options of RNG can be foundhere.

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 theBox-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 foundhere.

About

Gnu Scientific Library

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp