rdoc/function.rdoc in rb-gsl-1.16.0.2 vs rdoc/function.rdoc in rb-gsl-1.16.0.3.rc1

- old
+ new

@@ -1,41 +1,41 @@ # # = GSL::Function class # -# == {}[link:index.html"name="1] Class Methods +# == Class Methods # # --- # * GSL::Function.alloc # # Constructor. -# +# # * ex: # require("gsl") # f = GSL::Function.alloc { |x| sin(x) } # # The value of the function is calculated by the method <tt>Function#eval</tt>, as # # p f.eval(x) # # The function can have parameters of arbitrary numbers. Here is an # example in case of exponential function <tt>f(x; a, b) = a*exp(-b*x)</tt>. -# +# # f = GSL::Function.alloc { |x, params| # x: a scalar, params: an array # a = params[0]; b = params[1] # a*exp(-b*x) # } -# To evaluate the function <tt>f(x) = 2*exp(-3*x)</tt>, +# To evaluate the function <tt>f(x) = 2*exp(-3*x)</tt>, # f.set_params([2, 3]) # f.eval(x) # -# == {}[link:index.html"name="2] Methods +# == Methods # # --- # * GSL::Function#eval(x) # * GSL::Function#call(x) # * GSL::Function#at(x) -# * GSL::Function#[x] +# * \GSL::Function#[x] # # These methods return a value of the function at <tt>x</tt>. # p f.eval(2.5) # p f.call(2.5) # p f[2.5] @@ -55,11 +55,11 @@ # --- # * GSL::Function#set_params(params) # # This set the constant parameters of the function. # -# == {}[link:index.html"name="3] Graph +# == Graph # --- # * GSL::Function#graph(x[, options]) # # This method uses <tt>GNU graph</tt> to plot the function <tt>self</tt>. # The argument <tt>x</tt> is given by a <tt>GSL::Vector</tt> or an <tt>Array</tt>. @@ -68,26 +68,26 @@ # f = Function.alloc { |x| Math::sin(x) } # x = Vector.linspace(0, 2*M_PI, 50) # f.graph(x, "-T X -g 3 -C -L 'sin(x)'") # # -# == {}[link:index.html"name="4] Example +# == Example # A quadratic function, f(x) = x^2 + 2x + 3. # # >> require("gsl") # => true -# >> f = Function.alloc { |x, param| x*x + param[0]*x + param[1] } +# >> f = Function.alloc { |x, param| x*x + param[0]*x + param[1] } # => #<GSL::Function:0x6e8eb0> # >> f.set_params(2, 3) # => #<GSL::Function:0x6e8eb0> # >> f.eval(2) <--- Scalar # => 11 # >> f.eval(1..4) <--- Range # => [6.0, 11.0, 18.0, 27.0] # >> f.eval([1, 2, 3]) <--- Array # => [6.0, 11.0, 18.0] # >> f.eval(Matrix.alloc([1, 2], [3, 4])) <--- GSL::Matrix -# [ 6.000e+00 1.100e+01 +# [ 6.000e+00 1.100e+01 # 1.800e+01 2.700e+01 ] # => #<GSL::Matrix:0x6dd1b4> # # {back}[link:index.html] #