SymbolMath is a small symbolic math experiment using Ruby 2.0+
expression = SymbolMath::expr { a**2 + b**2 }
expression.fdiff(:a) # => (2 * <Symbol: a>)
expression.evaluate(a: 2, b: 5) # => 29
expression = SymbolMath::expr { sin(x) }
expression.taylor(:x, 5).to_s # => "((x / 1!) + (-(x ** 3) / 3!) + ((x ** 5) / 5!))"
Add this line to your application's Gemfile:
gem 'symbolmath'
And then execute:
$ bundle
Or install it yourself as:
$ gem install symbolmath
- Fork it ( https://github.com/jurriaan/symbolmath/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request