rdoc/poly.rdoc in gsl-1.15.3 vs rdoc/poly.rdoc in gsl-1.16.0.6

- old
+ new

@@ -1,28 +1,28 @@ # # = Polynomials # Contents: -# 1. {Polynomial Evaluation}[link:files/rdoc/poly_rdoc.html#1] -# 1. {Solving polynomial equations}[link:files/rdoc/poly_rdoc.html#2] -# 1. {Quadratic Equations}[link:files/rdoc/poly_rdoc.html#2.1] -# 1. {Cubic Equations}[link:files/rdoc/poly_rdoc.html#2.2] -# 1. {General Polynomial Equations}[link:files/rdoc/poly_rdoc.html#2.3] -# 1. {GSL::Poly Class}[link:files/rdoc/poly_rdoc.html#3] -# 1. {Constructors}[link:files/rdoc/poly_rdoc.html#3.1] -# 1. {Methods}[link:files/rdoc/poly_rdoc.html#3.2] -# 1. {Polynomial Fitting}[link:files/rdoc/poly_rdoc.html#4] -# 1. {Divided-difference representations}[link:files/rdoc/poly_rdoc.html#5] -# 1. {Extensions}[link:files/rdoc/poly_rdoc.html#6] -# 1. {Special Polynomials}[link:files/rdoc/poly_rdoc.html#6.1] -# 1. {Polynomial Operations}[link:files/rdoc/poly_rdoc.html#6.2] +# 1. {Polynomial Evaluation}[link:rdoc/poly_rdoc.html#label-Polynomial+Evaluation] +# 1. {Solving polynomial equations}[link:rdoc/poly_rdoc.html#label-Solving+polynomial+equations] +# 1. {Quadratic Equations}[link:rdoc/poly_rdoc.html#label-Quadratic+Equations] +# 1. {Cubic Equations}[link:rdoc/poly_rdoc.html#label-Cubic+Equations] +# 1. {General Polynomial Equations}[link:rdoc/poly_rdoc.html#label-General+Polynomial+Equations] +# 1. {GSL::Poly class}[link:rdoc/poly_rdoc.html#label-Poly+class] +# 1. {Constructors}[link:rdoc/poly_rdoc.html#label-Constructors] +# 1. {Methods}[link:rdoc/poly_rdoc.html#label-Instance+Methods] +# 1. {Polynomial Fitting}[link:rdoc/poly_rdoc.html#label-Polynomial+fitting] +# 1. {Divided-difference representations}[link:rdoc/poly_rdoc.html#label-Divided-difference+representations] +# 1. {Extensions}[link:rdoc/poly_rdoc.html#label-Extensions] +# 1. {Special Polynomials}[link:rdoc/poly_rdoc.html#label-Special+Polynomials] +# 1. {Polynomial Operations}[link:rdoc/poly_rdoc.html#label-Polynomial+Operations] # -# == {}[link:index.html"name="1] Polynomial Evaluation +# == Polynomial Evaluation # --- # * GSL::Poly.eval(c, x) # -# Evaluates the polynomial <tt>c[0] + c[1]x + c[2]x^2 + ...</tt>. -# The polynomial coefficients <tt>c</tt> can be an <tt>Array</tt>, +# Evaluates the polynomial <tt>c[0] + c[1]x + c[2]x^2 + ...</tt>. +# The polynomial coefficients <tt>c</tt> can be an <tt>Array</tt>, # a <tt>GSL::Vector</tt>, or an <tt>NArray</tt>. The evaluation point <tt>x</tt> # is a <tt>Numeric</tt>, <tt>Array</tt>, <tt>GSL::Vector</tt> or <tt>NArray</tt>. # From GSL 1.11, <tt>x</tt> can be a complex number, and <tt>c</tt> can be a complex polynomial given by a <tt>GSL::Vector::Complex</tt> or an <tt>Array</tt>. # # Ex) @@ -52,21 +52,21 @@ # --- # * GSL::Poly#eval_derivs(x) # * GSL::Poly#eval_derivs(x, lenres) # # (GSL-1.13) Evaluate and return a polynomial and its derivatives. The output contains the values of d^k P/d x^k for the specified value of x starting with k = 0. If <tt>lenres</tt> is not given, <tt>lenres = LENGTH(self) + 1</tt> is used, therefore the last element of the output is 0. -# +# # Ex.) # >> ary = [1, 2, 3] # => [1, 2, 3] # >> GSL::Poly.eval_derivs(ary, 1) # => [6.0, 8.0, 6.0, 0.0] # >> na = NArray[1.0, 2, 3] -# => NArray.float(3): +# => NArray.float(3): # [ 1.0, 2.0, 3.0 ] # >> GSL::Poly.eval_derivs(na, 1) -# => NArray.float(4): +# => NArray.float(4): # [ 6.0, 8.0, 6.0, 0.0 ] # >> poly = GSL::Poly[1.0, 2, 3] # => GSL::Poly # [ 1.000e+00 2.000e+00 3.000e+00 ] # >> GSL::Poly.eval_derivs(poly, 1) @@ -77,48 +77,48 @@ # [ 6.000e+00 8.000e+00 6.000e+00 0.000e+00 ] # >> poly.eval_derivs(1, 3) # => GSL::Poly # [ 6.000e+00 8.000e+00 6.000e+00 ] # -# == {}[link:index.html"name="2] Solving polynomial equations -# === {}[link:index.html"name="2.1] Quadratic Equations +# == Solving polynomial equations +# === Quadratic Equations # --- # * GSL::Poly::solve_quadratic(a, b, c) # * GSL::Poly::solve_quadratic([a, b, c]) # # Find the real roots of the quadratic equation, # a x^2 + b x + c = 0 -# The coefficients are given by 3 numbers, or a Ruby array, +# The coefficients are given by 3 numbers, or a Ruby array, # or a <tt>GSL::Vector</tt> object. The roots are returned as a <tt>GSL::Vector</tt>. # # * Ex: z^2 - 3z + 2 = 0 # >> GSL::Poly::solve_quadratic(1, -3, 2) -# => GSL::Vector: +# => GSL::Vector: # [ 1.000e+00 2.000e+00 ] # # # --- # * GSL::Poly::complex_solve_quadratic(a, b, c) # * GSL::Poly::complex_solve_quadratic([a, b, c]) # # Find the complex roots of the quadratic equation, # a z^2 + b z + z = 0 -# The coefficients are given by 3 numbers or a Ruby array, or a +# The coefficients are given by 3 numbers or a Ruby array, or a # <tt>GSL::Vector</tt>. # The roots are returned as a <tt>GSL::Vector::Complex</tt> of two elements. -# +# # * Ex: z^2 - 3z + 2 = 0 # >> require("gsl") # => true # >> GSL::Poly::complex_solve_quadratic(1, -3, 2) -# [ [1.000e+00 0.000e+00] [2.000e+00 0.000e+00] ] +# [ [1.000e+00 0.000e+00] [2.000e+00 0.000e+00] ] # => #<GSL::Vector::Complex:0x764014> # >> GSL::Poly::complex_solve_quadratic(1, -3, 2).real <--- Real part -# => GSL::Vector::View: +# => GSL::Vector::View: # [ 1.000e+00 2.000e+00 ] # -# === {}[link:index.html"name="2.2] Cubic Equations +# === Cubic Equations # --- # * GSL::Poly::solve_cubic(same as solve_quadratic) # # This method finds the real roots of the cubic equation, # x^3 + a x^2 + b x + c = 0 @@ -127,60 +127,60 @@ # * GSL::Poly::complex_solve_cubic(same as solve_cubic) # # This method finds the complex roots of the cubic equation, # z^3 + a z^2 + b z + c = 0 # -# === {}[link:index.html"name="2.3] General Polynomial Equations +# === General Polynomial Equations # --- # * GSL::Poly::complex_solve(c0, c1, c2,,, ) # * GSL::Poly::solve(c0, c1, c2,,, ) # -# Find the complex roots of the polynomial equation. Note that +# Find the complex roots of the polynomial equation. Note that # the coefficients are given by "ascending" order. # -# * Ex: x^2 - 3 x + 2 == 0 +# * Ex: x^2 - 3 x + 2 == 0 # >> GSL::Poly::complex_solve(2, -3, 1) <--- different from Poly::quadratic_solve # [ [1.000e+00 0.000e+00] [2.000e+00 0.000e+00] ] # => #<GSL::Vector::Complex:0x75e614> # -# == {}[link:index.html"name="3] GSL::Poly Class +# == Poly class # This class expresses polynomials of arbitrary orders. # -# === {}[link:index.html"name="3.1] Constructors +# === Constructors # --- # * GSL::Poly.alloc(c0, c1, c2, ....) # * GSL::Poly[c0, c1, c2, ....] # -# This creates an instance of the <tt>GSL::Poly</tt> class, +# This creates an instance of the <tt>GSL::Poly</tt> class, # which represents a polynomial # c0 + c1 x + c2 x^2 + .... # This class is derived from <tt>GSL::Vector</tt>. # # * Ex: x^2 - 3 x + 2 # poly = GSL::Poly.alloc([2, -3, 1]) # -# === {}[link:index.html"name="3.2] Instance Methods +# === Instance Methods # --- # * GSL::Poly#eval(x) # * GSL::Poly#at(x) # -# Evaluates the polynomial -# c[0] + c[1] x + c[2] x^2 + ... + c[len-1] x^{len-1} +# Evaluates the polynomial +# <tt>c[0] + c[1] x + c[2] x^2 + ... + c[len-1] x^{len-1}</tt> # using Horner's method for stability. The argument <tt>x</tt> is a # <tt>Numeric</tt>, <tt>GSL::Vector, Matrix</tt> or an <tt>Array</tt>. # # --- # * GSL::Poly#solve_quadratic # # Solve the quadratic equation. # # * Ex: z^2 - 3 z + 2 = 0: # >> a = GSL::Poly[2, -3, 1] -# => GSL::Poly: +# => GSL::Poly: # [ 2.000e+00 -3.000e+00 1.000e+00 ] # >> a.solve_quadratic -# => GSL::Vector: +# => GSL::Vector: # [ 1.000e+00 2.000e+00 ] # # --- # * GSL::Poly#solve_cubic # @@ -194,76 +194,76 @@ # These methods find the complex roots of the quadratic equation, # c0 + c1 z + c2 z^2 + .... = 0 # # * Ex: z^2 - 3 z + 2 = 0: # >> a = GSL::Poly[2, -3, 1] -# => GSL::Poly: +# => GSL::Poly: # [ 2.000e+00 -3.000e+00 1.000e+00 ] # >> a.solve # [ [1.000e+00 0.000e+00] [2.000e+00 0.000e+00] ] # => #<GSL::Vector::Complex:0x35db28> # -# == {}[link:index.html"name="4] Polynomial fitting +# == Polynomial fitting # --- # * GSL::Poly.fit(x, y, order) # * GSL::Poly.wfit(x, w, y, order) # -# Finds the coefficient of a polynomial of order <tt>order</tt> +# Finds the coefficient of a polynomial of order <tt>order</tt> # that fits the vector data (<tt>x, y</tt>) in a least-square sense. # This provides a higher-level interface to the method -# {GSL::Multifit#linear}[link:files/rdoc/fit_rdoc.html] in a case of polynomial fitting. +# {GSL::Multifit#linear}[link:rdoc/fit_rdoc.html] in a case of polynomial fitting. # # Example: # #!/usr/bin/env ruby # require("gsl") # # x = GSL::Vector[1, 2, 3, 4, 5] # y = GSL::Vector[5.5, 43.1, 128, 290.7, 498.4] # # The results are stored in a polynomial "coef" -# coef, cov, chisq, status = Poly.fit(x, y, 3) +# coef, cov, chisq, status = Poly.fit(x, y, 3) # # x2 = GSL::Vector.linspace(1, 5, 20) # graph([x, y], [x2, coef.eval(x2)], "-C -g 3 -S 4") # -# == {}[link:index.html"name="5] Divided-difference representations +# == Divided-difference representations # # --- # * GSL::Poly::dd_init(xa, ya) # -# This method computes a divided-difference representation of the +# This method computes a divided-difference representation of the # interpolating polynomial for the points <tt>(xa, ya)</tt>. # # --- # * GSL::Poly::DividedDifference#eval(x) # -# This method evaluates the polynomial stored in divided-difference form +# This method evaluates the polynomial stored in divided-difference form # <tt>self</tt> at the point <tt>x</tt>. # # --- # * GSL::Poly::DividedDifference#taylor(xp) # -# This method converts the divided-difference representation of a polynomial -# to a Taylor expansion. On output the Taylor coefficients of the polynomial +# This method converts the divided-difference representation of a polynomial +# to a Taylor expansion. On output the Taylor coefficients of the polynomial # expanded about the point <tt>xp</tt> are returned. # -# == {}[link:index.html"name="6] Extensions -# === {}[link:index.html"name="6.1] Special Polynomials +# == Extensions +# === Special Polynomials # --- # * GSL::Poly.hermite(n) # # This returns coefficients of the <tt>n</tt>-th order Hermite polynomial, <tt>H(x; n)</tt>. # For order of <tt>n</tt> >= 3, this method uses the recurrence relation # H(x; n+1) = 2 x H(x; n) - 2 n H(x; n-1) # * Ex: # >> GSL::Poly.hermite(2) -# => GSL::Poly::Int: +# => GSL::Poly::Int: # [ -2 0 4 ] <----- 4x^2 - 2 # >> GSL::Poly.hermite(5) -# => GSL::Poly::Int: +# => GSL::Poly::Int: # [ 0 120 0 -160 0 32 ] <----- 32x^5 - 160x^3 + 120x # >> GSL::Poly.hermite(7) -# => GSL::Poly::Int: +# => GSL::Poly::Int: # [ 0 -1680 0 3360 0 -1344 0 128 ] # # --- # * GSL::Poly.cheb(n) # * GSL::Poly.chebyshev(n) @@ -298,38 +298,38 @@ # # Ex: # rb(main):001:0> require("gsl") # => true # >> GSL::Poly.laguerre(0) -# => GSL::Poly::Int: +# => GSL::Poly::Int: # [ 1 ] <--- 1 # >> GSL::Poly.laguerre(1) -# => GSL::Poly::Int: +# => GSL::Poly::Int: # [ 1 -1 ] <--- -x + 1 # >> GSL::Poly.laguerre(2) -# => GSL::Poly::Int: +# => GSL::Poly::Int: # [ 2 -4 1 ] <--- (x^2 - 4x + 2)/2! # >> GSL::Poly.laguerre(3) -# => GSL::Poly::Int: +# => GSL::Poly::Int: # [ 6 -18 9 -1 ] <--- (-x^3 + 9x^2 - 18x + 6)/3! # >> GSL::Poly.laguerre(4) -# => GSL::Poly::Int: +# => GSL::Poly::Int: # [ 24 -96 72 -16 1 ] <--- (x^4 - 16x^3 + 72x^2 - 96x + 24)/4! -# -# === {}[link:index.html"name="6.2] Polynomial Operations +# +# === Polynomial Operations # --- # * GSL::Poly#conv # * GSL::Poly#deconv # * GSL::Poly#reduce # * GSL::Poly#deriv # * GSL::Poly#integ # * GSL::Poly#compan # # -# {prev}[link:files/rdoc/complex_rdoc.html] -# {next}[link:files/rdoc/sf_rdoc.html] +# {prev}[link:rdoc/complex_rdoc.html] +# {next}[link:rdoc/sf_rdoc.html] # -# {Reference index}[link:files/rdoc/ref_rdoc.html] -# {top}[link:files/rdoc/index_rdoc.html] +# {Reference index}[link:rdoc/ref_rdoc.html] +# {top}[link:index.html] # # #