MathSymbols

Support for mathematical syntactic sugars!

Installation

gem install math_symbols

Usage

This is how we should write function that calculates a fourier for a step function without this gem:

def traditional_way(x, n_max = 10)
  (4/Math::PI) * (1..n_max).step(2).inject(0) do |acc, n|
    acc += Math.sin(n*Math::PI*x)/n
  end
end

traditional_way(0.5) # => 1.0630539690963425

This is how we can do with it:

require 'math_symbols'
using MathSymbols

sweet_way = 

or

require 'math_symbols'
using MathSymbols

def sweet_way(x, n_max = 10)
  

Which one is easier to read and therefor maintain?

Usage Without Refinements

If you prefer not to use refinements, just load its core extensions in the same way that you would have done on ActiveSupport.

require 'math_symbols/core_ext'

Development

Run rake to rubocop, RBS and RSpec tests.

Contributing

Bug reports and PRs are welcome on GitHub at https://github.com/dalthon/math_symbols.

License

The gem is available as open source under the terms of the MIT License.