介绍个数学库gsl(GNU Scientific Library)

转载:

1.主页
http://www.gnu.org/software/gsl/

2.下载源码及manual
ftp://ftp.gnu.org/gnu/gsl/gsl-1.7.tar.gz
http://www.gnu.org/software/gsl/manual/gsl-ref.ps.gz

3.编译安装
(我用的是FC4)
./configure –diable-shared
make
make install

4.测试
4.1写个testgsl.c:
#include <stdio.h>
#include <gsl/gsl_sf_bessel.h>

int main(void)
{
  double x = 5.0;
  double y = gsl_sf_bessel_J0(x);
  printf("J0(%g) = %.18e\n",x,y);
  return 0;
}

4.2编译
gcc  -Wall -c testgsl.c

4.3链接
gcc -o testgsl testgsl.o -lgsl -lgslcbas -lm

4.4运行
./testgsl
输出:
J0(5) = -1.775967713143382920e-01

5.补充
5.1关键是platform independent及 distributed under the terms of the GPL
5.2更多内容看manual
5.3gsl的插件看主页
5.4在windows下的应用看
http://www.hebl.name/zh/archives/gsl-win32/#more-111

Advertisements

发表评论

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s