Steve Litt wrote:
> Hi all,
> 
> Does Ruby have any modules useful in graphing equations like y=x**2+5, 
> y**2+x**2=16, 4y+3x=28, and the like? I suppose the two tasks involved are 
> getting the points, and then graphing them. I'm on kind of a tight schedule 
> so I hoped not to write either of those from scratch.
> 
> Thanks
> 
> SteveT
> 
> Steve Litt
> http://www.troubleshooters.com
> slitt / troubleshooters.com
> 
> 
I might be misuderstanding what you want, but really all you need to do
is to evaluate the expression by supplying sucessive values for x.

for instance to print out the plot points for x**2 which should be a
porabola you could do something like the following

for x in -10..10
	puts "x = #{x}: y = #{x**2}"
end

where you simply adjust the step value and range of the for loop to get
the granularity you want.

Ruby makes it even nicer becuase you could take in user input as a 
string and then use the eval function to evalute it as in

string = gets

for x in -10..10
	puts "x = #{x}: y = #{eval string}"
end

As far as plotting the values in a graphical way, you're going to have 
to use one of the GUI toolkits which are available for ruby.  TK is a 
very fine one which is easy to learn how to use and has the benefit of 
coming with ruby by default.  I blieve you can plot points and draw on a 
TKCanvas widget but you'll have to read the tk docs to figure that out.