在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:JuliaMath/GSL.jl开源软件地址:https://github.com/JuliaMath/GSL.jl开源编程语言:Julia 100.0%开源软件介绍:GSL.jlJulia wrapper for the GNU Scientific Library (GSL), for Julia v1.0+. Currently uses GSL v2.7. StructureThe library tries to provide Julia interfaces to all the functions, types and symbols defined in the GSL documentation.
Some functions have a secondary wrapper on top of the GSL interface, to make Julia usage more convenient, for example by allocating the output array. The low-level C interface to GSL can still be accessed under the namespace GSL.strerror(gsl_errno) -> String
GSL.C.strerror(gsl_errno) -> Ptr{Cchar}
and
GSL.sf_legendre_array(norm, lmax, x) -> Array{Float64}
GSL.C.sf_legendre_array(norm, lmax, x, result_array) -> Cint Parts of GSL are not interfaced to, since they provide functionality already existing in
Julia. These are functions with prefixes ExamplesSee examples in examples/ and tests test/ for more examples. Special function with result struct# Direct call
sf_legendre_P3(0.5)
# Output: -0.4375
# With result struct that stores value and error:
sf_legendre_P3_e(0.5)
# Output: gsl_sf_result_struct(-0.4375, 3.3306690738754696e-16)
# Low-level call with result struct as argument:
result = gsl_sf_result(0,0)
GSL.C.sf_legendre_P3_e(0.5, result)
# Output: GSL_SUCCESS
# result = gsl_sf_result_struct(-0.4375, 3.3306690738754696e-16) Special function with array outputx = 0.5
lmax = 4
result = sf_legendre_array(GSL_SF_LEGENDRE_SPHARM, lmax, x)
# Equivalent using low-level interface:
n = sf_legendre_array_n(lmax)
result = Array{Float64}(undef, n)
GSL.C.sf_legendre_array(GSL_SF_LEGENDRE_SPHARM, lmax, x, result)
Root findingf = x -> x^5+1
df = x -> 5*x^4
fdf = @gsl_function_fdf(f, df)
solver = root_fdfsolver_alloc(gsl_root_fdfsolver_newton)
root_fdfsolver_set(solver, fdf, -2)
while abs(f(root_fdfsolver_root(solver))) > 1e-10
root_fdfsolver_iterate(solver)
end
println("x = ", root_fdfsolver_root(solver))
# Output: x = -1.0000000000104232 DocumentationExtra functionality defined in this package:
In addition, some effort has been put into giving most types and functions proper docstrings, e.g.
Behind the scenes
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论