/usr/share/doc/ruby-gsl/examples/complex/functions.rb is in ruby-gsl 2.1.0.3+dfsg1-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | #!/usr/bin/env ruby
require("gsl")
include Math
# Test GSL::Complex#sqrt
z = GSL::Complex.alloc(1, 2)
sqrtz = z.sqrt
p sqrtz
d = sqrtz*sqrtz
p z == d
sqrtz = GSL::Complex.sqrt(z)
d = sqrtz*sqrtz
p z == d
# Test GSL::Complex::sqrt_real
a = -2.0
c = GSL::Complex.sqrt_real(a)
p GSL::equal?(a, (c*c).re)
# Test GSL::Complex#exp, log
p f = z.exp
p GSL::Complex.exp(z)
p f.log
p f.log == z
p z.pow(f) # [1.931e-02 1.752e-02], verified with Octave result
# The results below are verified with the Octave results
p GSL::Complex.sin(z)
p GSL::Complex.cos(z)
p GSL::Complex.tan(z)
p GSL::Complex.sec(z)
p GSL::Complex.csc(z)
p GSL::Complex.cot(z)
p GSL::Complex.arcsin(z)
p GSL::Complex.arcsin_real(2)
p GSL::Complex.arccos(z)
p GSL::Complex.arccos_real(2)
p GSL::Complex.arctan(z)
p GSL::Complex.arcsec(z)
p GSL::Complex.arcsec_real(2)
p GSL::Complex.arccsc(z)
p GSL::Complex.arccsc_real(2)
p GSL::Complex.arccot(z)
p GSL::Complex.sinh(z)
p GSL::Complex.cosh(z)
p GSL::Complex.tanh(z)
p GSL::Complex.sech(z)
p GSL::Complex.csch(z)
p GSL::Complex.coth(z)
p GSL::Complex.arcsinh(z)
p GSL::Complex.arccosh(z)
p GSL::Complex.arccosh_real(2)
p GSL::Complex.arctanh(z)
p GSL::Complex.arctanh_real(2)
p GSL::Complex.arcsech(z)
p GSL::Complex.arccsch(z)
p GSL::Complex.arccoth(z)
p 1/z
p z.inverse
p z.conjugate
p z.negative
p -z
z2 = GSL::Complex.alloc(2, 3)
p z*z2
p z/z2
p z - z2
p z + z2
p z + 1
p 2 + z
p 2 * z
p 2/z
p z/2
|