[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Integration/Antidifferentiation Program

Richard Schneeman

2/5/2009 6:00:00 PM

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??

http://www.ruby-...topic/...
--
Posted via http://www.ruby-....

6 Answers

M. Edward (Ed) Borasky

2/5/2009 8:06:00 PM

0

Richard Schneeman 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??
>
> http://www.ruby-forum.com/topic/...

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.

Richard Schneeman

2/5/2009 8:50:00 PM

0

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??
--
Posted via http://www.ruby-....

ThoML

2/5/2009 10:00:00 PM

0

> 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.

M. Edward (Ed) Borasky

2/5/2009 10:18:00 PM

0

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 Schneeman
<thedickster@gmail.com> wrote:
> 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??
> --
> Posted via http://www.ruby-....
>
>



--
M. Edward (Ed) Borasky

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

Richard Schneeman

2/6/2009 4:30:00 PM

0

For reinventing the wheel...the best candidate for copying is WMI (uses
maxima) http:/... 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....

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

I also discovered Sage an open source math program written in python
http://www.sag... 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.
--
Posted via http://www.ruby-....

M. Edward (Ed) Borasky

2/6/2009 4:55:00 PM

0

Richard Schneeman wrote:

> I also discovered Sage an open source math program written in python
> http://www.sag... 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. :)
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." :)


--
M. Edward (Ed) Borasky

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