Symbolic math in pure ruby

GitHub - brainopia/symbolic: Symbolic math for ruby - for people interested in symbolic
math in pure ruby, i would love contribution from community.

That looks really cool, thanks!

I began something like that some time ago.

Remembering I had some awful:
module MathExp
class Function
def self.sq(x = nil) Function.new(:sq, x, ‘2x’, ‘x^3/3’) end

I was using String for functions, as I didn’t know yet the power of
coerce.
But that was quite easy to get derivative and integral.

Great job !

2009/12/16 Ravil B. [email protected]

You should maybe try with -w:

ruby -vw symbolic.rb
ruby 1.9.2dev (2009-12-11 trunk 26067) [x86_64-darwin10.2.0]

/symbolic/summand.rb:73: warning: private attribute?
/symbolic/factor.rb:71: warning: shadowing outer local variable - base
/symbolic/factor.rb:117: warning: private attribute?

The second is easy, but the others reveal strange use of attr_reader.

Why do you use attr_reader in private context? This is only usefull in a
public context I think, as instance variables can be directly accessed
by
@var (even when it is a variable from the superclass)

It correctly pass all the tests, with one warning about drb(circular
require) and these 3. Putting the attr_reader before the “private”
actually
remove the warnings.

2009/12/16 Benoit D. [email protected]

On Wednesday 16 December 2009 01:06:31 pm Ravil B. wrote:

GitHub - brainopia/symbolic: Symbolic math for ruby - for people interested in symbolic
math in pure ruby, i would love contribution from community.

Looks like it would’ve been pretty useful for an idea I had awhile
ago…

I ended up writing my own library. It’s a mess, too, but if you find
anything
useful, go for it:

It’s even got a gemspec all ready to go, though I haven’t published a
gem for
it.

2009/12/16 Ravil B. [email protected]:

GitHub - brainopia/symbolic: Symbolic math for ruby - for people interested in symbolic
math in pure ruby, i would love contribution from community.

Thanks! That looks good.

Kind regards

robert

Wonderful!

On Dec 16, 2:06 pm, Ravil B. [email protected] wrote:

http://github.com/brainopia/symbolic- for people interested in symbolic
math in pure ruby, i would love contribution from community.

Cool beans. Your notation is very intuitive.

I wonder if the same can be done for symbolic logic.