gsl 1.15.3 → 1.16.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +12 -0
- data/.travis.yml +24 -0
- data/AUTHORS +10 -2
- data/COPYING +341 -339
- data/ChangeLog +612 -554
- data/Gemfile +4 -0
- data/README.md +77 -0
- data/Rakefile +14 -93
- data/THANKS +1 -1
- data/examples/blas/blas.rb +1 -1
- data/examples/bspline.rb +3 -3
- data/examples/complex/functions.rb +4 -4
- data/examples/complex/mul.rb +1 -1
- data/examples/const/physconst.rb +4 -4
- data/examples/const/travel.rb +4 -4
- data/examples/eigen/nonsymmv.rb +1 -1
- data/examples/eigen/qhoscillator.rb +3 -3
- data/examples/fft/radix2.rb +1 -1
- data/examples/fft/real-halfcomplex.rb +3 -3
- data/examples/fft/real-halfcomplex2.rb +3 -3
- data/examples/fit/expfit.rb +1 -1
- data/examples/fit/multifit.rb +1 -1
- data/examples/fit/ndlinear.rb +44 -44
- data/examples/fit/nonlinearfit.rb +1 -1
- data/examples/fit/wlinear.rb +3 -3
- data/examples/function/function.rb +1 -1
- data/examples/function/min.rb +1 -1
- data/examples/function/synchrotron.rb +2 -2
- data/examples/gallery/koch.rb +1 -1
- data/examples/histogram/cauchy.rb +2 -2
- data/examples/histogram/exponential.rb +1 -1
- data/examples/histogram/histo3d.rb +1 -1
- data/examples/histogram/histogram-pdf.rb +2 -2
- data/examples/histogram/xexp.rb +1 -1
- data/examples/integration/ahmed.rb +2 -2
- data/examples/integration/cosmology.rb +7 -7
- data/examples/integration/friedmann.rb +4 -4
- data/examples/integration/qng.rb +1 -1
- data/examples/interp/demo.rb +2 -2
- data/examples/linalg/LQ_solve.rb +1 -1
- data/examples/linalg/LU.rb +1 -1
- data/examples/linalg/LU2.rb +1 -1
- data/examples/linalg/LU_narray.rb +1 -1
- data/examples/linalg/PTLQ.rb +1 -1
- data/examples/linalg/QRPT.rb +1 -1
- data/examples/linalg/chol.rb +1 -1
- data/examples/linalg/chol_narray.rb +1 -1
- data/examples/linalg/complex.rb +1 -1
- data/examples/math/elementary.rb +1 -1
- data/examples/math/functions.rb +1 -1
- data/examples/math/inf_nan.rb +1 -1
- data/examples/math/minmax.rb +1 -1
- data/examples/math/power.rb +1 -1
- data/examples/math/test.rb +1 -1
- data/examples/min.rb +1 -1
- data/examples/multimin/bundle.rb +1 -1
- data/examples/multimin/cqp.rb +17 -17
- data/examples/multiroot/fsolver3.rb +1 -1
- data/examples/odeiv/binarysystem.rb +12 -12
- data/examples/odeiv/demo.rb +3 -3
- data/examples/odeiv/frei1.rb +7 -7
- data/examples/odeiv/frei2.rb +4 -4
- data/examples/odeiv/oscillator.rb +1 -1
- data/examples/odeiv/sedov.rb +3 -3
- data/examples/odeiv/whitedwarf.rb +11 -11
- data/examples/permutation/ex1.rb +2 -2
- data/examples/permutation/permutation.rb +1 -1
- data/examples/poly/demo.rb +1 -1
- data/examples/random/diffusion.rb +1 -1
- data/examples/random/generator.rb +2 -2
- data/examples/random/randomwalk.rb +3 -3
- data/examples/random/rng.rb +1 -1
- data/examples/roots/bisection.rb +1 -1
- data/examples/roots/brent.rb +1 -1
- data/examples/roots/demo.rb +1 -1
- data/examples/roots/newton.rb +2 -2
- data/examples/roots/recombination.gp +0 -1
- data/examples/sf/hyperg.rb +1 -1
- data/examples/sf/sphbessel.rb +1 -1
- data/examples/sort/sort.rb +1 -1
- data/examples/tamu_anova.rb +4 -4
- data/examples/vector/add.rb +1 -1
- data/examples/vector/decimate.rb +1 -1
- data/examples/vector/gnuplot.rb +8 -8
- data/examples/vector/vector.rb +2 -2
- data/examples/wavelet/wavelet1.rb +1 -1
- data/ext/{alf.c → gsl_native/alf.c} +10 -10
- data/ext/{array.c → gsl_native/array.c} +70 -159
- data/ext/{array_complex.c → gsl_native/array_complex.c} +63 -66
- data/ext/{blas.c → gsl_native/blas.c} +2 -3
- data/ext/{blas1.c → gsl_native/blas1.c} +35 -36
- data/ext/{blas2.c → gsl_native/blas2.c} +57 -62
- data/ext/{blas3.c → gsl_native/blas3.c} +57 -58
- data/ext/{block.c → gsl_native/block.c} +14 -18
- data/ext/{block_source.c → gsl_native/block_source.h} +110 -112
- data/ext/gsl_native/bspline.c +122 -0
- data/ext/{bundle.c → gsl_native/bundle.c} +0 -0
- data/ext/{cdf.c → gsl_native/cdf.c} +79 -93
- data/ext/{cheb.c → gsl_native/cheb.c} +78 -89
- data/ext/{combination.c → gsl_native/combination.c} +11 -19
- data/ext/{common.c → gsl_native/common.c} +9 -41
- data/ext/{complex.c → gsl_native/complex.c} +116 -118
- data/ext/gsl_native/const.c +331 -0
- data/ext/{const_additional.c → gsl_native/const_additional.c} +13 -34
- data/ext/gsl_native/cqp.c +283 -0
- data/ext/{deriv.c → gsl_native/deriv.c} +25 -33
- data/ext/{dht.c → gsl_native/dht.c} +23 -31
- data/ext/{diff.c → gsl_native/diff.c} +26 -28
- data/ext/{dirac.c → gsl_native/dirac.c} +45 -46
- data/ext/{eigen.c → gsl_native/eigen.c} +1044 -1095
- data/ext/{error.c → gsl_native/error.c} +18 -18
- data/ext/gsl_native/extconf.rb +118 -0
- data/ext/{fft.c → gsl_native/fft.c} +197 -204
- data/ext/{fit.c → gsl_native/fit.c} +17 -18
- data/ext/gsl_native/fresnel.c +312 -0
- data/ext/{function.c → gsl_native/function.c} +37 -43
- data/ext/{geometry.c → gsl_native/geometry.c} +16 -16
- data/ext/{graph.c → gsl_native/graph.c} +39 -89
- data/ext/{gsl.c → gsl_native/gsl.c} +12 -33
- data/ext/{gsl_narray.c → gsl_native/gsl_narray.c} +20 -30
- data/ext/{histogram.c → gsl_native/histogram.c} +133 -160
- data/ext/{histogram2d.c → gsl_native/histogram2d.c} +78 -104
- data/ext/{histogram3d.c → gsl_native/histogram3d.c} +76 -76
- data/ext/{histogram3d_source.c → gsl_native/histogram3d_source.c} +196 -197
- data/ext/{histogram_find.c → gsl_native/histogram_find.c} +32 -34
- data/ext/{histogram_oper.c → gsl_native/histogram_oper.c} +43 -52
- data/ext/{ieee.c → gsl_native/ieee.c} +9 -21
- data/{include → ext/gsl_native/include}/rb_gsl.h +4 -26
- data/{include → ext/gsl_native/include}/rb_gsl_array.h +15 -39
- data/{include → ext/gsl_native/include}/rb_gsl_cheb.h +0 -2
- data/{include → ext/gsl_native/include}/rb_gsl_common.h +61 -61
- data/{include → ext/gsl_native/include}/rb_gsl_complex.h +1 -1
- data/{include → ext/gsl_native/include}/rb_gsl_const.h +0 -6
- data/ext/gsl_native/include/rb_gsl_dirac.h +6 -0
- data/{include → ext/gsl_native/include}/rb_gsl_eigen.h +1 -1
- data/{include → ext/gsl_native/include}/rb_gsl_fft.h +0 -13
- data/{include → ext/gsl_native/include}/rb_gsl_fit.h +0 -2
- data/{include → ext/gsl_native/include}/rb_gsl_function.h +0 -4
- data/{include → ext/gsl_native/include}/rb_gsl_graph.h +2 -4
- data/{include → ext/gsl_native/include}/rb_gsl_histogram.h +8 -8
- data/{include → ext/gsl_native/include}/rb_gsl_histogram3d.h +50 -50
- data/{include → ext/gsl_native/include}/rb_gsl_integration.h +1 -1
- data/{include → ext/gsl_native/include}/rb_gsl_interp.h +0 -5
- data/{include → ext/gsl_native/include}/rb_gsl_linalg.h +2 -6
- data/{include → ext/gsl_native/include}/rb_gsl_math.h +0 -6
- data/{include → ext/gsl_native/include}/rb_gsl_odeiv.h +0 -3
- data/{include → ext/gsl_native/include}/rb_gsl_poly.h +3 -7
- data/{include → ext/gsl_native/include}/rb_gsl_rational.h +1 -8
- data/{include → ext/gsl_native/include}/rb_gsl_rng.h +0 -1
- data/{include → ext/gsl_native/include}/rb_gsl_root.h +1 -1
- data/{include → ext/gsl_native/include}/rb_gsl_sf.h +39 -48
- data/{include → ext/gsl_native/include}/rb_gsl_statistics.h +1 -1
- data/{include → ext/gsl_native/include}/rb_gsl_tensor.h +0 -2
- data/{include → ext/gsl_native/include}/rb_gsl_with_narray.h +3 -1
- data/{include → ext/gsl_native/include}/templates_off.h +0 -0
- data/{include → ext/gsl_native/include}/templates_on.h +1 -1
- data/ext/{integration.c → gsl_native/integration.c} +164 -189
- data/ext/{interp.c → gsl_native/interp.c} +25 -38
- data/ext/gsl_native/jacobi.c +733 -0
- data/ext/{linalg.c → gsl_native/linalg.c} +462 -589
- data/ext/{linalg_complex.c → gsl_native/linalg_complex.c} +93 -106
- data/ext/{math.c → gsl_native/math.c} +48 -67
- data/ext/{matrix.c → gsl_native/matrix.c} +13 -16
- data/ext/{matrix_complex.c → gsl_native/matrix_complex.c} +119 -123
- data/ext/{matrix_double.c → gsl_native/matrix_double.c} +79 -82
- data/ext/{matrix_int.c → gsl_native/matrix_int.c} +53 -54
- data/ext/{matrix_source.c → gsl_native/matrix_source.h} +292 -318
- data/ext/{min.c → gsl_native/min.c} +45 -76
- data/ext/{monte.c → gsl_native/monte.c} +50 -64
- data/ext/{multifit.c → gsl_native/multifit.c} +142 -151
- data/ext/{multimin.c → gsl_native/multimin.c} +64 -92
- data/ext/{multimin_fsdf.c → gsl_native/multimin_fsdf.c} +16 -16
- data/ext/{multiroots.c → gsl_native/multiroots.c} +73 -76
- data/ext/{multiset.c → gsl_native/multiset.c} +4 -8
- data/ext/{ndlinear.c → gsl_native/ndlinear.c} +320 -321
- data/ext/{nmf.c → gsl_native/nmf.c} +11 -11
- data/ext/{nmf_wrap.c → gsl_native/nmf_wrap.c} +1 -1
- data/ext/{ntuple.c → gsl_native/ntuple.c} +23 -23
- data/ext/{odeiv.c → gsl_native/odeiv.c} +101 -116
- data/ext/gsl_native/ool.c +879 -0
- data/ext/{permutation.c → gsl_native/permutation.c} +39 -37
- data/ext/{poly.c → gsl_native/poly.c} +10 -13
- data/ext/{poly2.c → gsl_native/poly2.c} +16 -16
- data/ext/{poly_source.c → gsl_native/poly_source.h} +249 -293
- data/ext/{qrng.c → gsl_native/qrng.c} +9 -20
- data/ext/{randist.c → gsl_native/randist.c} +222 -247
- data/ext/{rational.c → gsl_native/rational.c} +12 -12
- data/ext/{rng.c → gsl_native/rng.c} +30 -47
- data/ext/{root.c → gsl_native/root.c} +47 -48
- data/ext/{sf.c → gsl_native/sf.c} +196 -244
- data/ext/{sf_airy.c → gsl_native/sf_airy.c} +2 -2
- data/ext/{sf_bessel.c → gsl_native/sf_bessel.c} +7 -7
- data/ext/{sf_clausen.c → gsl_native/sf_clausen.c} +1 -1
- data/ext/{sf_coulomb.c → gsl_native/sf_coulomb.c} +40 -40
- data/ext/{sf_coupling.c → gsl_native/sf_coupling.c} +30 -30
- data/ext/{sf_dawson.c → gsl_native/sf_dawson.c} +1 -1
- data/ext/{sf_debye.c → gsl_native/sf_debye.c} +1 -10
- data/ext/{sf_dilog.c → gsl_native/sf_dilog.c} +1 -1
- data/ext/{sf_elementary.c → gsl_native/sf_elementary.c} +3 -3
- data/ext/{sf_ellint.c → gsl_native/sf_ellint.c} +43 -43
- data/ext/{sf_elljac.c → gsl_native/sf_elljac.c} +3 -3
- data/ext/{sf_erfc.c → gsl_native/sf_erfc.c} +1 -5
- data/ext/{sf_exp.c → gsl_native/sf_exp.c} +3 -3
- data/ext/{sf_expint.c → gsl_native/sf_expint.c} +2 -12
- data/ext/{sf_fermi_dirac.c → gsl_native/sf_fermi_dirac.c} +1 -1
- data/ext/{sf_gamma.c → gsl_native/sf_gamma.c} +2 -6
- data/ext/{sf_gegenbauer.c → gsl_native/sf_gegenbauer.c} +1 -1
- data/ext/{sf_hyperg.c → gsl_native/sf_hyperg.c} +1 -1
- data/ext/{sf_laguerre.c → gsl_native/sf_laguerre.c} +4 -4
- data/ext/{sf_lambert.c → gsl_native/sf_lambert.c} +1 -1
- data/ext/{sf_legendre.c → gsl_native/sf_legendre.c} +1 -1
- data/ext/{sf_log.c → gsl_native/sf_log.c} +4 -4
- data/ext/gsl_native/sf_mathieu.c +235 -0
- data/ext/{sf_power.c → gsl_native/sf_power.c} +1 -1
- data/ext/{sf_psi.c → gsl_native/sf_psi.c} +3 -12
- data/ext/{sf_synchrotron.c → gsl_native/sf_synchrotron.c} +1 -1
- data/ext/{sf_transport.c → gsl_native/sf_transport.c} +1 -1
- data/ext/{sf_trigonometric.c → gsl_native/sf_trigonometric.c} +4 -4
- data/ext/{sf_zeta.c → gsl_native/sf_zeta.c} +1 -5
- data/ext/{signal.c → gsl_native/signal.c} +63 -68
- data/ext/{siman.c → gsl_native/siman.c} +45 -49
- data/ext/{sort.c → gsl_native/sort.c} +6 -7
- data/ext/{spline.c → gsl_native/spline.c} +28 -46
- data/ext/{stats.c → gsl_native/stats.c} +105 -118
- data/ext/{sum.c → gsl_native/sum.c} +34 -34
- data/ext/{tamu_anova.c → gsl_native/tamu_anova.c} +1 -1
- data/ext/{tensor.c → gsl_native/tensor.c} +8 -11
- data/ext/{tensor_source.c → gsl_native/tensor_source.h} +147 -148
- data/ext/{vector.c → gsl_native/vector.c} +11 -14
- data/ext/{vector_complex.c → gsl_native/vector_complex.c} +179 -184
- data/ext/{vector_double.c → gsl_native/vector_double.c} +178 -183
- data/ext/{vector_int.c → gsl_native/vector_int.c} +27 -29
- data/ext/{vector_source.c → gsl_native/vector_source.h} +428 -443
- data/ext/{wavelet.c → gsl_native/wavelet.c} +224 -246
- data/gsl.gemspec +29 -0
- data/lib/gsl.rb +8 -3
- data/lib/gsl/gnuplot.rb +3 -3
- data/lib/gsl/oper.rb +35 -60
- data/lib/gsl/version.rb +3 -0
- data/lib/rbgsl.rb +1 -3
- data/rdoc/alf.rdoc +5 -5
- data/rdoc/blas.rdoc +9 -9
- data/rdoc/bspline.rdoc +17 -17
- data/rdoc/changes.rdoc +4 -9
- data/rdoc/cheb.rdoc +25 -25
- data/rdoc/cholesky_complex.rdoc +21 -21
- data/rdoc/combi.rdoc +37 -37
- data/rdoc/complex.rdoc +22 -22
- data/rdoc/const.rdoc +47 -47
- data/rdoc/dht.rdoc +49 -49
- data/rdoc/diff.rdoc +42 -42
- data/rdoc/ehandling.rdoc +6 -6
- data/rdoc/eigen.rdoc +153 -153
- data/rdoc/fft.rdoc +146 -146
- data/rdoc/fit.rdoc +109 -109
- data/rdoc/function.rdoc +11 -11
- data/rdoc/graph.rdoc +17 -17
- data/rdoc/hist.rdoc +103 -103
- data/rdoc/hist2d.rdoc +42 -42
- data/rdoc/hist3d.rdoc +9 -9
- data/rdoc/integration.rdoc +110 -110
- data/rdoc/interp.rdoc +71 -71
- data/rdoc/intro.rdoc +8 -8
- data/rdoc/linalg.rdoc +188 -188
- data/rdoc/linalg_complex.rdoc +1 -1
- data/rdoc/math.rdoc +58 -58
- data/rdoc/matrix.rdoc +275 -275
- data/rdoc/min.rdoc +57 -57
- data/rdoc/monte.rdoc +22 -22
- data/rdoc/multimin.rdoc +95 -95
- data/rdoc/multiroot.rdoc +80 -80
- data/rdoc/narray.rdoc +32 -32
- data/rdoc/ndlinear.rdoc +54 -54
- data/rdoc/nonlinearfit.rdoc +100 -100
- data/rdoc/ntuple.rdoc +31 -31
- data/rdoc/odeiv.rdoc +88 -88
- data/rdoc/perm.rdoc +90 -90
- data/rdoc/poly.rdoc +66 -66
- data/rdoc/qrng.rdoc +21 -21
- data/rdoc/randist.rdoc +82 -82
- data/rdoc/ref.rdoc +57 -57
- data/rdoc/rng.rdoc +85 -85
- data/rdoc/roots.rdoc +57 -57
- data/rdoc/sf.rdoc +428 -428
- data/rdoc/siman.rdoc +19 -19
- data/rdoc/sort.rdoc +30 -30
- data/rdoc/start.rdoc +8 -8
- data/rdoc/stats.rdoc +52 -52
- data/rdoc/sum.rdoc +12 -12
- data/rdoc/tensor.rdoc +31 -31
- data/rdoc/tut.rdoc +1 -1
- data/rdoc/use.rdoc +39 -39
- data/rdoc/vector.rdoc +188 -188
- data/rdoc/vector_complex.rdoc +24 -24
- data/rdoc/wavelet.rdoc +46 -46
- data/test/gsl/blas_test.rb +79 -0
- data/test/gsl/bspline_test.rb +63 -0
- data/test/gsl/cdf_test.rb +1512 -0
- data/test/gsl/cheb_test.rb +80 -0
- data/test/gsl/combination_test.rb +100 -0
- data/test/gsl/complex_test.rb +20 -0
- data/test/gsl/const_test.rb +29 -0
- data/test/gsl/deriv_test.rb +62 -0
- data/test/gsl/dht_test.rb +79 -0
- data/test/gsl/diff_test.rb +53 -0
- data/test/gsl/eigen_test.rb +563 -0
- data/test/gsl/err_test.rb +23 -0
- data/test/gsl/fit_test.rb +101 -0
- data/test/gsl/histo_test.rb +14 -0
- data/test/gsl/index_test.rb +61 -0
- data/test/gsl/integration_test.rb +274 -0
- data/test/gsl/interp_test.rb +27 -0
- data/test/gsl/linalg_test.rb +463 -0
- data/test/gsl/matrix_nmf_test.rb +37 -0
- data/test/gsl/matrix_test.rb +98 -0
- data/test/gsl/min_test.rb +89 -0
- data/test/gsl/monte_test.rb +77 -0
- data/test/gsl/multifit_test.rb +753 -0
- data/test/gsl/multimin_test.rb +157 -0
- data/test/gsl/multiroot_test.rb +135 -0
- data/test/gsl/multiset_test.rb +52 -0
- data/test/gsl/odeiv_test.rb +275 -0
- data/test/gsl/oper_test.rb +98 -0
- data/test/gsl/poly_test.rb +338 -0
- data/test/gsl/qrng_test.rb +94 -0
- data/test/gsl/quartic_test.rb +28 -0
- data/test/gsl/randist_test.rb +122 -0
- data/test/gsl/rng_test.rb +303 -0
- data/test/gsl/roots_test.rb +78 -0
- data/test/gsl/sf_test.rb +2079 -0
- data/test/gsl/stats_test.rb +122 -0
- data/test/gsl/sum_test.rb +69 -0
- data/test/gsl/tensor_test.rb +396 -0
- data/test/gsl/vector_test.rb +223 -0
- data/test/gsl/wavelet_test.rb +130 -0
- data/test/gsl_test.rb +321 -0
- data/test/test_helper.rb +42 -0
- data/uncrustify.cfg +1693 -0
- metadata +337 -378
- data/README +0 -32
- data/VERSION +0 -1
- data/ext/bspline.c +0 -130
- data/ext/const.c +0 -673
- data/ext/cqp.c +0 -283
- data/ext/extconf.rb +0 -295
- data/ext/fcmp.c +0 -66
- data/ext/fresnel.c +0 -312
- data/ext/jacobi.c +0 -739
- data/ext/ool.c +0 -879
- data/ext/oper_complex_source.c +0 -253
- data/ext/sf_mathieu.c +0 -238
- data/include/rb_gsl_config.h +0 -62
- data/include/rb_gsl_dirac.h +0 -13
- data/rdoc/index.rdoc +0 -62
- data/rdoc/rngextra.rdoc +0 -11
- data/rdoc/screenshot.rdoc +0 -40
- data/setup.rb +0 -1585
- data/tests/blas/amax.rb +0 -14
- data/tests/blas/asum.rb +0 -16
- data/tests/blas/axpy.rb +0 -25
- data/tests/blas/copy.rb +0 -23
- data/tests/blas/dot.rb +0 -23
- data/tests/bspline.rb +0 -53
- data/tests/cdf.rb +0 -1388
- data/tests/cheb.rb +0 -112
- data/tests/combination.rb +0 -123
- data/tests/complex.rb +0 -17
- data/tests/const.rb +0 -24
- data/tests/deriv.rb +0 -85
- data/tests/dht/dht1.rb +0 -17
- data/tests/dht/dht2.rb +0 -23
- data/tests/dht/dht3.rb +0 -23
- data/tests/dht/dht4.rb +0 -23
- data/tests/diff.rb +0 -78
- data/tests/eigen/eigen.rb +0 -220
- data/tests/eigen/gen.rb +0 -105
- data/tests/eigen/genherm.rb +0 -66
- data/tests/eigen/gensymm.rb +0 -68
- data/tests/eigen/nonsymm.rb +0 -53
- data/tests/eigen/nonsymmv.rb +0 -53
- data/tests/eigen/symm-herm.rb +0 -74
- data/tests/err.rb +0 -58
- data/tests/fit.rb +0 -124
- data/tests/gsl_test.rb +0 -118
- data/tests/gsl_test2.rb +0 -110
- data/tests/histo.rb +0 -12
- data/tests/integration/integration1.rb +0 -72
- data/tests/integration/integration2.rb +0 -71
- data/tests/integration/integration3.rb +0 -71
- data/tests/integration/integration4.rb +0 -71
- data/tests/interp.rb +0 -45
- data/tests/linalg/HH.rb +0 -64
- data/tests/linalg/LU.rb +0 -47
- data/tests/linalg/QR.rb +0 -77
- data/tests/linalg/SV.rb +0 -24
- data/tests/linalg/TDN.rb +0 -116
- data/tests/linalg/TDS.rb +0 -122
- data/tests/linalg/bidiag.rb +0 -73
- data/tests/linalg/cholesky.rb +0 -20
- data/tests/linalg/linalg.rb +0 -158
- data/tests/matrix/matrix_complex_test.rb +0 -36
- data/tests/matrix/matrix_nmf_test.rb +0 -39
- data/tests/matrix/matrix_test.rb +0 -48
- data/tests/min.rb +0 -99
- data/tests/monte/miser.rb +0 -31
- data/tests/monte/vegas.rb +0 -45
- data/tests/multifit/test_2dgauss.rb +0 -112
- data/tests/multifit/test_brown.rb +0 -90
- data/tests/multifit/test_enso.rb +0 -246
- data/tests/multifit/test_filip.rb +0 -155
- data/tests/multifit/test_gauss.rb +0 -97
- data/tests/multifit/test_longley.rb +0 -110
- data/tests/multifit/test_multifit.rb +0 -52
- data/tests/multimin.rb +0 -139
- data/tests/multiroot.rb +0 -131
- data/tests/multiset.rb +0 -52
- data/tests/narray/blas_dnrm2.rb +0 -20
- data/tests/odeiv.rb +0 -353
- data/tests/poly/poly.rb +0 -290
- data/tests/poly/special.rb +0 -65
- data/tests/qrng.rb +0 -131
- data/tests/quartic.rb +0 -29
- data/tests/randist.rb +0 -134
- data/tests/rng.rb +0 -305
- data/tests/roots.rb +0 -76
- data/tests/run-test.sh +0 -17
- data/tests/sf/gsl_test_sf.rb +0 -249
- data/tests/sf/test_airy.rb +0 -83
- data/tests/sf/test_bessel.rb +0 -306
- data/tests/sf/test_coulomb.rb +0 -17
- data/tests/sf/test_dilog.rb +0 -25
- data/tests/sf/test_gamma.rb +0 -209
- data/tests/sf/test_hyperg.rb +0 -356
- data/tests/sf/test_legendre.rb +0 -227
- data/tests/sf/test_mathieu.rb +0 -59
- data/tests/sf/test_mode.rb +0 -19
- data/tests/sf/test_sf.rb +0 -839
- data/tests/stats.rb +0 -174
- data/tests/stats_mt.rb +0 -16
- data/tests/sum.rb +0 -98
- data/tests/sys.rb +0 -323
- data/tests/tensor.rb +0 -419
- data/tests/vector/vector_complex_test.rb +0 -101
- data/tests/vector/vector_test.rb +0 -141
- data/tests/wavelet.rb +0 -142
data/rdoc/nonlinearfit.rdoc
CHANGED
@@ -1,60 +1,60 @@
|
|
1
1
|
#
|
2
2
|
# = Nonlinear Least-Squares Fitting
|
3
|
-
# This chapter describes functions for multidimensional nonlinear least-squares
|
4
|
-
# fitting. The library provides low level components for a variety of iterative
|
5
|
-
# solvers and convergence tests. These can be combined by the user to achieve
|
6
|
-
# the desired solution, with full access to the intermediate steps of the
|
7
|
-
# iteration. Each class of methods uses the same framework, so that you can
|
8
|
-
# switch between solvers at runtime without needing to recompile your program.
|
9
|
-
# Each instance of a solver keeps track of its own state, allowing the solvers
|
10
|
-
# to be used in multi-threaded programs.
|
3
|
+
# This chapter describes functions for multidimensional nonlinear least-squares
|
4
|
+
# fitting. The library provides low level components for a variety of iterative
|
5
|
+
# solvers and convergence tests. These can be combined by the user to achieve
|
6
|
+
# the desired solution, with full access to the intermediate steps of the
|
7
|
+
# iteration. Each class of methods uses the same framework, so that you can
|
8
|
+
# switch between solvers at runtime without needing to recompile your program.
|
9
|
+
# Each instance of a solver keeps track of its own state, allowing the solvers
|
10
|
+
# to be used in multi-threaded programs.
|
11
11
|
#
|
12
12
|
# Contents:
|
13
|
-
# 1. {Overview}[link:
|
14
|
-
# 1. {Initializing the Solver}[link:
|
15
|
-
# 1. {GSL::MultiFit::FdfSolver class}[link:
|
16
|
-
# 1. {Providing the function to be minimized}[link:
|
17
|
-
# 1. {GSL::MultiFit::Function_fdf class}[link:
|
18
|
-
# 1. {Iteration}[link:
|
19
|
-
# 1. {Search Stopping Parameters}[link:
|
20
|
-
# 1. {Computing the covariance matrix of best fit parameters}[link:
|
21
|
-
# 1. {Higher level interfaces}[link:
|
22
|
-
# 1. {Examples}[link:
|
23
|
-
# 1. {Fitting to user-defined functions}[link:
|
24
|
-
# 1. {Fitting to built-in functions}[link:
|
25
|
-
#
|
26
|
-
# ==
|
27
|
-
# The problem of multidimensional nonlinear least-squares fitting requires the
|
28
|
-
# minimization of the squared residuals of n functions, f_i, in p parameters,
|
29
|
-
# x_i, All algorithms proceed from an initial guess using the linearization,
|
30
|
-
# where x is the initial point, p is the proposed step and J is the Jacobian
|
31
|
-
# matrix J_{ij} = d f_i / d x_j. Additional strategies are used to enlarge the
|
32
|
-
# region of convergence. These include requiring a decrease in the norm ||F||
|
33
|
-
# on each step or using a trust region to avoid steps which fall outside the
|
34
|
-
# linear regime.
|
35
|
-
#
|
36
|
-
# To perform a weighted least-squares fit of a nonlinear model Y(x,t) to data
|
37
|
-
# (t_i, y_i) with independent gaussian errors \sigma_i, use function components
|
38
|
-
# of the following form, Note that the model parameters are denoted by x in this
|
39
|
-
# chapter since the non-linear least-squares algorithms are described
|
40
|
-
# geometrically (i.e. finding the minimum of a surface). The independent
|
41
|
-
# variable of any data to be fitted is denoted by t.
|
42
|
-
#
|
43
|
-
# With the definition above the Jacobian is
|
44
|
-
# J_{ij} =(1 / \sigma_i) d Y_i / d x_j, where Y_i = Y(x,t_i).
|
45
|
-
#
|
46
|
-
# ==
|
47
|
-
#
|
48
|
-
# ===
|
13
|
+
# 1. {Overview}[link:rdoc/nonlinearfit_rdoc.html#label-Overview]
|
14
|
+
# 1. {Initializing the Solver}[link:rdoc/nonlinearfit_rdoc.html#label-Initializing+the+Solver]
|
15
|
+
# 1. {GSL::MultiFit::FdfSolver class}[link:rdoc/nonlinearfit_rdoc.html#label-FdfSolver+class]
|
16
|
+
# 1. {Providing the function to be minimized}[link:rdoc/nonlinearfit_rdoc.html#label-Providing+the+function+to+be+minimized]
|
17
|
+
# 1. {GSL::MultiFit::Function_fdf class}[link:rdoc/nonlinearfit_rdoc.html#label-Function_fdf+class]
|
18
|
+
# 1. {Iteration}[link:rdoc/nonlinearfit_rdoc.html#label-Iteration]
|
19
|
+
# 1. {Search Stopping Parameters}[link:rdoc/nonlinearfit_rdoc.html#label-Search+Stopping+Parameters]
|
20
|
+
# 1. {Computing the covariance matrix of best fit parameters}[link:rdoc/nonlinearfit_rdoc.html#label-Computing+the+covariance+matrix+of+best+fit+parameters]
|
21
|
+
# 1. {Higher level interfaces}[link:rdoc/nonlinearfit_rdoc.html#label-Higher+level+interfaces]
|
22
|
+
# 1. {Examples}[link:rdoc/nonlinearfit_rdoc.html#label-Examples]
|
23
|
+
# 1. {Fitting to user-defined functions}[link:rdoc/nonlinearfit_rdoc.html#label-Fitting+to+user-defined+functions]
|
24
|
+
# 1. {Fitting to built-in functions}[link:rdoc/nonlinearfit_rdoc.html#label-Fitting+to+built-in+functions]
|
25
|
+
#
|
26
|
+
# == Overview
|
27
|
+
# The problem of multidimensional nonlinear least-squares fitting requires the
|
28
|
+
# minimization of the squared residuals of n functions, f_i, in p parameters,
|
29
|
+
# x_i, All algorithms proceed from an initial guess using the linearization,
|
30
|
+
# where x is the initial point, p is the proposed step and J is the Jacobian
|
31
|
+
# matrix J_{ij} = d f_i / d x_j. Additional strategies are used to enlarge the
|
32
|
+
# region of convergence. These include requiring a decrease in the norm ||F||
|
33
|
+
# on each step or using a trust region to avoid steps which fall outside the
|
34
|
+
# linear regime.
|
35
|
+
#
|
36
|
+
# To perform a weighted least-squares fit of a nonlinear model Y(x,t) to data
|
37
|
+
# (t_i, y_i) with independent gaussian errors \sigma_i, use function components
|
38
|
+
# of the following form, Note that the model parameters are denoted by x in this
|
39
|
+
# chapter since the non-linear least-squares algorithms are described
|
40
|
+
# geometrically (i.e. finding the minimum of a surface). The independent
|
41
|
+
# variable of any data to be fitted is denoted by t.
|
42
|
+
#
|
43
|
+
# With the definition above the Jacobian is
|
44
|
+
# J_{ij} =(1 / \sigma_i) d Y_i / d x_j, where Y_i = Y(x,t_i).
|
45
|
+
#
|
46
|
+
# == Initializing the Solver
|
47
|
+
#
|
48
|
+
# === FdfSolver class
|
49
49
|
# ---
|
50
50
|
# * GSL::MultiFit::FdfSolver.alloc(T, n, p)
|
51
51
|
#
|
52
|
-
# This creates an instance of the <tt>GSL::MultiFit::FdfSolver</tt> class of
|
52
|
+
# This creates an instance of the <tt>GSL::MultiFit::FdfSolver</tt> class of
|
53
53
|
# type <tt>T</tt> for <tt>n</tt> observations and <tt>p</tt> parameters. The type <tt>T</tt>
|
54
|
-
# is given by a <tt>Fixnum</tt> constant or a <tt>String</tt>,
|
54
|
+
# is given by a <tt>Fixnum</tt> constant or a <tt>String</tt>,
|
55
55
|
# * <tt>GSL::MultiFit::LMSDER</tt> or <tt>"lmsder"</tt>
|
56
56
|
# * <tt>GSL::MultiFit::LMDER</tt> or <tt>"lmder"</tt>
|
57
|
-
# For example, the following code creates an instance of a Levenberg-Marquardt
|
57
|
+
# For example, the following code creates an instance of a Levenberg-Marquardt
|
58
58
|
# solver for 100 data points and 3 parameters,
|
59
59
|
#
|
60
60
|
# solver = MultiFit::FdfSolver.alloc(MultiFit::LMDER, 100, 3)
|
@@ -62,10 +62,10 @@
|
|
62
62
|
# ---
|
63
63
|
# * GSL::MultiFit::FdfSolver#set(f, x)
|
64
64
|
#
|
65
|
-
# This method initializes, or reinitializes, an existing solver <tt>self</tt>
|
65
|
+
# This method initializes, or reinitializes, an existing solver <tt>self</tt>
|
66
66
|
# to use the function <tt>f</tt> and the initial guess <tt>x</tt>. The function <tt>f</tt>
|
67
67
|
# is an instance of the <tt>GSL::MultiFit::Function_fdf</tt> class (see below). The
|
68
|
-
# initial guess of the parameters <tt>x</tt> is given by a {GSL::Vector}[link:
|
68
|
+
# initial guess of the parameters <tt>x</tt> is given by a {GSL::Vector}[link:rdoc/vector_rdoc.html] object.
|
69
69
|
#
|
70
70
|
# ---
|
71
71
|
# * GSL::MultiFit::FdfSolver#name
|
@@ -83,16 +83,16 @@
|
|
83
83
|
#
|
84
84
|
# Access to the members (see <tt>gsl_multifit_nlin.h</tt>)
|
85
85
|
#
|
86
|
-
# ==
|
87
|
-
# ===
|
86
|
+
# == Providing the function to be minimized
|
87
|
+
# === Function_fdf class
|
88
88
|
# ---
|
89
89
|
# * GSL::MultiFit::Function_fdf.alloc()
|
90
90
|
# * GSL::MultiFit::Function_fdf.alloc(f, df, p)
|
91
91
|
# * GSL::MultiFit::Function_fdf.alloc(f, df, fdf, p)
|
92
92
|
#
|
93
93
|
# Constructor for the <tt>Function_fdf</tt> class, to a
|
94
|
-
# function with <tt>p</tt> parameters, The first two or three arguments are Ruby Proc objects
|
95
|
-
# to evaluate the function to minimize and its derivative (Jacobian).
|
94
|
+
# function with <tt>p</tt> parameters, The first two or three arguments are Ruby Proc objects
|
95
|
+
# to evaluate the function to minimize and its derivative (Jacobian).
|
96
96
|
#
|
97
97
|
# ---
|
98
98
|
# * GSL::MultiFit::Function_fdf#set_procs(f, df, p)
|
@@ -106,24 +106,24 @@
|
|
106
106
|
# * GSL::MultiFit::Function_fdf#set_data(t, y, sigma)
|
107
107
|
#
|
108
108
|
# This sets the data <tt>t, y, sigma</tt> of length <tt>n</tt>, to the function <tt>self</tt>.
|
109
|
-
#
|
110
|
-
# ==
|
109
|
+
#
|
110
|
+
# == Iteration
|
111
111
|
# ---
|
112
112
|
# * GSL::MultiFit::FdfSolver#iterate
|
113
113
|
#
|
114
|
-
# THis performs a single iteration of the solver <tt>self</tt>. If the iteration
|
115
|
-
# encounters an unexpected problem then an error code will be returned.
|
116
|
-
# The solver maintains a current estimate of the best-fit parameters at all
|
114
|
+
# THis performs a single iteration of the solver <tt>self</tt>. If the iteration
|
115
|
+
# encounters an unexpected problem then an error code will be returned.
|
116
|
+
# The solver maintains a current estimate of the best-fit parameters at all
|
117
117
|
# times. This information can be accessed with the method <tt>position</tt>.
|
118
118
|
#
|
119
119
|
# ---
|
120
120
|
# * GSL::MultiFit::FdfSolver#position
|
121
121
|
#
|
122
|
-
# This returns the current position (i.e. best-fit parameters) of the solver
|
122
|
+
# This returns the current position (i.e. best-fit parameters) of the solver
|
123
123
|
# <tt>self</tt>, as a <tt>GSL::Vector</tt> object.
|
124
124
|
#
|
125
125
|
#
|
126
|
-
# ==
|
126
|
+
# == Search Stopping Parameters
|
127
127
|
# A minimization procedure should stop when one of the following conditions is true:
|
128
128
|
# * A minimum has been found to within the user-specified precision.
|
129
129
|
# * A user-specified maximum number of iterations has been reached.
|
@@ -134,9 +134,9 @@
|
|
134
134
|
# ---
|
135
135
|
# * GSL::MultiFit::FdfSolver#test_delta(epsabs, epsrel)
|
136
136
|
#
|
137
|
-
# This method tests for the convergence of the sequence by comparing the last
|
138
|
-
# step with the absolute error <tt>epsabs</tt> and relative error (<tt>epsrel</tt>
|
139
|
-
# to the current position. The test returns <tt>GSL::SUCCESS</tt> if the following
|
137
|
+
# This method tests for the convergence of the sequence by comparing the last
|
138
|
+
# step with the absolute error <tt>epsabs</tt> and relative error (<tt>epsrel</tt>
|
139
|
+
# to the current position. The test returns <tt>GSL::SUCCESS</tt> if the following
|
140
140
|
# condition is achieved,
|
141
141
|
# |dx_i| < epsabs + epsrel |x_i|
|
142
142
|
# for each component of <tt>x</tt> and returns <tt>GSL::CONTINUE</tt> otherwise.
|
@@ -145,19 +145,19 @@
|
|
145
145
|
# * GSL::MultiFit::FdfSolver#test_gradient(g, epsabs)
|
146
146
|
# * GSL::MultiFit::FdfSolver#test_gradient(epsabs)
|
147
147
|
#
|
148
|
-
# This function tests the residual gradient <tt>g</tt> against the absolute error
|
149
|
-
# bound <tt>epsabs</tt>. If <tt>g</tt> is not given, it is calculated internally.
|
150
|
-
# Mathematically, the gradient should be exactly zero at the minimum.
|
148
|
+
# This function tests the residual gradient <tt>g</tt> against the absolute error
|
149
|
+
# bound <tt>epsabs</tt>. If <tt>g</tt> is not given, it is calculated internally.
|
150
|
+
# Mathematically, the gradient should be exactly zero at the minimum.
|
151
151
|
# The test returns <tt>GSL::SUCCESS</tt> if the following condition is achieved,
|
152
152
|
# \sum_i |g_i| < epsabs
|
153
|
-
# and returns <tt>GSL::CONTINUE</tt> otherwise. This criterion is suitable for
|
154
|
-
# situations where the precise location of the minimum, x, is unimportant provided
|
153
|
+
# and returns <tt>GSL::CONTINUE</tt> otherwise. This criterion is suitable for
|
154
|
+
# situations where the precise location of the minimum, x, is unimportant provided
|
155
155
|
# a value can be found where the gradient is small enough.
|
156
156
|
#
|
157
157
|
# ---
|
158
158
|
# * GSL::MultiFit::FdfSolver#gradient
|
159
159
|
#
|
160
|
-
# This method returns the gradient g of \Phi(x) = (1/2) ||F(x)||^2 from the
|
160
|
+
# This method returns the gradient g of \Phi(x) = (1/2) ||F(x)||^2 from the
|
161
161
|
# Jacobian matrix and the function values, using the formula g = J^T f.
|
162
162
|
#
|
163
163
|
# ---
|
@@ -170,71 +170,71 @@
|
|
170
170
|
# Singleton methods of the <tt>GSL::MultiFit</tt> module.
|
171
171
|
#
|
172
172
|
#
|
173
|
-
# ==
|
173
|
+
# == Computing the covariance matrix of best fit parameters
|
174
174
|
# ---
|
175
175
|
# * GSL::MultiFit.covar(J, epsrel)
|
176
176
|
# * GSL::MultiFit.covar(J, epsrel, covar)
|
177
177
|
#
|
178
|
-
# This method uses the Jacobian matrix <tt>J</tt> to compute the covariance
|
178
|
+
# This method uses the Jacobian matrix <tt>J</tt> to compute the covariance
|
179
179
|
# matrix of the best-fit parameters. If an existing matrix <tt>covar</tt> is given,
|
180
|
-
# it is overwritten, and if not, this method returns a new matrix.
|
181
|
-
# The parameter <tt>epsrel</tt> is used to remove linear-dependent columns when
|
180
|
+
# it is overwritten, and if not, this method returns a new matrix.
|
181
|
+
# The parameter <tt>epsrel</tt> is used to remove linear-dependent columns when
|
182
182
|
# <tt>J</tt> is rank deficient.
|
183
183
|
#
|
184
184
|
# The covariance matrix is given by,
|
185
185
|
# covar = (J^T J)^{-1}
|
186
|
-
# and is computed by QR decomposition of <tt>J</tt> with column-pivoting.
|
186
|
+
# and is computed by QR decomposition of <tt>J</tt> with column-pivoting.
|
187
187
|
# Any columns of R which satisfy
|
188
188
|
# |R_{kk}| <= epsrel |R_{11}|
|
189
|
-
# are considered linearly-dependent and are excluded from the covariance matrix
|
189
|
+
# are considered linearly-dependent and are excluded from the covariance matrix
|
190
190
|
# (the corresponding rows and columns of the covariance matrix are set to zero).
|
191
191
|
#
|
192
|
-
# ==
|
192
|
+
# == Higher level interfaces
|
193
193
|
# ---
|
194
194
|
# * GSL::MultiFit::FdfSolver.fit(x, y, type[, guess])
|
195
195
|
# * GSL::MultiFit::FdfSolver.fit(x, w, y, type[, guess])
|
196
196
|
#
|
197
197
|
# This method uses <tt>FdfSolver</tt> with the LMSDER algorithm to fit the data
|
198
|
-
# <tt>[x, y]</tt> to a function of type <tt>type</tt>. The returned value is
|
198
|
+
# <tt>[x, y]</tt> to a function of type <tt>type</tt>. The returned value is
|
199
199
|
# an array of 4 elements, <tt>[coef, err, chisq, dof]</tt>,
|
200
200
|
# where <tt>coef</tt> is an array of the fitting coefficients, <tt>err</tt> contains
|
201
|
-
# errors in estimating <tt>coef</tt>, <tt>chisq</tt> is the
|
202
|
-
# chi-squared, and <tt>dof</tt> is the degree-of-freedom in the fitting
|
201
|
+
# errors in estimating <tt>coef</tt>, <tt>chisq</tt> is the
|
202
|
+
# chi-squared, and <tt>dof</tt> is the degree-of-freedom in the fitting
|
203
203
|
# which equals to (data length - number of fitting coefficients). The optional
|
204
204
|
# argument <tt>guess</tt> is an array of initial guess of the coefficients.
|
205
205
|
# The fitting type <tt>type</tt> is given by a <tt>String</tt> as follows.
|
206
|
-
# * <tt>"gaussian"</tt>: Gaussian fit,
|
206
|
+
# * <tt>"gaussian"</tt>: Gaussian fit,
|
207
207
|
# <tt>y = y0 + A exp(-(x-x0)^2/2/var)</tt>, <tt>coef = [y0, A, x0, var]</tt>
|
208
208
|
# * <tt>"gaussian_2peaks"</tt>: 2-peak Gaussian fit,
|
209
209
|
# <tt>y = y0 + A1 exp(-(x-x1)^2/2/var1) + A2 exp(-(x-x2)^2/2/var2)</tt>, <tt>coef = [y0, A1, x1, var1, A2, x2, var2]</tt>
|
210
|
-
# * <tt>"exp"</tt>: Exponential fit,
|
210
|
+
# * <tt>"exp"</tt>: Exponential fit,
|
211
211
|
# <tt>y = y0 + A exp(-b x)</tt>, <tt>coef = [y0, A, b]</tt>
|
212
|
-
# * <tt>"dblexp"</tt>: Double exponential fit,
|
212
|
+
# * <tt>"dblexp"</tt>: Double exponential fit,
|
213
213
|
# <tt>y = y0 + A1 exp(-b1 x) + A2 exp(-b2 x)</tt>, <tt>coef = [y0, A1, b1, A2, b2]</tt>
|
214
|
-
# * <tt>"sin"</tt>: Sinusoidal fit,
|
214
|
+
# * <tt>"sin"</tt>: Sinusoidal fit,
|
215
215
|
# <tt>y = y0 + A sin(f x + phi)</tt>, <tt>coef = [y0, A, f, phi]</tt>
|
216
|
-
# * <tt>"lor"</tt>: Lorentzian peak fit,
|
216
|
+
# * <tt>"lor"</tt>: Lorentzian peak fit,
|
217
217
|
# <tt>y = y0 + A/((x-x0)^2 + B)</tt>, <tt>coef = [y0, A, x0, B]</tt>
|
218
|
-
# * <tt>"hill"</tt>: Hill's equation fit,
|
218
|
+
# * <tt>"hill"</tt>: Hill's equation fit,
|
219
219
|
# <tt>y = y0 + (m - y0)/(1 + (xhalf/x)^r)</tt>, <tt>coef = [y0, n, xhalf, r]</tt>
|
220
|
-
# * <tt>"sigmoid"</tt>: Sigmoid (Fermi-Dirac) function fit,
|
220
|
+
# * <tt>"sigmoid"</tt>: Sigmoid (Fermi-Dirac) function fit,
|
221
221
|
# <tt>y = y0 + m/(1 + exp((x0-x)/r))</tt>, <tt>coef = [y0, m, x0, r]</tt>
|
222
|
-
# * <tt>"power"</tt>: Power-law fit,
|
222
|
+
# * <tt>"power"</tt>: Power-law fit,
|
223
223
|
# <tt>y = y0 + A x^r</tt>, <tt>coef = [y0, A, r]</tt>
|
224
|
-
# * <tt>"lognormal"</tt>: Lognormal peak fit,
|
224
|
+
# * <tt>"lognormal"</tt>: Lognormal peak fit,
|
225
225
|
# <tt>y = y0 + A exp[ -(log(x/x0)/width)^2 ]</tt>, <tt>coef = [y0, A, x0, width]</tt>
|
226
226
|
#
|
227
|
-
# See {Linear fitting}[link:
|
227
|
+
# See {Linear fitting}[link:rdoc/fit_rdoc.html#label-Higer+level+interface] for linear and polynomical fittings.
|
228
228
|
#
|
229
|
-
# ==
|
230
|
-
# ===
|
229
|
+
# == Examples
|
230
|
+
# === Fitting to user-defined functions
|
231
231
|
#
|
232
|
-
# The following example program fits a weighted exponential model with background
|
233
|
-
# to experimental data, Y = A exp(-lambda t) + b. The first part of the program sets
|
234
|
-
# up the functions <tt>procf</tt> and <tt>procdf</tt> to calculate the model and its Jacobian.
|
232
|
+
# The following example program fits a weighted exponential model with background
|
233
|
+
# to experimental data, Y = A exp(-lambda t) + b. The first part of the program sets
|
234
|
+
# up the functions <tt>procf</tt> and <tt>procdf</tt> to calculate the model and its Jacobian.
|
235
235
|
# The appropriate fitting function is given by,
|
236
236
|
# f_i = ((A exp(-lambda t_i) + b) - y_i)/sigma_i
|
237
|
-
# where we have chosen t_i = i. The Jacobian matrix <tt>jac</tt> is the derivative of
|
237
|
+
# where we have chosen t_i = i. The Jacobian matrix <tt>jac</tt> is the derivative of
|
238
238
|
# these functions with respect to the three parameters (A, lambda, b). It is given by,
|
239
239
|
# J_{ij} = d f_i / d x_j
|
240
240
|
# where x_0 = A, x_1 = lambda and x_2 = b.
|
@@ -310,7 +310,7 @@
|
|
310
310
|
# printf("b = %.5f +/- %.5f\n", position[2], Math::sqrt(chi2/dof*covar[2][2]))
|
311
311
|
#
|
312
312
|
#
|
313
|
-
# ===
|
313
|
+
# === Fitting to built-in functions
|
314
314
|
# #!/usr/bin/env ruby
|
315
315
|
# require("gsl")
|
316
316
|
# include MultiFit
|
@@ -338,11 +338,11 @@
|
|
338
338
|
# graph(x, y, y0+amp*Sf::exp(-pow_2(Sf::log(x/x0)/w)))
|
339
339
|
#
|
340
340
|
#
|
341
|
-
# {prev}[link:
|
342
|
-
# {next}[link:
|
341
|
+
# {prev}[link:rdoc/fit_rdoc.html]
|
342
|
+
# {next}[link:rdoc/bspline_rdoc.html]
|
343
343
|
#
|
344
|
-
# {Reference index}[link:
|
345
|
-
# {top}[link:
|
344
|
+
# {Reference index}[link:rdoc/ref_rdoc.html]
|
345
|
+
# {top}[link:index.html]
|
346
346
|
#
|
347
347
|
#
|
348
348
|
#
|
data/rdoc/ntuple.rdoc
CHANGED
@@ -1,28 +1,28 @@
|
|
1
1
|
#
|
2
2
|
# = N-tuples
|
3
|
-
# This chapter describes functions for creating and manipulating ntuples,
|
4
|
-
# sets of values associated with events. The ntuples are stored in files.
|
5
|
-
# Their values can be extracted in any combination and booked in a histogram using
|
3
|
+
# This chapter describes functions for creating and manipulating ntuples,
|
4
|
+
# sets of values associated with events. The ntuples are stored in files.
|
5
|
+
# Their values can be extracted in any combination and booked in a histogram using
|
6
6
|
# a selection function.
|
7
7
|
#
|
8
|
-
# The values to be stored are held in a {GSL::Vector}[link:
|
9
|
-
# a {GSL::Matrix}[link:
|
10
|
-
# and an ntuple is created associating this object with a file.
|
11
|
-
# The values are then written to the file (normally inside a loop) using
|
8
|
+
# The values to be stored are held in a {GSL::Vector}[link:rdoc/vector_rdoc.html] or
|
9
|
+
# a {GSL::Matrix}[link:rdoc/matrix_rdoc.html] object,
|
10
|
+
# and an ntuple is created associating this object with a file.
|
11
|
+
# The values are then written to the file (normally inside a loop) using
|
12
12
|
# the ntuple functions described below.
|
13
13
|
#
|
14
|
-
# A histogram can be created from ntuple data by providing a selection function
|
15
|
-
# and a value function. The selection function specifies whether an event should
|
16
|
-
# be included in the subset to be analyzed or not. The value function computes
|
14
|
+
# A histogram can be created from ntuple data by providing a selection function
|
15
|
+
# and a value function. The selection function specifies whether an event should
|
16
|
+
# be included in the subset to be analyzed or not. The value function computes
|
17
17
|
# the entry to be added to the histogram for each event.
|
18
18
|
#
|
19
|
-
# ==
|
19
|
+
# == The <tt>Ntuple</tt> class
|
20
20
|
# ---
|
21
21
|
# * GSL::Ntuple.create(filename, v)
|
22
22
|
# * GSL::Ntuple.alloc(filename, v)
|
23
23
|
#
|
24
|
-
# These create a new write-only ntuple file <tt>filename</tt> for ntuples.
|
25
|
-
# Any existing file with the same name is truncated to zero length and overwritten.
|
24
|
+
# These create a new write-only ntuple file <tt>filename</tt> for ntuples.
|
25
|
+
# Any existing file with the same name is truncated to zero length and overwritten.
|
26
26
|
# A preexisting <tt>Vector</tt> object <tt>v</tt> for the current ntuple data must be supplied:
|
27
27
|
# this is used to copy ntuples in and out of the file.
|
28
28
|
#
|
@@ -32,7 +32,7 @@
|
|
32
32
|
# This opens an existing ntuple file <tt>filename</tt> for reading. A preexisting
|
33
33
|
# <tt>Vector</tt> object <tt>v</tt> for the current ntuple data must be supplied.
|
34
34
|
#
|
35
|
-
# ==
|
35
|
+
# == Writing and reading ntuples
|
36
36
|
# ---
|
37
37
|
# * GSL::Ntuple#write
|
38
38
|
# * GSL::Ntuple#bookdata
|
@@ -44,11 +44,11 @@
|
|
44
44
|
#
|
45
45
|
# This method reads the current row of the ntuple file.
|
46
46
|
#
|
47
|
-
# ==
|
48
|
-
# Once an ntuple has been created its contents can be histogrammed in various ways using
|
49
|
-
# the function gsl_ntuple_project. Two user-defined functions must be provided, a function
|
50
|
-
# to select events and a function to compute scalar values. The selection function and the
|
51
|
-
# value function both accept the ntuple row as a first argument and other parameters as a
|
47
|
+
# == Histogramming ntuple values
|
48
|
+
# Once an ntuple has been created its contents can be histogrammed in various ways using
|
49
|
+
# the function gsl_ntuple_project. Two user-defined functions must be provided, a function
|
50
|
+
# to select events and a function to compute scalar values. The selection function and the
|
51
|
+
# value function both accept the ntuple row as a first argument and other parameters as a
|
52
52
|
# second argument.
|
53
53
|
#
|
54
54
|
# ---
|
@@ -58,10 +58,10 @@
|
|
58
58
|
# * GSL::Ntuple::ValueFn.alloc(proc)
|
59
59
|
#
|
60
60
|
# Constructors for selection functions and value functions.
|
61
|
-
# The selection function shoud return a non-zero value for each ntuple row that
|
61
|
+
# The selection function shoud return a non-zero value for each ntuple row that
|
62
62
|
# is to be included in the histogram. The value function should return the value to
|
63
63
|
# be added to the histogram for the ntuple row.
|
64
|
-
#
|
64
|
+
#
|
65
65
|
# ---
|
66
66
|
# * GSL::Ntuple::SelectFn#set_params(params)
|
67
67
|
# * GSL::Ntuple::ValueFn#set_params(params)
|
@@ -71,18 +71,18 @@
|
|
71
71
|
# ---
|
72
72
|
# * GSL::Ntuple.project(h, n, valfn, selfn)
|
73
73
|
#
|
74
|
-
# These methods updates the histogram <tt>h</tt> from the ntuple <tt>n</tt> using
|
75
|
-
# the functions <tt>valfn</tt> and <tt>selfn</tt>. For each ntuple row where the selection
|
76
|
-
# function <tt>selen</tt> is non-zero the corresponding value of that row is computed
|
77
|
-
# using the function value_func<tt>valfn</tt> and added to the histogram <tt>h</tt>.
|
78
|
-
# Those ntuple rows where <tt>selfn</tt> returns zero are ignored. New entries are added
|
79
|
-
# to the histogram, so subsequent calls can be used to accumulate further data in the
|
74
|
+
# These methods updates the histogram <tt>h</tt> from the ntuple <tt>n</tt> using
|
75
|
+
# the functions <tt>valfn</tt> and <tt>selfn</tt>. For each ntuple row where the selection
|
76
|
+
# function <tt>selen</tt> is non-zero the corresponding value of that row is computed
|
77
|
+
# using the function value_func<tt>valfn</tt> and added to the histogram <tt>h</tt>.
|
78
|
+
# Those ntuple rows where <tt>selfn</tt> returns zero are ignored. New entries are added
|
79
|
+
# to the histogram, so subsequent calls can be used to accumulate further data in the
|
80
80
|
# same histogram.
|
81
81
|
#
|
82
|
-
# {prev}[link:
|
83
|
-
# {next}[link:
|
82
|
+
# {prev}[link:rdoc/hist2d_rdoc.html]
|
83
|
+
# {next}[link:rdoc/monte_rdoc.html]
|
84
84
|
#
|
85
|
-
# {Reference index}[link:
|
86
|
-
# {top}[link:
|
85
|
+
# {Reference index}[link:rdoc/ref_rdoc.html]
|
86
|
+
# {top}[link:index.html]
|
87
87
|
#
|
88
88
|
#
|
data/rdoc/odeiv.rdoc
CHANGED
@@ -1,24 +1,24 @@
|
|
1
1
|
#
|
2
2
|
# = Ordinary Differential Equations
|
3
|
-
# This chapter describes functions for solving ordinary differential equation
|
4
|
-
# (ODE) initial value problems. The library provides a variety of low-level
|
5
|
-
# methods, such as Runge-Kutta and Bulirsch-Stoer routines, and higher-level
|
6
|
-
# components for adaptive step-size control. The components can be combined
|
7
|
-
# by the user to achieve the desired solution, with full access to any
|
8
|
-
# intermediate steps.
|
3
|
+
# This chapter describes functions for solving ordinary differential equation
|
4
|
+
# (ODE) initial value problems. The library provides a variety of low-level
|
5
|
+
# methods, such as Runge-Kutta and Bulirsch-Stoer routines, and higher-level
|
6
|
+
# components for adaptive step-size control. The components can be combined
|
7
|
+
# by the user to achieve the desired solution, with full access to any
|
8
|
+
# intermediate steps.
|
9
9
|
#
|
10
10
|
#
|
11
11
|
# Contents:
|
12
|
-
# 1. {Classes for ODE solver}[link:
|
13
|
-
# 1. {Class Descriptions}[link:
|
14
|
-
# 1. {GSL::Odeiv::System : Defining the ODE System}[link:
|
15
|
-
# 1. {GSL::Odeiv::Step : Stepping Algorithms}[link:
|
16
|
-
# 1. {GSL::Odeiv::Control : Adaptive Step-size Control}[link:
|
17
|
-
# 1. {GSL::Odeiv::Evolve : Evolution}[link:
|
18
|
-
# 1. {GSL::Odeiv::Solver : Higher level interface}[link:
|
19
|
-
# 1. {Examples}[link:
|
12
|
+
# 1. {Classes for ODE solver}[link:rdoc/odeiv_rdoc.html#label-Classes+for+ODE+solver]
|
13
|
+
# 1. {Class Descriptions}[link:rdoc/odeiv_rdoc.html#label-Class+Descriptions]
|
14
|
+
# 1. {GSL::Odeiv::System : Defining the ODE System}[link:rdoc/odeiv_rdoc.html#label-System]
|
15
|
+
# 1. {GSL::Odeiv::Step : Stepping Algorithms}[link:rdoc/odeiv_rdoc.html#label-Step]
|
16
|
+
# 1. {GSL::Odeiv::Control : Adaptive Step-size Control}[link:rdoc/odeiv_rdoc.html#label-Control]
|
17
|
+
# 1. {GSL::Odeiv::Evolve : Evolution}[link:rdoc/odeiv_rdoc.html#label-Evolve]
|
18
|
+
# 1. {GSL::Odeiv::Solver : Higher level interface}[link:rdoc/odeiv_rdoc.html#label-Solver]
|
19
|
+
# 1. {Examples}[link:rdoc/odeiv_rdoc.html#label-Example]
|
20
20
|
#
|
21
|
-
# ==
|
21
|
+
# == Classes for ODE solver
|
22
22
|
#
|
23
23
|
# ---
|
24
24
|
# * GSL::Odeiv::System
|
@@ -33,20 +33,20 @@
|
|
33
33
|
#
|
34
34
|
# Another higher-level interface to ODE system classes.
|
35
35
|
#
|
36
|
-
# ==
|
36
|
+
# == Class Descriptions
|
37
37
|
#
|
38
|
-
# ===
|
38
|
+
# === System
|
39
39
|
# ---
|
40
40
|
# * GSL::Odeiv::System.alloc(func, jac, dim)
|
41
41
|
# * GSL::Odeiv::System.alloc(func, dim)
|
42
42
|
#
|
43
43
|
# Constructor. This defines a general ODE system with the dimension <tt>dim</tt>.
|
44
|
-
#
|
44
|
+
#
|
45
45
|
# # t: variable (scalar)
|
46
46
|
# # y: vector
|
47
47
|
# # dydt: vector
|
48
48
|
# # params: scalar or an array
|
49
|
-
#
|
49
|
+
#
|
50
50
|
# func = Proc.new { |t, y, dydt, params|
|
51
51
|
# mu = params
|
52
52
|
# dydt[0] = y[1]
|
@@ -66,12 +66,12 @@
|
|
66
66
|
# dfdy.set(1, 1, -mu*(y[0]*y[0] - 1.0))
|
67
67
|
# dfdt[0] = 0.0
|
68
68
|
# dfdt[1] = 0.0
|
69
|
-
# }
|
69
|
+
# }
|
70
70
|
#
|
71
71
|
# sys = GSL:Odeiv::System.alloc(func, jac, dim) # for "BSIMP" algorithm
|
72
72
|
#
|
73
|
-
# Note that some of the simpler solver algorithms do not make use of the
|
74
|
-
# Jacobian matrix, so it is not always strictly necessary to provide it.
|
73
|
+
# Note that some of the simpler solver algorithms do not make use of the
|
74
|
+
# Jacobian matrix, so it is not always strictly necessary to provide it.
|
75
75
|
# Thus the constructor is as
|
76
76
|
# sys = GSL:Odeiv::System.alloc(func, nil, dim) # for others, replaced by nil
|
77
77
|
# sys = GSL:Odeiv::System.alloc(func, dim) # or omit
|
@@ -99,14 +99,14 @@
|
|
99
99
|
# * GSL::Odeiv::System#dim
|
100
100
|
#
|
101
101
|
#
|
102
|
-
# ===
|
102
|
+
# === Step
|
103
103
|
# The lowest level components are the stepping functions which advance a solution from time <tt>t</tt> to <tt>t+h</tt> for a fixed step-size <tt>h</tt> and estimate the resulting local error.
|
104
104
|
#
|
105
105
|
# ---
|
106
106
|
# * GSL::Odeiv::Step.alloc(T, dim)
|
107
107
|
#
|
108
|
-
# Constructor for a stepping function of an algorithm type <tt>T</tt> for a system of
|
109
|
-
# dimension <tt>dim</tt>. The algorithms are specified by one of the constants under the
|
108
|
+
# Constructor for a stepping function of an algorithm type <tt>T</tt> for a system of
|
109
|
+
# dimension <tt>dim</tt>. The algorithms are specified by one of the constants under the
|
110
110
|
# <tt>GSL::Odeiv::Step</tt> class, as
|
111
111
|
#
|
112
112
|
# 1. <tt>GSL::Odeiv::Step::RK2</tt>, Embedded 2nd order Runge-Kutta with 3rd order error estimate.
|
@@ -121,7 +121,7 @@
|
|
121
121
|
# 1. <tt>GSL::Odeiv::Step::GEAR2</tt>, M=2 implicit Gear method
|
122
122
|
# 1. <tt>GSL::Odeiv::Step::RK2SIMP</tt> (GSL-1.6)
|
123
123
|
#
|
124
|
-
# * Ex:
|
124
|
+
# * Ex:
|
125
125
|
# step = Odeiv::Step.alloc(Odeiv::Step::RKF45, 2)
|
126
126
|
#
|
127
127
|
# The algorithm types can also be given by a String, same as the C struct name,
|
@@ -138,14 +138,14 @@
|
|
138
138
|
# 1. "<tt>gear2</tt>" or "<tt>gsl_odeiv_step_gear2</tt>"
|
139
139
|
# 1. "<tt>rk2simp</tt>" or "<tt>gsl_odeiv_step_rk2simp</tt>" (GSL-1.6)
|
140
140
|
#
|
141
|
-
# * Ex:
|
141
|
+
# * Ex:
|
142
142
|
# step = Odeiv::Step.alloc("bsimp", 4)
|
143
143
|
# step2 = Odeiv::Step.alloc("gsl_odeiv_step_rkck", 3)
|
144
144
|
#
|
145
145
|
# ---
|
146
146
|
# * GSL::Odeiv::Step#reset
|
147
147
|
#
|
148
|
-
# This method resets the stepper. It should be used whenever the next use
|
148
|
+
# This method resets the stepper. It should be used whenever the next use
|
149
149
|
# of s will not be a continuation of a previous step.
|
150
150
|
#
|
151
151
|
# ---
|
@@ -163,7 +163,7 @@
|
|
163
163
|
# ---
|
164
164
|
# * GSL::Odeiv::Step#order
|
165
165
|
#
|
166
|
-
# Returns the order of the stepper on the previous step.
|
166
|
+
# Returns the order of the stepper on the previous step.
|
167
167
|
# This order can vary if the stepper itself is adaptive.
|
168
168
|
#
|
169
169
|
# ---
|
@@ -171,86 +171,86 @@
|
|
171
171
|
# * GSL::Odeiv::Step#apply(t, h, y, yerr, dydt_in, sys)
|
172
172
|
# * GSL::Odeiv::Step#apply(t, h, y, yerr, sys)
|
173
173
|
#
|
174
|
-
# This method applies the stepper to the system of equations defined by
|
175
|
-
# <tt>dydt</tt>, using the step size <tt>h</tt> to advance the system from time
|
176
|
-
# <tt>t</tt> and state <tt>y</tt> to time <tt>t+h</tt>. The new state of the system
|
177
|
-
# is stored in <tt>y</tt> on output, with an estimate of the absolute error in
|
178
|
-
# each component stored in <tt>yerr</tt>. If the argument <tt>dydt_in</tt> is not
|
179
|
-
# <tt>nil</tt> it should be a {GSL::Vector}[link:
|
180
|
-
# containing the derivatives for the system at time <tt>t</tt> on input.
|
181
|
-
# This is optional as the derivatives will be computed internally if they
|
182
|
-
# are not provided, but allows the reuse of existing derivative information.
|
183
|
-
# On output the new derivatives of the system at time <tt>t+h</tt> will be
|
174
|
+
# This method applies the stepper to the system of equations defined by
|
175
|
+
# <tt>dydt</tt>, using the step size <tt>h</tt> to advance the system from time
|
176
|
+
# <tt>t</tt> and state <tt>y</tt> to time <tt>t+h</tt>. The new state of the system
|
177
|
+
# is stored in <tt>y</tt> on output, with an estimate of the absolute error in
|
178
|
+
# each component stored in <tt>yerr</tt>. If the argument <tt>dydt_in</tt> is not
|
179
|
+
# <tt>nil</tt> it should be a {GSL::Vector}[link:rdoc/vector_rdoc.html] object
|
180
|
+
# containing the derivatives for the system at time <tt>t</tt> on input.
|
181
|
+
# This is optional as the derivatives will be computed internally if they
|
182
|
+
# are not provided, but allows the reuse of existing derivative information.
|
183
|
+
# On output the new derivatives of the system at time <tt>t+h</tt> will be
|
184
184
|
# stored in <tt>dydt_out</tt> if it is not nil.
|
185
185
|
#
|
186
|
-
# ===
|
186
|
+
# === Control
|
187
187
|
# ---
|
188
188
|
# * GSL::Odeiv::Control.standard_new(epsabs, epsrel, a_y, a_dydt)
|
189
189
|
# * GSL::Odeiv::Control.alloc(epsabs, epsrel, a_y, a_dydt)
|
190
190
|
#
|
191
|
-
# The standard control object is a four parameter heuristic based on
|
192
|
-
# absolute and relative errors <tt>epsabs</tt> and <tt>epsrel</tt>, and
|
193
|
-
# scaling factors <tt>a_y</tt> and <tt>a_dydt</tt> for the system state
|
191
|
+
# The standard control object is a four parameter heuristic based on
|
192
|
+
# absolute and relative errors <tt>epsabs</tt> and <tt>epsrel</tt>, and
|
193
|
+
# scaling factors <tt>a_y</tt> and <tt>a_dydt</tt> for the system state
|
194
194
|
# <tt>y(t)</tt> and derivatives <tt>y'(t)</tt> respectively.
|
195
195
|
#
|
196
196
|
# ---
|
197
197
|
# * GSL::Odeiv::Control.y_new(epsabs, epsrel)
|
198
198
|
#
|
199
|
-
# This method creates a new control object which will keep the local error
|
200
|
-
# on each step within an absolute error of <tt>epsabs</tt> and relative error
|
201
|
-
# of <tt>epsrel</tt> with respect to the solution <tt>y_i(t)</tt>.
|
202
|
-
# This is equivalent to the standard control object with <tt>a_y=1</tt>
|
199
|
+
# This method creates a new control object which will keep the local error
|
200
|
+
# on each step within an absolute error of <tt>epsabs</tt> and relative error
|
201
|
+
# of <tt>epsrel</tt> with respect to the solution <tt>y_i(t)</tt>.
|
202
|
+
# This is equivalent to the standard control object with <tt>a_y=1</tt>
|
203
203
|
# and <tt>a_dydt=0</tt>.
|
204
204
|
#
|
205
205
|
# ---
|
206
206
|
# * GSL::Odeiv::Control.yp_new(epsabs, epsrel)
|
207
207
|
#
|
208
|
-
# This method creates a new control object which will keep the local
|
209
|
-
# error on each step within an absolute error of <tt>epsabs</tt> and
|
210
|
-
# relative error of <tt>epsrel</tt> with respect to the derivatives of the
|
211
|
-
# solution <tt>y'_i(t)</tt>.
|
212
|
-
# This is equivalent to the standard control object with <tt>a_y=0</tt>
|
208
|
+
# This method creates a new control object which will keep the local
|
209
|
+
# error on each step within an absolute error of <tt>epsabs</tt> and
|
210
|
+
# relative error of <tt>epsrel</tt> with respect to the derivatives of the
|
211
|
+
# solution <tt>y'_i(t)</tt>.
|
212
|
+
# This is equivalent to the standard control object with <tt>a_y=0</tt>
|
213
213
|
# and <tt>a_dydt=1</tt>.
|
214
214
|
#
|
215
215
|
# ---
|
216
216
|
# * GSL::Odeiv::Control.alloc(epsabs, epsrel, a_y, a_dydt, vscale, dim)
|
217
217
|
#
|
218
|
-
# This creates a new control object which uses the same algorithm as
|
219
|
-
# <tt>GSL::Odeiv::Control.standard_new</tt> but with an absolute error which
|
218
|
+
# This creates a new control object which uses the same algorithm as
|
219
|
+
# <tt>GSL::Odeiv::Control.standard_new</tt> but with an absolute error which
|
220
220
|
# is scaled for each component by the <tt>GSL::Vector</tt> object <tt>vscale</tt>.
|
221
221
|
#
|
222
222
|
# ---
|
223
223
|
# * GSL::Odeiv::Control#init(epsabs, epsrel, a_y, a_dydt)
|
224
224
|
#
|
225
|
-
# This method initializes the controler with the parameters <tt>epsabs</tt>
|
226
|
-
# (absolute error), <tt>epsrel</tt> (relative error), <tt>a_y</tt>
|
225
|
+
# This method initializes the controler with the parameters <tt>epsabs</tt>
|
226
|
+
# (absolute error), <tt>epsrel</tt> (relative error), <tt>a_y</tt>
|
227
227
|
# (scaling factor for y) and <tt>a_dydt</tt> (scaling factor for derivatives).
|
228
228
|
#
|
229
229
|
# ---
|
230
230
|
# * GSL::Odeiv::Control#name
|
231
231
|
# * GSL::Odeiv::Control#hadjust(step, y0, yerr, dydt, h)
|
232
232
|
#
|
233
|
-
# This method adjusts the step-size <tt>h</tt> using the control function
|
234
|
-
# object, and the current values of <tt>y</tt>, <tt>yerr</tt> and <tt>dydt</tt>.
|
235
|
-
# The stepping function <tt>step</tt> is also needed to determine the order
|
233
|
+
# This method adjusts the step-size <tt>h</tt> using the control function
|
234
|
+
# object, and the current values of <tt>y</tt>, <tt>yerr</tt> and <tt>dydt</tt>.
|
235
|
+
# The stepping function <tt>step</tt> is also needed to determine the order
|
236
236
|
# of the method. On output, an array of two elements [<tt>hadj, status</tt>]
|
237
|
-
# is returned: If the error in the y-values <tt>yerr</tt> is found to be
|
238
|
-
# too large then the step-size <tt>h</tt> is reduced and the method returns
|
239
|
-
# [<tt>hadj, status</tt>=<tt>GSL::ODEIV::HADJ_DEC</tt>].
|
240
|
-
# If the error is sufficiently small then
|
241
|
-
# <tt>h</tt> may be increased and [<tt>hadj, status</tt>=<tt>GSL::ODEIV::HADJ_INC</tt>]
|
242
|
-
# is returned.
|
243
|
-
# The method returns [<tt>hadj, status</tt>=<tt>GSL::ODEIV::HADJ_NIL</tt>] if the step-size is
|
244
|
-
# unchanged. The goal of the method is to estimate the largest step-size
|
245
|
-
# which satisfies the user-specified accuracy requirements for the current
|
237
|
+
# is returned: If the error in the y-values <tt>yerr</tt> is found to be
|
238
|
+
# too large then the step-size <tt>h</tt> is reduced and the method returns
|
239
|
+
# [<tt>hadj, status</tt>=<tt>GSL::ODEIV::HADJ_DEC</tt>].
|
240
|
+
# If the error is sufficiently small then
|
241
|
+
# <tt>h</tt> may be increased and [<tt>hadj, status</tt>=<tt>GSL::ODEIV::HADJ_INC</tt>]
|
242
|
+
# is returned.
|
243
|
+
# The method returns [<tt>hadj, status</tt>=<tt>GSL::ODEIV::HADJ_NIL</tt>] if the step-size is
|
244
|
+
# unchanged. The goal of the method is to estimate the largest step-size
|
245
|
+
# which satisfies the user-specified accuracy requirements for the current
|
246
246
|
# point.
|
247
247
|
#
|
248
|
-
# ===
|
249
|
-
# The higher level of the system is the <tt>GSL::Evolve</tt> class which combines the
|
250
|
-
# results of a stepper and controler to reliably advance the solution forward
|
251
|
-
# over an interval <tt>(t_0, t_1)</tt>. If the controler signals that the step-size
|
252
|
-
# should be decreased the <tt>GSL::Evolve</tt> object backs out of the current step and
|
253
|
-
# tries the proposed smaller step-size. This process is continued until an
|
248
|
+
# === Evolve
|
249
|
+
# The higher level of the system is the <tt>GSL::Evolve</tt> class which combines the
|
250
|
+
# results of a stepper and controler to reliably advance the solution forward
|
251
|
+
# over an interval <tt>(t_0, t_1)</tt>. If the controler signals that the step-size
|
252
|
+
# should be decreased the <tt>GSL::Evolve</tt> object backs out of the current step and
|
253
|
+
# tries the proposed smaller step-size. This process is continued until an
|
254
254
|
# acceptable step-size is found.
|
255
255
|
#
|
256
256
|
# ---
|
@@ -261,28 +261,28 @@
|
|
261
261
|
# ---
|
262
262
|
# * GSL::Odeiv::Evolve#reset
|
263
263
|
#
|
264
|
-
# This method resets the GSL::Evolve object. It should be used whenever
|
264
|
+
# This method resets the GSL::Evolve object. It should be used whenever
|
265
265
|
# the next use of e will not be a continuation of a previous step.
|
266
266
|
#
|
267
267
|
# ---
|
268
268
|
# * GSL::Odeiv::Evolve#apply(evolve, control, step, sys, t, t1, h, y)
|
269
269
|
#
|
270
|
-
# This method advances the system <tt>sys</tt> from time <tt>t</tt> and position
|
271
|
-
# <tt>y</tt> using the stepping function <tt>step</tt>. The initial step-size is
|
272
|
-
# taken as <tt>h</tt>. The maximum time <tt>t1</tt> is guaranteed not to be exceeded by
|
270
|
+
# This method advances the system <tt>sys</tt> from time <tt>t</tt> and position
|
271
|
+
# <tt>y</tt> using the stepping function <tt>step</tt>. The initial step-size is
|
272
|
+
# taken as <tt>h</tt>. The maximum time <tt>t1</tt> is guaranteed not to be exceeded by
|
273
273
|
# the time-step. On output, an array of three elements is returned,
|
274
|
-
# [<tt>tnext, hnext, status</tt>], where <tt>tnext</tt> is the time advanced,
|
274
|
+
# [<tt>tnext, hnext, status</tt>], where <tt>tnext</tt> is the time advanced,
|
275
275
|
# <tt>hnext</tt> is the step-size
|
276
276
|
# for the next step, and <tt>status</tt> is an error code retunred by <tt>gsl_odeiv_evolve_apply()</tt> function.
|
277
|
-
# On the final time-step the value of <tt>tnext</tt> will be set to
|
277
|
+
# On the final time-step the value of <tt>tnext</tt> will be set to
|
278
278
|
# <tt>t1</tt> exactly.
|
279
279
|
#
|
280
280
|
# ---
|
281
281
|
# * GSL::Odeiv::Evolve#count
|
282
282
|
#
|
283
283
|
#
|
284
|
-
# ===
|
285
|
-
# This is the highest level interface to solve ODE system,
|
284
|
+
# === Solver
|
285
|
+
# This is the highest level interface to solve ODE system,
|
286
286
|
# which contains System, Step, Control, and Evolve classes.
|
287
287
|
#
|
288
288
|
# ---
|
@@ -329,10 +329,10 @@
|
|
329
329
|
#
|
330
330
|
# This method advances the system from time <tt>t</tt> and position <tt>y</tt> (<tt>GSL::Vector</tt> object) using the stepping function. On output, the new time and position are returned as an array [<tt>tnext, hnext, status</tt>], i.e. <tt>t, y</tt> themselves are not modified by this method. The maximum time <tt>t1</tt> is guaranteed not to be exceeded by the time-step. On the final time-step the value of <tt>tnext</tt> will be set to <tt>t1</tt> exactly.
|
331
331
|
#
|
332
|
-
# ==
|
332
|
+
# == Example
|
333
333
|
#
|
334
334
|
# The following program solves the second-order nonlinear Van der Pol oscillator equation,
|
335
|
-
# as found in the GSL manual, x"(t) + \mu x'(t) (x(t)^2 - 1) + x(t) = 0,
|
335
|
+
# as found in the GSL manual, x"(t) + \mu x'(t) (x(t)^2 - 1) + x(t) = 0,
|
336
336
|
#
|
337
337
|
# This can be converted into a first order system suitable for use with the routines described in this chapter by introducing a separate variable for the velocity, y = x'(t),
|
338
338
|
#
|
@@ -369,10 +369,10 @@
|
|
369
369
|
# end
|
370
370
|
#
|
371
371
|
#
|
372
|
-
# {prev}[link:
|
373
|
-
# {next}[link:
|
372
|
+
# {prev}[link:rdoc/siman_rdoc.html]
|
373
|
+
# {next}[link:rdoc/interp_rdoc.html]
|
374
374
|
#
|
375
|
-
# {Reference index}[link:
|
376
|
-
# {top}[link:
|
375
|
+
# {Reference index}[link:rdoc/ref_rdoc.html]
|
376
|
+
# {top}[link:index.html]
|
377
377
|
#
|
378
378
|
#
|