Sha256: 562fe2f9df84b9af7e1698a17bd55c78d65348a43e0714c0a065a6b28d6aab6c

Contents?: true

Size: 591 Bytes

Versions: 2

Compression:

Stored size: 591 Bytes

Contents

require 'symath/definition/function'

module SyMath
  class Definition::Arccos < Definition::Function
    def initialize()
      super(:arccos)

      @reductions = {
        -1.to_m         => :pi,
        -fn(:sqrt, 3)/2 => 5*:pi/6,
        -fn(:sqrt, 2)/2 => 3*:pi/4,
        -1.to_m/2       => 2*:pi/3,
        0.to_m          => :pi/2,
        1.to_m/2        => :pi/3,
        fn(:sqrt, 2)/2  => :pi/4,
        fn(:sqrt, 3)/2  => :pi/6,
        1.to_m          => 0.to_m,
      }
    end

    def description()
      return 'arccos(x) - inverse trigonometric cosine'
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
symath-0.1.1 lib/symath/definition/arccos.rb
symath-0.1.0 lib/symath/definition/arccos.rb