SymRuby

243 views
Skip to first unread message

Steven Elliott Jr

unread,
Dec 26, 2012, 10:33:25 PM12/26/12
to sciru...@googlegroups.com

Hello All,

I am new to this list but I am a huge Ruby fan and also a student of computer science studying machine learning. I have been using Python as most do and am also into scipy, numpy, etc. I am sick of Python overall but have to use it because that's really all there is. I was excited to find this project but one of my favorite projects is SymPy.

I would like to start development on a Ruby implementation of SymPy. Not really sure where to start yet but I forked the SciRuby repository and will spend the next couple of days reading code and looking around. I'd rather be using Ruby for my code examples in whatever papers I have to write going forward rather than being stuck with Python for everything. This is not a knock against Python, my braing just works better in Ruby.

I'll post updates as I have them.

Thanks! Steven Elliott

Carlos Agarie

unread,
Dec 26, 2012, 10:37:25 PM12/26/12
to sciru...@googlegroups.com
Steven,

Welcome, and I hope you make good use of SciRuby. :)

We're working mostly on NMatrix now, so if you want to help, it's the best place to start. Also, it should be extremely used in your machine learning projects (I know it because I'm writing some ML algorithms with it).

See you,


-----
Carlos Agarie

Control engineering
Polytechnic School, University of São Paulo, Brazil
Computer engineering
Embry-Riddle Aeronautical University, USA


2012/12/26 Steven Elliott Jr <steven.e...@me.com>

Steven Elliott Jr

unread,
Dec 26, 2012, 10:48:33 PM12/26/12
to sciru...@googlegroups.com
I'd be happy to help in any way I can! I'll take a look around NMatrix and spend some time playing with it. I see there are a few bugs and enhancements that are in the Issue tracker. Any recommendations on where to start?

Thanks!

Carlos Agarie

unread,
Dec 26, 2012, 10:51:57 PM12/26/12
to sciru...@googlegroups.com
It might be a bit hard to work on the C/C++ code from the start, but maybe some help with the elementwise operations on list matrices (basically linked lists) would be good.

I think that one of the most important things you could do is to try to use NMatrix (and statsample, minimization and others) in some project and give us feedback about what should be addressed.

Thank you :)

Steven Elliott Jr

unread,
Dec 26, 2012, 11:00:07 PM12/26/12
to sciru...@googlegroups.com
Sounds like a plan! I'll take some time using it and looking through the code.

Eric MacAdie

unread,
Dec 26, 2012, 11:10:39 PM12/26/12
to sciru...@googlegroups.com
Does SymPy require any C or C++ libs? NMatrix works best with ATLAS, and I am slogging through the docs to make installation on Ubuntu easier.

- Eric MacAdie

Steven Elliott Jr

unread,
Dec 26, 2012, 11:19:04 PM12/26/12
to sciru...@googlegroups.com
I don't believe that SymPy requires any C or C++ libraries but it is very easy to interface with C if need be. Check it out:


THe goal of what I am proposing would be to do the same kind of thing only with Ruby. 

John Prince

unread,
Dec 31, 2012, 2:42:02 PM12/31/12
to sciru...@googlegroups.com
I think some kind of clone of sympy functionality would be fantastic.  I think it would be a very welcome contribution.

Steven Elliott Jr

unread,
Dec 31, 2012, 7:49:34 PM12/31/12
to sciru...@googlegroups.com
Thanks. I'm currently working on a few things to get started here. I'm probably gonna start a new project on GitHub on the next week or two with some prelims. I'm just checking out SciRuby now to see what's what.


Sent from my iPhone

Carlos Agarie

unread,
Dec 31, 2012, 8:09:24 PM12/31/12
to sciru...@googlegroups.com
Sure. Show us the repo so we can follow your work and help you whenever possible. :)

And if you need help or want a second opinion on something, please post here.


-----
Carlos Agarie

Control engineering
Polytechnic School, University of São Paulo, Brazil
Computer engineering
Embry-Riddle Aeronautical University, USA


2012/12/31 Steven Elliott Jr <steven.e...@me.com>

Eric MacAdie

unread,
Dec 31, 2012, 8:11:46 PM12/31/12
to sciru...@googlegroups.com
sympy seems to have some linear algebra, which is already in SciRuby. Should there be some overlap? Or would it be good to have a library for LA that does not need ATLAS installed?

- Eric MacAdie

Carlos Agarie

unread,
Dec 31, 2012, 8:20:21 PM12/31/12
to sciru...@googlegroups.com
Well, from what I read, SymPy is focused in symbolic algebra - so there's not really overlap between it and NMatrix, which is a *numerical* linear algebra library.

And it'd be great to have it exclusively in Ruby. I'm not sure, but I don't think there's much need for performance in symbolic calculations.

But first let's see what "symruby" wants to do. One thing at a time.


-----
Carlos Agarie

Control engineering
Polytechnic School, University of São Paulo, Brazil
Computer engineering
Embry-Riddle Aeronautical University, USA


2012/12/31 Eric MacAdie <emac...@gmail.com>

Eric MacAdie

unread,
Dec 31, 2012, 8:31:46 PM12/31/12
to sciru...@googlegroups.com
I thought I read something about LA on the site for sympy. Not a big deal.

- Eric MacAdie

Steven Elliott Jr

unread,
Dec 31, 2012, 9:22:21 PM12/31/12
to sciru...@googlegroups.com
Ya, I think they can live separate happily but I've only just started thinking about this project. Just started writing code a few days ago. Will do an init commit next week sometime of what I have. 

I've also been using NMatrix and am quite impressed with it. I have some questions though that I'm writing down as I use it. In terms of performance I think you're right! I'm sure I could use lots of help once we get rolling. I'll post back when the repo is up. 

Thanks!
Steve

Steven Elliott Jr

unread,
Dec 31, 2012, 9:36:52 PM12/31/12
to sciru...@googlegroups.com

There is a Linear Algebra Module for SymPy that you can check out here: https://github.com/sympy/sympy/wiki/Linear-Algebra-Module but in an of itself SymPy is just a way to do symbolic calculations
with Python. There are things about SymPy that annoy me that I think I can do better with Ruby.

John Woods

unread,
Jan 2, 2013, 3:26:11 PM1/2/13
to sciru...@googlegroups.com
A bit late to the party, but I totally agree. Welcome to the list!

By the way, if anyone wants to contribute to NMatrix but is stuck on some internal C++ thing, please let me know. We have a draft developer's guide which will eventually be made public -- and I'm happy to share it with folks who want to contribute.

John

sam.rawlins

unread,
Jan 2, 2013, 7:41:55 PM1/2/13
to sciru...@googlegroups.com


On Monday, December 31, 2012 7:22:21 PM UTC-7, steven.e...@me.com wrote:
Ya, I think they can live separate happily but I've only just started thinking about this project. Just started writing code a few days ago. Will do an init commit next week sometime of what I have. 

I've also been using NMatrix and am quite impressed with it. I have some questions though that I'm writing down as I use it. In terms of performance I think you're right! I'm sure I could use lots of help once we get rolling. I'll post back when the repo is up.

I've long wanted to create th equivalent of Sage (http://www.sagemath.org/) for Ruby, which is even more ambitious than a Ruby equivalent to SymPy (since SymPy is one of ~100 components of Sage). In any case, Sage uses Maxima (http://maxima.sourceforge.net/) as it's primary symbolic manipulation engine, rather than SymPy (I think... I could be wrong...). Here (http://www.sagemath.org/doc/tutorial/tour_algebra.html) are some examples of Sage's algebra and calculus capabilities. Maxima is written in Lisp and can run on CL, so I don't think Sage has any FFI to Maxima or anything like that; it calls out to it as a different process.

Sage also uses Pynac [http://pynac.org/] for its symbolic manipulation. Pynac is a Python interfact to GiNaC (http://www.ginac.de/) and CLN. Unfortunately, GiNaC's last release was in Nov '11, but maybe it's just a slow-moving project.

So I think the best bang for your buck is going to be using an existing fast, vetted symbolic engine, like GiNaC or Maxima. Not that it'll be a piece of cake, but you will inherit a lot of power and functionality and decades of maturity if you go with one of these, rather than something written from scratch in Ruby.

Other stuff I found googling:
* https://github.com/y-ich/maxima-on-web a Sinatra-built web app for interfacing with Maxima through a browser.
* GlucSym is an unpublished Ruby-to-GiNaC bridge [http://www.mathweb.org/wiki/GlucSym] from 2008. Not holding my breath.

In any case, good luck!

Ravil Bayramgalin

unread,
Jan 11, 2013, 2:08:40 AM1/11/13
to sciru...@googlegroups.com
Steven, you can use https://github.com/brainopia/symbolic as an example.


2013/1/3 sam.rawlins <sam.r...@gmail.com>

Steven Elliott Jr

unread,
Jan 11, 2013, 7:10:44 AM1/11/13
to sciru...@googlegroups.com
Yes thank you. I've been down with the flu for the past week and a half. So much for flu shots, but I haven't even been able to turn my computer on until just last night. Will get working on this stuff ASAP. 

Sent from my iPhone

Rodrigo Botafogo

unread,
Apr 4, 2013, 2:54:32 PM4/4/13
to sciru...@googlegroups.com, steven.e...@me.com
Hello...

I´ve being working for some time on an implementation of a multi dimensional array similar to numpy for JRuby (MDArray).  It uses Java-NetCDF Array as a base array.  I´m now making a gem out of it and it is available on github as MDArray.  I would love for people to take a look and try it out.  No documentation yet, but there are lots of unit tests and with numpy manual one should be good to go. I don´t know if installation will be smooth as I have never worked with github, but I think everything should go fine.  Of course, you need JRuby intalled.

It is nice to find some people trying to do port numpy and other libraries to Ruby.  Hope that this will move forward.

Cheers,


Rodrigo

John Prince

unread,
Apr 4, 2013, 3:58:28 PM4/4/13
to SciRuby ., steven.e...@me.com
Rodrigo -

I scanned through the tests and mdarray looks nice. Great work.

Personally, what I would really love to see is some kind of common
interface between the C/C++ NMatrix and MDArray. I'm not sure about
names and such, but I think it would be awesome to be able to write
multi-dimensional array code in ruby and have it run seamlessly on
jruby and MRI.

I wonder what it would take to make this work...
> --
> You received this message because you are subscribed to the Google Groups
> "SciRuby Development" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sciruby-dev...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Eric MacAdie

unread,
Apr 4, 2013, 10:18:45 PM4/4/13
to sciru...@googlegroups.com
What is the github url?

--

Carlos Agarie

unread,
Apr 5, 2013, 12:47:48 AM4/5/13
to sciru...@googlegroups.com
Rodrigo,

I looked at the tests as well and it seems good. It'd be great to have a unified interface for MRI and JRuby! :)

One of the projects ideas I had for GSoC* is to try to assess how well each of SciRuby's projects works in JRuby. It's a very fast platform (only JIT compiled Lua is faster among dynamic programming languages) and has native threads.


And Eric, there it is: https://github.com/rbotafogo/mdarray

Anyway, thanks for sharing.

(Rodrigo, I'm basing this on your name, but are you brazilian?)


-----
Carlos Agarie
Skype: carlos.agarie

Control engineering
Polytechnic School, University of São Paulo, Brazil
Computer engineering
Embry-Riddle Aeronautical University, USA


2013/4/4 Eric MacAdie <emac...@gmail.com>

Rodrigo Botafogo

unread,
Apr 8, 2013, 9:54:18 AM4/8/13
to sciru...@googlegroups.com
Hi Carlos, Eric and jtprince,

MDArray uses Java-Netcdf (http://www.unidata.ucar.edu/software/netcdf-java/documentation.htm) array.  I don´t know much about NMatrix but I would imagine that making a common interface wouldn´t be too difficult.  What I think might be difficult is to keep this common interface in sync as NMatrix and MDArray evolve.  I started MDArray because narray (Tanaka´s) lacked the ability to slice arrays, a feature that I really needed for my code.  NMatrix seemed still a little far from doing it also.  Then I found NetCDF Java array that had all the features and could easily be integrated into Ruby through JRuby.

At this point MDArray performance is much slower than narray, as all loops are in Ruby.  By sending loops to Java, performance can be greatly improve (version 0.5 I suppose).  Then we can bring in lots of Java libraries without much cost making MDArray a rich environment.  As new libraries are brought in, I don´t know how easy it will be to maintain compatibility with NMatrix.  I´ve looked at Java Common Math from Apache.  If it´s possible to bring in this library to MDArray how fast do you think all those methods can be implemented in NMatrix?

I agree that it would be great to be able to run the same code on MRI and JRuby, but both NMatrix and MDarray are too young and I´m affraid that trying that will only slow the development of both.  Ruby lacks a numpy library and the Ruby community for doing this seems very small to me (you guys, Tanaka and I! Do you know any others?).  For me, the really important thing is how to grow this community and make it flourish so that NMatrix and MDArray can actually be really tested and improved.  I sure would love to hear some ideas.

Carlos, yes, you´ve guessed right, I´m brazilian!


Cheers,


Rodrigo

Rashid Khan

unread,
Nov 26, 2013, 6:31:01 AM11/26/13
to sciru...@googlegroups.com
Replied in-line

Hey John,
 
By the way, if anyone wants to contribute to NMatrix but is stuck on some internal C++ thing, please let me know. We have a draft developer's guide which will eventually be made public -- and I'm happy to share it with folks who want to contribute.

Can I have a look at the document which you have been working on? I'm sure it will help a lot in understanding the C++ internal code. Right now it looks greek to me!

Thanks,

Rashid

John Woods

unread,
Nov 26, 2013, 11:57:31 AM11/26/13
to sciru...@googlegroups.com

Rashid Khan

unread,
Nov 26, 2013, 11:20:21 PM11/26/13
to sciru...@googlegroups.com
Thanks :D
Reply all
Reply to author
Forward
0 new messages