Sha256: 901bf21af3378aa0b68045f8c0ffb264a2a5b880d7cfeb04985353f4a6e8c489

Contents?: true

Size: 714 Bytes

Versions: 22

Compression:

Stored size: 714 Bytes

Contents

#!/usr/bin/env ruby
require("gsl")

# f(x) = 1 + 2x + 3x^3
# Evaluate at x = 2 ---> f(x) = 17
p GSL::Poly.eval([1, 2, 3], 2)
p GSL::Poly.eval([1, 2, 3].to_gv, 2)
p GSL::Poly.eval(NArray[1.0, 2, 3], 2)

# f(1) = 6, f(2) = 17, f(3) = 34
p GSL::Poly.eval([1, 2, 3], [1, 2, 3])
p GSL::Poly.eval([1, 2, 3], [1, 2, 3].to_gv)
p GSL::Poly.eval([1, 2, 3], NArray[1.0, 2, 3])


v = GSL::Vector[1, 2, 3]
p GSL::Poly.eval(v, [1, 2, 3])
p GSL::Poly.eval(v, [1, 2, 3].to_gv)
p GSL::Poly.eval(v, NArray[1.0, 2, 3])

v = NArray[1.0, 2, 3]
p GSL::Poly.eval(v, [1, 2, 3])
p GSL::Poly.eval(v, [1, 2, 3].to_gv)
p GSL::Poly.eval(v, NArray[1.0, 2, 3])

v = GSL::Vector[1, 2, 3]
x = GSL::Matrix.alloc(1...9, 3, 3)
p GSL::Poly.eval(v, x)

Version data entries

22 entries across 22 versions & 4 rubygems

Version Path
gsl-2.1.0.3 examples/poly/eval.rb
gsl-2.1.0.2 examples/poly/eval.rb
gsl-2.1.0.1 examples/poly/eval.rb
gsl-2.1.0 examples/poly/eval.rb
gsl-1.16.0.6 examples/poly/eval.rb
rb-gsl-1.16.0.5 examples/poly/eval.rb
rb-gsl-1.16.0.4 examples/poly/eval.rb
rb-gsl-1.16.0.3 examples/poly/eval.rb
rb-gsl-1.16.0.3.rc1 examples/poly/eval.rb
gsl-nmatrix-1.15.3.2 examples/poly/eval.rb
gsl-nmatrix-1.15.3.1 examples/poly/eval.rb
rb-gsl-1.16.0.2 examples/poly/eval.rb
rb-gsl-1.16.0.1 examples/poly/eval.rb
rb-gsl-1.16.0 examples/poly/eval.rb
rb-gsl-1.15.3.2 examples/poly/eval.rb
rb-gsl-1.15.3.1 examples/poly/eval.rb
blackwinter-gsl-1.15.3.2 examples/poly/eval.rb
gsl-nmatrix-1.15.3.0 examples/poly/eval.rb
gsl-1.15.3 examples/poly/eval.rb
gsl-1.14.7 examples/poly/eval.rb