On Friday 07 January 2011, David Kuehling wrote:
> >>>>> "Delbert" == Delbert Franz <[email protected]> writes:
> 
> > 2.  Developed an adaptive integration routine in Lua--a language I had
> > not heard of until I got the Nanonote.  Lua is quite fast and small.
> 
> You mean integration, as in math/numerics?  Would you think the plplot
> binding for Lua would be useful for doing math stuff on the NanoNote w/
> lua?
> 
> http://plplot.sourceforge.net/examples.php
> http://plplot.svn.sourceforge.net/viewvc/plplot/tags/v5_9_7/examples/lua/x01.lua?revision=11242&view=markup
> 
> It might not be too difficult to add a lua binding package, however as
> somebody who doesn't use nor know Lua, I won't really able to test that
> stuff.
> 
> David
>

Yes, David, as in math/numerics.  The routine is based on using a 
sequence of increasing order Clenshaw-Curtis rules starting with 3 
points (Simpson's rule) and ending with 1025 points.  I exploit the 
symmetry of the rules to save storage space and also a bit of 
computation.  It does reasonably well when run against some published 
sets of test integrals.  I'm still working on a decision rule between 
subdividing the interval and starting over versus continuing to 
increase the order of the rule to reach the requested tolerance.  Gets 
a bit messy.  Of course, any "real-world" numerical program gets 
messy!  I'm hoping to code the same algorithm in C.  Lua is quite fast 
but I suspect a native compiled C program would be many times faster.  
However, if it doesn't work well, all a faster program does is reach 
the "wrong" answers in less time.  One must always keep that in mind 
when trying to make software faster.  

And yes, a graphical package that would work without using all the 
memory of the Nanonote would be nice for Lua as well as for C and for 
Python.  I have looked at what used to be called "line-printer" plots, 
but they are limited in what they can do and are quite "ugly".  
However, with only 32MB we can't be too "snooty" can we?:-) I have 
some more ideas on how to exploit ncurses using a tiny font to get 
something that would be useful if not beautiful.  I have turned on the 
4x6 font in the kernel for the console.  It is really tiny but I can 
generally read it (after cataract surgery I have quite sharp near 
vision with low-power glasses).  This gives a 40x80 terminal which 
might be OK for plotting.  The ncurses howto already includes an 
example plot routine that could probably be adapted.  

I'm not an expert in Lua.  I have looked at software written by 
experts, and I can hardly follow what is going on.  There are many 
clever ways to use the higher-level constructs in Lua and I have 
barely touched those.  In general my code tends to be somewhat 
"simple-minded " and straightforward.  I have to get it "right" first 
before I get it fast and generally when I get it right, it turns out 
to be fast enough!  

                 Delbert



 




_______________________________________________
Qi Hardware Discussion List
Mail to list (members only): [email protected]
Subscribe or Unsubscribe: 
http://lists.en.qi-hardware.com/mailman/listinfo/discussion

Reply via email to