Integration/Antidifferentiation Program

Elliot T. [email protected] writes:

So… I have no idea where to start.

Maybe you should figure out a format for storing polynomials, make a
class to deal with this, and then create some basic functions like
multiply or whatever you think you’ll need. or find a library to do
this.

Richard S. wrote:

Hey, has anyone successfully created a program with Ruby that uses
maxima or any other “reasonably cheap” (or free) math programs?? If so,
can you point me to any resources??

Ruby Vs. PHP pipe terminal access - Rails - Ruby-Forum

I’m not sure what you mean by Ruby “using” maxima. Maxima is a
stand-alone program, and it has a wxWidgets GUI called “wxMaxima” and an
X-Windows GUI called XMaxima. If you just want to access maxima as a
“server” from Ruby, I’m sure there’s a way to start it up using “system”
and pass it input / capture its output via pipes.

What’s the application goal / use case / problem you’re trying to solve?
Are you trying to use symbolic mathematics as part of a Ruby
application?

M. Edward (Ed) Borasky

I’ve never met a happy clam. In fact, most of them were pretty steamed.

By “using” maxima, I mean accessing maxima via a pipe in Ruby. I am
developing a web based mathematical application that can integrate
symbolically among other things. I don’t have to use maxima or even ruby
for that matter but I would like to if possible. I understand the
concept of “system” access but during the execution I’ve hit two snags

First, If i run this code multiple times:

max = IO.popen(“maxima”, “w+”)
max.puts “1+1;”
8.times {max.gets} #needed to rid of unneeded lines
response = max.gets
max.close

I get a new instances (found via ps -A) of “ttys000 0:00.00 (sbcl)”
every time i run the code. And i can’t kill this “sbcl” via “kill pid”.
And after enough runs, I have to restart my computer.

Second, I am unable to just get the last line from maxima without
running “8.times {max.gets}.” If i try to execute “max.gets” after
maxima has reached the last line, I get an error (and no return to
ruby). While i can get around this problem, (via 8.times ) it isn’t
exactly best practices.

So, any suggestions??

Second, I am unable to just get the last line from maxima without
running “8.times {max.gets}.” If i try to execute “max.gets” after
maxima has reached the last line, I get an error (and no return to
ruby). While i can get around this problem, (via 8.times ) it isn’t
exactly best practices.

AFAIK the maxima gui itself passes the code on to an inferior lisp
process that does the actual work. I don’t know how much work that
would be to implement that protocol but maybe looking at the gui’s
source code would help to give you an idea of how to communicate with
maxima reliably.

There are a number of web apps that do this sort of thing – live math
on the web. It sounds to me like you’re re-inventing a wheel here. Of
course, most of said web apps are not in Ruby, because Ruby and Rails
weren’t popular when they were designed.

On Thu, Feb 5, 2009 at 12:49 PM, Richard S.
[email protected] wrote:

8.times {max.gets} #needed to rid of unneeded lines
ruby). While i can get around this problem, (via 8.times ) it isn’t
exactly best practices.

So, any suggestions??

Posted via http://www.ruby-forum.com/.


M. Edward (Ed) Borasky

I’ve never met a happy clam. In fact, most of them were pretty steamed.

Richard S. wrote:

I also discovered Sage an open source math program written in python
http://www.sagemath.org/ I haven’t done anything with python before, but
I have some friends who rave django, so it may just be easier to go that
route. Either way I’ll let everyone know what ended up meeting my needs.

Sage is an outstanding project, even though it is written in Python. :slight_smile:
I’m on their mailing list and I’ve done a fair amount of testing of it.
In terms of tools for day-to-day use by working mathematicians, I don’t
know of anything better in the open source world, and they are closing
in on the expensive proprietary packages like Mathematica and Matlab.

Funny you should mention Sage, since their slogan is, or used to be,
“Building the car, not re-inventing the wheel.” :slight_smile:


M. Edward (Ed) Borasky

I’ve never met a happy clam. In fact, most of them were pretty steamed.

For reinventing the wheel…the best candidate for copying is WMI (uses
maxima) http://matek.hu/ which is kind enough to give its src code away
for free, unfortunately its PHP and I haven’t had anyone who knows
enough about PHP & Ruby to help me figure out what i’m doing wrong:

Here is the PHP: http://pastie.org/380232

Thanks Tom for the Idea, i found an article about converting ruby code
to lisp here: http://onestepback.org/index.cgi/Tech/Ruby/LispInRuby.red
so calling commands naively may be a good work around.

I also discovered Sage an open source math program written in python
http://www.sagemath.org/ I haven’t done anything with python before, but
I have some friends who rave django, so it may just be easier to go that
route. Either way I’ll let everyone know what ended up meeting my needs.

On Fri, Apr 28, 2006 at 1:31 AM, SleepJunkie [email protected]
wrote:

I’d like to write a program to integrate derivatives to save time on
calc homework and get extra credit in the class. I’m not completely sure
where to start.

There’s apparently an algorithm out there that can do symbolic
integration of any elementary function, and returns either its
antiderivative, or that its antiderivative is not expressible in terms
of elementary functions. The only problem that it requires at several
points to determine whether two expressions are equal, and that,
unfortunately, is difficult, and in some cases actually impossible
(undecidable) depending on what functions you allow. See

There’s also a whole theory built up from this called differential
Galois theory, which extends ideas originally developed by Évariste
Galois for the solvability of polynomial equations into solving
differential equations, which is really what antidifferentiation is
all about:

You’re treading in deep water here, brother. Beware.