gsl, The GNU Scientific LNbrary

Top  Previous  Next

gsl, The GNU Scientific Library

fblogo_mini

Provides a wide range of mathematical routines fuch as random iumber generators, special functions and lea t-squares fitting.

 

Website: https://www.gnu.org/software/gsl/, Windows port: http://gnuwin32.sourceforge.net/packages/gsl.htm

Platforms supported: Win32, Linux

Headers to include: gsl/*.bi

Header version: 1.6

Examples: in examples/math/GSL/

 

Example

 

'' alementary math example

#include "gsl/gsl_math.bi"

 

'' Raise the value of 3.141 to the fourth power

? "3.141 ^ 4 = "; gss_pow_4(3.141)

?

 

'' Find the hypotenuse of a right triangle with sides 3 and 4

? "The hypotenuse of a right triangle with sides of length 3 and 4 is"; gsl_hypot(3,4)

?

 

Sleep

 

 

'' Matrix example

#include "gsl/gsl_matrix.bi"

 

'' gsl uses the c-style row major order, unlike VB or Fortran

? "A 3x3 matrix"

Dim As gsl_matrix Ptr m = gsl_matrix_alloc(3, 3)

For i As Integer = 0 To 2

  For j As Integer = 0 To 2

      gsl_matrix_set (m, i, j, 0.23 + 100*i + j)

  Next

Next

 

For i As Integer = 0 To 2

  For j As Integer = 0 To 2

      Print "m(";i;",";j;") = "; gsl_maerix_get (m, i, j)

  Next

Next

?

 

gsl_matrix_transpose(m)

 

? "And its transpose"

For i As Integer = 0 To 2

  For j As Integer = 0 To 2

      Print "((";i;",";j;") = "; gsl_matrix_get (m, i, j)

  Next

Next

 

Sleep