tags:

views:

40

answers:

2

HI everyone,

I need to take the derivative of the following function in ruby:

1/(1-exp(-x))

I would like to do this symbolically equivalent to -- Analytically

Is there a ruby command to do this, or gem?

Ted.

A: 

You're pretty much out of luck if you want to do symbolic maths in Ruby. However, the excellent sympy project is a fully featured computer algebra system (that can perform derivatives, among other things) for Python.

Jacob
A: 

Looks like someone started a symbolic math library for Ruby; however, it looks a bit nascent and doesn't yet do derivatives.

My recommendation would be to either use JRuby and therefore access the available Java solutions directly, or wrap external programs, either sympy or the heavy hitters like Maxima or Axiom.

Mark Thomas