On Friday 09 December 2005 01:22 pm, Eric L. wrote:
ruby myprog.rb  gnuplot
If you need to do something more complicated (or if your OS doesn’t
support pipes), creating an object that acts as an output stream to a
gnuplot process would be fairly easy.
Thanks Eric,
I already checked out gnuplot and had some problems:

It doesn’t take y2+x2=16, but instead requires you to solve for y
and
put in (16x**2)**0.5, which gives you only the upper half of the
circle.

I thought, OK, I’ll make all the points in Ruby, and pipe them to
gnuplot.
No joy – gnuplot’s interpolation between points is stupid – all but
bezier
just produce a straight line, and bezier produces cusps where there
aren’t
any. I spoze I could send LOTS of points, and that might work.
Which brings up the next point – algorithm. Remember, I want the full
y2+x2=16, not the right side solved for y.
I’m thinking I start by setting the right side to 0, so it would be
y2+x216=0. That’s OK in this situation. Then I walk up each axis
until I
find a point where the right side shifts from positive to negative or
vice
versa. Interpolate, try again, interpolate again til I have a reasonably
close point. Now go out maybe 0.1 in each direction and find points. Now
calculate slopes, go out some more along that slope and do it again.
Pretty
soon I’ve traced out all relevant points on a continuous curve (this
won’t
work with discontinuous curves).
Now that you see the algorithm I was contemplating, you probably
understand
why I was hoping Ruby had a module that produces points for me
Thanks
SteveT
Steve L.
http://www.troubleshooters.com
removed_email_address@domain.invalid