
GSL-GNU scientific Library
Augusdi
让时间验证一切,让时间验证我。感谢大家的无私帮助,我愿以同样的态度回馈我热情的朋友,用我们的热忱开创美好未来!
展开
-
GSL直方图Histogram 1
#include #include #include #pragma comment(lib, "libgsl_d.lib")#pragma comment(lib, "libgslcblas_d.lib")intmain (int argc, char **argv){ double a, b; size_t n; if (argc != 4) {原创 2013-08-15 14:52:10 · 2089 阅读 · 0 评论 -
GSL矩阵特征值
#include #include #include #pragma comment(lib, "libgsl_d.lib")#pragma comment(lib, "libgslcblas_d.lib")intmain (void){ double data[] = { 1.0 , 1/2.0, 1/3.0, 1/4.0, 1/2原创 2013-08-15 14:19:01 · 3160 阅读 · 1 评论 -
GSL积分运算
#include #include #include #pragma comment(lib, "libgsl_d.lib")#pragma comment(lib, "libgslcblas_d.lib")double f (double x, void * params) { double alpha = *(double *) params; double f = lo原创 2013-08-15 15:00:33 · 2858 阅读 · 0 评论 -
GSL矩阵操作1
#include #include #pragma comment(lib, "libgsl_d.lib")#pragma comment(lib, "libgslcblas_d.lib")intmain (void){ int i, j; gsl_matrix * m = gsl_matrix_alloc (10, 3); for (i = 0; i < 10原创 2013-08-15 15:19:12 · 1920 阅读 · 0 评论 -
GSL矩阵操作2-矩阵读写
#include #include #pragma comment(lib, "libgsl_d.lib")#pragma comment(lib, "libgslcblas_d.lib")intmain (void){ int i, j, k = 0; gsl_matrix * m = gsl_matrix_alloc (100, 100); gsl_matrix原创 2013-08-15 15:22:22 · 2598 阅读 · 0 评论 -
GSL演变函数
#include #include #include #include #pragma comment(lib, "libgsl_d.lib")#pragma comment(lib, "libgslcblas_d.lib")intfunc (double t, const double y[], double f[], void *params){ doubl原创 2013-08-15 15:57:07 · 1573 阅读 · 0 评论 -
GSL累计分布函数
#include #include #pragma comment(lib, "libgsl_d.lib")#pragma comment(lib, "libgslcblas_d.lib")intmain (void){ double P, Q; double x = 2.0; P = gsl_cdf_ugaussian_P (x); printf ("prob(原创 2013-08-15 10:22:37 · 2038 阅读 · 0 评论 -
GSL切比雪夫级数
#include #include #include #pragma comment(lib, "libgsl_d.lib")#pragma comment(lib, "libgslcblas_d.lib")doublef (double x, void *p){ if (x < 0.5) return 0.25; else return 0.75;}原创 2013-08-15 10:32:29 · 2229 阅读 · 0 评论 -
GSL排列组合
#include #include #pragma comment(lib, "libgsl_d.lib")#pragma comment(lib, "libgslcblas_d.lib")int main (void) { gsl_combination * c; size_t i; printf ("All subsets of {0,1,2,3} by size原创 2013-08-15 13:36:40 · 1887 阅读 · 0 评论 -
GSL常数
#include #include #pragma comment(lib, "libgsl_d.lib")#pragma comment(lib, "libgslcblas_d.lib")intmain (void){ double c = GSL_CONST_MKSA_SPEED_OF_LIGHT; double au = GSL_CONST_MKSA_ASTRONO原创 2013-08-15 13:47:57 · 1466 阅读 · 0 评论 -
GSL连续内存块分配
#include #include #pragma comment(lib, "libgsl_d.lib")#pragma comment(lib, "libgslcblas_d.dll")intmain (void){ gsl_block * b = gsl_block_alloc (100); printf ("length of block = %u\n", b原创 2013-08-15 10:12:46 · 1781 阅读 · 0 评论 -
GSL矩阵计算之行列式
#include #include #pragma comment(lib, "libgsl_d.lib")#pragma comment(lib, "libgslcblas_d.lib")intmain (void){ double a[] = { 0.11, 0.12, 0.13, 0.21, 0.22, 0.23 }; double原创 2013-08-15 10:03:02 · 3864 阅读 · 1 评论 -
GSL直方图ntuple多元值1
#include #include #include #pragma comment(lib, "libgsl_d.lib")#pragma comment(lib, "libgslcblas_d.lib")struct data{ double x; double y; double z;};int sel_func (void *ntuple_data, vo原创 2013-08-15 15:53:14 · 2024 阅读 · 1 评论 -
GSL浮点IEEE标准2
#include #include #include #pragma comment(lib, "libgsl_d.lib")#pragma comment(lib, "libgslcblas_d.lib")intmain (void){ double x = 1, oldsum = 0, sum = 0; int i = 0; gsl_ieee_env_setu原创 2013-08-15 14:58:02 · 1522 阅读 · 0 评论 -
GSL计算Bessel贝塞尔函数
#define GSL_DLL#include #include #pragma comment(lib, "libgsl_dll_d.lib")#pragma comment(lib, "libgslcblas_dll_d.lib")intmain (void){ double x = 5.0; double y = gsl_sf_bessel_J0 (x); pr原创 2013-08-15 15:12:51 · 3052 阅读 · 0 评论 -
GSL蒙特卡洛积分
#define GSL_DLL#include #include #include #include #include #include #pragma comment(lib, "libgsl_dll_d.lib")#pragma comment(lib, "libgslcblas_dll_d.lib")/* Computation of the integral,原创 2013-08-15 15:44:52 · 2161 阅读 · 0 评论 -
GSL快速傅里叶变换FFT
#include #include #include #include #pragma comment(lib, "libgsl_d.lib")#pragma comment(lib, "libgslcblas_d.lib")#define REAL(z,i) ((z)[2*(i)])#define IMAG(z,i) ((z)[2*(i)+1])intmain (void原创 2013-08-15 14:27:25 · 3381 阅读 · 0 评论 -
GSL实数快速傅里叶变换FFT
#include #include #include #include #include #pragma comment(lib, "libgsl_d.lib")#pragma comment(lib, "libgslcblas_d.lib")intmain (void){ int i; const int n = 100;// double data[n];原创 2013-08-15 14:36:55 · 4250 阅读 · 0 评论 -
GSL直方图Histogram 2
#include #include #include #pragma comment(lib, "libgsl_d.lib")#pragma comment(lib, "libgslcblas_d.lib")intmain (void){ const gsl_rng_type * T; gsl_rng * r; gsl_histogram2d * h = gsl_h原创 2013-08-15 14:53:40 · 2292 阅读 · 0 评论 -
GSL样条函数插值1
#include #include #include #include #include #pragma comment(lib, "libgsl_d.lib")#pragma comment(lib, "libgslcblas_d.lib")intmain (void){ int i; double xi, yi, x[10], y[10]; printf (原创 2013-08-15 15:04:21 · 3096 阅读 · 1 评论 -
GSL中FDF求解器
#include #include #include #include #include #include #include #include "expfit.c"#define N 40void print_state (size_t iter, gsl_multifit_fdfsolver * s);#pragma comment(lib, "libgsl_d.li原创 2013-08-15 15:49:37 · 2575 阅读 · 0 评论 -
GSL微分方程
#include #include #include #pragma comment(lib, "libgsl_d.lib")#pragma comment(lib, "libgslcblas_d.lib")double f (double x, void * params){ return pow (x, 1.5);}intmain (void){ gsl_fu原创 2013-08-15 14:00:22 · 2353 阅读 · 0 评论 -
GSL曲线拟合3
#include #include #include #pragma comment(lib, "libgsl_d.lib")#pragma comment(lib, "libgslcblas_d.lib")intmain (void){ double x; const gsl_rng_type * T; gsl_rng * r; gsl_rng_env_s原创 2013-08-15 14:46:36 · 3893 阅读 · 0 评论 -
GSL样条插值函数2
#include #include #include #include #include #pragma comment(lib, "libgsl_d.lib")#pragma comment(lib, "libgslcblas_d.lib")intmain (void){ int N = 4; double x[4] = {0.00, 0.10, 0.27, 0原创 2013-08-15 15:06:29 · 4078 阅读 · 0 评论 -
GSL特殊函数
#define GSL_DLL#include #include #pragma comment(lib, "libgsl_dll_d.lib")#pragma comment(lib, "libgslcblas_dll_d.lib")intmain (void){ double x = 5.0; double expected = -0.177596771314338原创 2013-08-15 22:10:03 · 1867 阅读 · 0 评论 -
GSL特殊函数2
#include #include #include #pragma comment(lib, "libgsl_dll_d.lib")#pragma comment(lib, "libgslcblas_dll_d.lib")intmain (void){ double x = 5.0; gsl_sf_result result; double expected =原创 2013-08-15 22:11:46 · 1710 阅读 · 0 评论 -
GSL数值统计
#include #include #pragma comment(lib, "libgsl_d.lib")#pragma comment(lib, "libgslcblas_d.lib")intmain(void){ double data[5] = {17.2, 18.1, 16.5, 18.3, 12.6}; double mean, variance, larges原创 2013-08-15 22:13:21 · 3175 阅读 · 0 评论 -
GSL通过Levin u变换推测极限
#include #include #include #pragma comment(lib, "libgsl_d.lib")#pragma comment(lib, "libgslcblas_d.lib")#define N 20intmain (void){ double t[N]; double sum_accel, err; double sum = 0;原创 2013-08-15 22:18:53 · 1845 阅读 · 0 评论 -
GSL向量分配与赋值
#include #include #pragma comment(lib, "libgsl_d.lib")#pragma comment(lib, "libgslcblas_d.lib")intmain (void){ int i; gsl_vector * v = gsl_vector_alloc (3); for (i = 0; i < 3; i++)原创 2013-08-15 22:20:14 · 2340 阅读 · 0 评论 -
Windows下使用开源数学库
几个有用的数学库,GMP,MPIR,MPFR,MPC,CGAL,GSL。前两个是大整数库,MPFR是浮点库,MPC是复数库,CGAL是计算几何库,GSL是gnu的科学计算库,C语言写的。GSL有些问题,比如阶乘,实际上指提供到170的阶乘,超过就溢出了,同时,为了提高速度这个是硬编码进去的,实际上没有计算。用了一个数组,保存了0~170阶乘的结果,用的时候直接查找。所以一些使用它的软件,例如oct转载 2013-08-14 15:31:02 · 4022 阅读 · 0 评论 -
GSL科学计算库文档索引翻译
1.介绍2.库的使用 本章描述如何编译使用GSL的程序,介绍GSL的一般用法。2.1例子程序 2.2编译和链接 2.3共享库2.4与ANSI C兼容性2.5inline函数 2.6长双精度long double2.7可移植性函数 2.8可优化函数2.9对不同的数据类型的支持2.10与C++兼容性2.11数组别名 2.12线程安全 2.13遗弃的函数 2.14代码重用3.出错处理 本章描述GSL函数转载 2013-08-14 15:58:17 · 4072 阅读 · 0 评论 -
GSL模拟退火算法
#include #include #include #pragma comment(lib, "libgsl_d.lib")#pragma comment(lib, "libgslcblas_d.lib")/* set up parameters for this simulated annealing run *//* how many points do we try be原创 2013-08-15 22:04:45 · 1998 阅读 · 0 评论 -
GSL数值统计2
#include #include #include #pragma comment(lib, "libgsl_d.lib")#pragma comment(lib, "libgslcblas_d.lib")intmain(void){ double data[5] = {17.2, 18.1, 16.5, 18.3, 12.6}; double median, uppe原创 2013-08-15 22:15:31 · 2041 阅读 · 0 评论 -
GSL升序向量排序
#include #include #pragma comment(lib, "libgsl_d.lib")#pragma comment(lib, "libgslcblas_d.lib")intmain (void){ const gsl_rng_type * T; gsl_rng * r; size_t i, k = 5, N = 100000; doubl原创 2013-08-15 22:07:23 · 2029 阅读 · 0 评论 -
GSL参上[0,1)的随机数
#include #include #pragma comment(lib, "libgsl_d.lib")#pragma comment(lib, "libgslcblas_d.lib")intmain (void){ const gsl_rng_type * T; gsl_rng * r; int i, n = 10; gsl_rng_env_setup()原创 2013-08-15 22:00:36 · 2159 阅读 · 0 评论 -
GSL随机数
#include #include #pragma comment(lib, "libgsl_d.lib")#pragma comment(lib, "libgslcblas_d.lib")gsl_rng * r; /* global generator */intmain (void){ const gsl_rng_type * T; gsl_rng_env_se原创 2013-08-15 21:58:18 · 2220 阅读 · 0 评论 -
GSL因式分解LU分解
#include #include #pragma comment(lib, "libgsl_d.lib")#pragma comment(lib, "libgslcblas_d.lib")intmain (void){ double a_data[] = { 0.18, 0.60, 0.57, 0.96, 0.41, 0.24, 0原创 2013-08-15 15:16:16 · 2595 阅读 · 0 评论 -
GSL区域间隔收敛性判定
#include #include #include #include #pragma comment(lib, "libgsl_d.lib")#pragma comment(lib, "libgslcblas_d.lib")double fn1 (double x, void * params){ return cos(x) + 1.0;}intmain (void原创 2013-08-15 15:41:57 · 1619 阅读 · 0 评论 -
GSL直方图ntuple多元值2
#include #include #include #pragma comment(lib, "libgsl_d.lib")#pragma comment(lib, "libgslcblas_d.lib")struct data{ double x; double y; double z;};intmain (void){ const gsl_rng_t原创 2013-08-15 15:53:29 · 1693 阅读 · 0 评论 -
GSL矩阵排列
#include #include #pragma comment(lib, "libgsl_d.lib")#pragma comment(lib, "libgslcblas_d.lib")intmain (void) { gsl_permutation * p = gsl_permutation_alloc (3); gsl_permutation_init (p);原创 2013-08-15 16:00:11 · 1622 阅读 · 0 评论