package gsl package data_types model gsl_permutation extends ExternalObject; function constructor input Integer N; output gsl_permutation p; external "C" p = gsl_permutation_alloc(N) annotation( Include = "#include ", Library = "gsl", Library = "gslcblas"); end constructor; function destructor "Release storage of p" input gsl_permutation p; external "C" gsl_permutation_free(p) annotation( Include = "#include ", Library = "gsl", Library = "gslcblas"); end destructor; end gsl_permutation; /* model gsl_complex extends ExternalObject; function constructor input Integer N; output gsl_complex k; external "C" annotation( Library = "gsl", Library = "gslcblas", Include = "#include"); end constructor; function destructor input gsl_complex k; external "C" annotation( Library = "gsl", Library = "gslcblas", Include = "#include"); end destructor; end gsl_complex; */ end data_types; package mathematical function gsl_log1p //This function computes the value of log(1 + x) in a way that is accurate for small x input Real x; output Real y; external "C" y = log1p(x) annotation( Library = "gsl", Library = "gslcblas"); end gsl_log1p; function gsl_expm1 //this function computes the value of exp(x)-1 input Real x; output Real y; external "C" y = gsl_expm1(x) annotation( Library = "gsl", Library = "gslcblas"); end gsl_expm1; function gsl_hypot //this function computes the value of sqrt(x^2+y^2) in a way which avoids overflow input Real x; input Real y; output Real z; external "C" z = gsl_hypot(x, y) annotation( Library = "gsl", Library = "gslcblas"); end gsl_hypot; function gsl_hypot3 //This function calculates the value of sqrt(x^2+y^2+z^2) input Real x; input Real y; input Real z; output Real o; external "C" o = gsl_hypot3(x, y, z) annotation( Library = "gsl", Library = "gslcblas"); end gsl_hypot3; function gsl_acosh // this function calculates the value of arccosh(x) input Real x; output Real y; external "C" y = acosh(x) annotation( Library = "gsl", Library = "gslcblas"); end gsl_acosh; function gsl_asinh // this function calculates the value of arcsinh(x) input Real x; output Real y; external "C" y = asinh(x) annotation( Library = "gsl", Library = "gslcblas"); end gsl_asinh; function gsl_atanh // this function calculates the value of arctanh(x) input Real x; output Real y; external "C" y = atanh(x) annotation( Library = "gsl", Library = "gslcblas"); end gsl_atanh; function gsl_ldexp //this function computes the value of x*2^e input Real x; // y should be given the value e output Real z; protected constant Real y = Modelica.Constants.e; external "C" z = gsl_ldexp(x, y) annotation( Library = "gsl", Library = "gslcblas", Include = "#include"); end gsl_ldexp; function gsl_frexp //This function splits the number x into its normalized fraction f and exponent e, such that x = f ∗ 2^e // and 0.5 <= f < 1. The function returns f and stores the exponent in e. input Real x; output Integer e; // it stores the exponent in y output Real z; external "C" z = gsl_frexp(x, e) annotation( Library = "gsl", Library = "gslcblas"); end gsl_frexp; function gsl_pow_int //this function computes x^n input Real x; input Integer n; output Real y; external "C" y = gsl_pow_int(x, n) annotation( Library = "gsl", Library = "gslcblas"); end gsl_pow_int; function gsl_pow_2 //This function calculates square fo the given number input Real x; output Real y; external "C" y = gsl_pow_2(x) annotation( Library = "gsl", Library = "gslcblas"); end gsl_pow_2; function gsl_pow_3 //This function calculates cube of the given number input Real x; output Real y; external "C" y = gsl_pow_3(x) annotation( Library = "gsl", Library = "gslcblas"); end gsl_pow_3; function gsl_pow_4 //This function calculates number to the power of 4 of the given number input Real x; output Real y; external "C" y = gsl_pow_4(x) annotation( Library = "gsl", Library = "gslcblas"); end gsl_pow_4; function gsl_pow_5 //This function calculates number to the power of 5 of the given number input Real x; output Real y; external "C" y = gsl_pow_5(x) annotation( Library = "gsl", Library = "gslcblas"); end gsl_pow_5; function gsl_pow_6 //This function calculates number to the power of 6 of the given number input Real x; output Real y; external "C" y = gsl_pow_6(x) annotation( Library = "gsl", Library = "gslcblas"); end gsl_pow_6; function gsl_pow_7 //This function calculates number to the power of 6 of the given number input Real x; output Real y; external "C" y = gsl_pow_7(x) annotation( Library = "gsl", Library = "gslcblas"); end gsl_pow_7; function gsl_pow_8 //This function calculates number to the power of 6 of the given number input Real x; output Real y; external "C" y = gsl_pow_8(x) annotation( Library = "gsl", Library = "gslcblas"); end gsl_pow_8; function gsl_pow_9 //This function calculates number to the power of 6 of the given number input Real x; output Real y; external "C" y = gsl_pow_9(x) annotation( Library = "gsl", Library = "gslcblas"); end gsl_pow_9; function GSL_SIGN //This function outputs -1 for negative number and +1 if the number is positive input Real x; output Integer y; external "C" y = GSL_SIGN(x) annotation( Library = "gsl", Library = "gslcblas", Include = "#include"); end GSL_SIGN; function GSL_IS_ODD //This function outputs 1 if number is odd else if number is even it returns zero input Integer x; output Integer y; external "C" y = GSL_IS_ODD(x) annotation( Library = "gsl", Library = "gslcblas", Include = "#include"); end GSL_IS_ODD; function GSL_IS_EVEN //This function outputs 0 if number is odd else if number is even it returns 1 input Integer x; output Integer y; external "C" y = GSL_IS_EVEN(x) annotation( Library = "gsl", Library = "gslcblas", Include = "#include"); end GSL_IS_EVEN; function GSL_MAX // This function calculates the maximum of two numbers input Real a; input Real b; output Real c; external "C" c = GSL_MAX(a, b) annotation( Library = "gsl", Library = "gslcblas", Include = "#include"); end GSL_MAX; function GSL_MAX_DBL // This function calculates the maximum of the given two floating point numbers input Real a; input Real b; output Real c; external "C" c = GSL_MAX_DBL(a, b) annotation( Inline = true, Library = "gsl", Library = "gslcblas", Include = "#include"); end GSL_MAX_DBL; function GSL_MIN_DBL //This function calculates the minimum of two given floating point numbers input Real a; input Real b; output Real c; external "C" c = GSL_MIN_DBL(a, b) annotation( Inline = true, Library = "gsl", Library = "gslcblas", Include = "#include"); end GSL_MIN_DBL; function GSL_MAX_INT // This function calculates the maximum of two given integers input Real a; input Real b; output Real c; external "C" c = GSL_MAX_INT(a, b) annotation( Inline = true, Library = "gsl", Library = "gslcblas", Include = "#include"); end GSL_MAX_INT; function GSL_MIN_INT // This function calculates the minimum of the two numbers input Real a; input Real b; output Real c; external "C" c = GSL_MIN_INT(a, b) annotation( Inline = true, Library = "gsl", Library = "gslcblas", Include = "#include"); end GSL_MIN_INT; function GSL_MAX_LDBL // This function calculates the maximum of two long double numbers input Real a; input Real b; output Real c; external "C" c = GSL_MAX_LDBL(a, b) annotation( Inline = true, Library = "gsl", Library = "gslcblas", Include = "#include"); end GSL_MAX_LDBL; function GSL_MIN_LDBL // This function calculates the minimum of two long double numbers input Real a; input Real b; output Real c; external "C" c = GSL_MIN_LDBL(a, b) annotation( Inline = true, Library = "gsl", Library = "gslcblas", Include = "#include"); end GSL_MIN_LDBL; function gsl_fcmp //This function determines whether x and y are approximately equal if they are equal within the range of epsilon it returns zero,if a>b it returns -1 and if bb parameter Real a = 4.0; parameter Real b = 2.2; Real c; algorithm c := gsl.mathematical.gsl_fcmp(a, b); end gsl_fcmp; /**/ end Mathematical; package Permutation /*this model initialise the permutation with 10 elements to {0,1,2,3,4,5,6,7,8,9}*/ //this model calls the function gsl_permutation_init(p) to initialize the permutation to {0,1,2,3,4,5,6,7,8,9} //this model calls the function gsl_permutation_init(p) to initialize the permutation to {0,1,2,3,4,5,6,7,8,9} //this model calls the function gsl_permutation_init(p) to initialize the permutation to {0,1,2,3,4,, model gsl_per_init /*this model initializes the permutation p to{0,1,2,3,4,5,6,7,8,9}*/ parameter Integer N = 10; gsl.data_types.gsl_permutation p = gsl.data_types.gsl_permutation(N); Integer y[10]; algorithm gsl.Permutation.gsl_permutation_init(p); for i in 1:10 loop y[i] := gsl.Permutation.gsl_permutation_get(p, i - 1); end for; end gsl_per_init; end Permutation; package COMPLEX end COMPLEX; end Examples; end gsl;