Miscellaneous questions, suggestions

Started by Jeremy Dunn, July 09, 2006, 11:53:06 AM

Previous topic - Next topic

Jeremy Dunn

First a congrats to Lutz for a great new release and for listening so kindly to his audience. I had a few things to say but I didn't feel like creating several topics all at once. So here we go



1. Am I only the only one that feels that the "zero?" function should be balanced out with a "one?" function? I find that I test equality to 1 about as often as I do to 0. It is a small thing perhaps but I find that it balances out the binary nature of the numbers we deal with.



2. Lutz, do you intend to eventually add complex numbers to NewLISP or are you going to shuffle it off for people to write separate math libraries? Probably most of you have no need for them but anyone who does CAD work (as I do) would find them quite handy.



3. As an afterthought to the issue of complex numbers I was thinking about the sgn function. If we think of this function in a geometric rather than a numerical sense it adds some more possibilities to it. In its standard use of returning -1,0 or 1 we can think of this geometrically as testing the position of a point on the X-axis of a cartesian system. -1 means the point is on the negative side of the Y-axis, 0 on the Y-axis and so on. Now we could enlarge the scope of this function by allowing it to take 2D and 3D point lists. In the 2D case we imagine a line bisecting the 2nd and 4th quadrants of the cartesian system. In this case -1 is returned if the 2D point (or complex number) is on the side of the line that the negative quadrant is in, 0 is somewhere on the line and 1 is on the other side. In the 3D case we imagine a plane passing through the origin and passing perpendicular to the positive and negative octants of the 3D space. Again -1, 0 and 1 would tell you which side of the plane you are on. I have already written such an extension in my geometry library and have found it very handy.



4. It has been mentioned by someone else of the desire to start collaborative work on code libraries. Is there any chance of perhaps having a project wiki of some kind that we can post and modify material for all to see so that we don't have to have rings of emailing going on? I would like to work on both a math and geometry library but don't know the best way of doing this. I'm sure others would like to contribute too.

Lutz

#1
about (1) zero? was added to complement nil? and empty?, so we cover: nothing at all, false, empty lists and empty strings and now: 0 and 0.0. I am not sure about one? yet ;). Another suggestion came from one of the Kozoru folks, which is interesting: null? for (or nil? empty? zero?); we may see that before one?, I don't know yet.



about (2) complex numbers would be something for a library, not a module written in newLISP but rather in 'C' for performance reasons. If some body comes up with the 'C' functions, I can help to write the correct headers/returns for it, so it can be imported easily to newLISP. Perhaps a list format for the complex number: (real imaginary) would be the way to go?



Eddier wrote a module for rational numbers using also a list format: http://newlisp.org/syntax.cgi?code/rational.lsp.txt">http://newlisp.org/syntax.cgi?code/rational.lsp.txt. Perhaps it would be worth to rewrite this in 'C'?



about (3) have to think about this.



about (4) yes, we definitely need some sort of wiki-site to collect, discuss, edit, maintain code pieces and modules. Others (Noah) talked about this before. This needs somebody to maintain it and offer the hardware resources (server space).



What is needed most of all for this is commitment putting in the work of maintaining it, doing backups, deleting spam etc., and sticking with it for years/decades to come (somebody like Ryan, who is running this discussion board ;) )



I am very much for it, but don't have the time, additionally to all other newLISP activities. Yes, this is very necessary and would give a big boost to newLISP usability.



Lutz

noah

#2
Hello, Lutz, Jeremy.



I'm hoping that a means is made available for uploading modules, categorizing them, generating their documentation on-line, and making them available for newLISP programmers to search, read, and download. This means would function like http://www.cpan.org">CPAN or http://www.ctan.org">CTAN. It would archive modules on-line.



The wiki concept is important, but that's not what I'm describing. The wiki approach is for collaborating on individual modules; the archive approach is for collecting, managing, and distributing modules on behalf of their developers.



Having a standard documentation format for modules helps make an archive approach practical. Having best practices guidelines for module development and interfaces is further help. Whether individuals collaborate to write their modules, or produce and maintain them on their own, depends on the people involved and the project they pursue. Either way, a CNAN  will help foster use of newLISP.



-Noah

m i c h a e l

#3
Quote from: "Lutz"null? for (or nil? empty? zero?)


What about false? This could be seen as true?'s compliment.



m i c h a e l

noah

#4
Hi, Lutz.



You wrote that you wanted C libraries that support complex numbers.  The documentation for the gnu C library, libc, mentions support for complex number types, arithmetic, and the additional functions conjugation, projections, and decomposition of complex numbers. The math functions like sin, et al, have complex number versions.



It's hard for me to pin down how current the http://www.gnu.org/software/libc/manual/index.html#dir">libc documentation is. I wanted to because this http://www.gnu.org/software/libc/manual/html_node/Trig-Functions.html#Trig-Functions">quote made me worry:


Quote

ISO C99 defines variants of the trig functions which work on complex numbers. The GNU C library provides these functions, but they are only useful if your compiler supports the new complex types defined by the standard. (As of this writing GCC supports complex numbers, but there are bugs in the implementation.)


The date given on the http://www.gnu.org/software/libc/manual/html_node/index.html#Top">HTML main menu shows that the documentation is old.



From my brief examination of the MinGW mailing list, MinGW does not include libc.  MinGW uses Microsoft libraries (you probably know all this) instead, so libc might be of no help for windows compiling, but I thought I'd mention it, particularly since my information resources might be dated. I also read elsewhere that parts of libc might be available to MinGW, not to sure about that one.



The GNU foundation provides a complete scientific library, separate from libc, the http://www.gnu.org/software/gsl/#introduction">GNU Scientific Library. The http://gnuwin32.sourceforge.net">GNU Win32 sourceforge project includes an unofficial port of GSL to windows. The http://gnuwin32.sourceforge.net/packages/gsl.htm">gnuwin32 package page lists MinGW as an environment that can use the GSL win32 port.



Separately, the http://netlib.org/cephes/">Cephes math library is available.  



From the Cephes documentation:


Quote              



CEPHES MATHEMATICAL FUNCTION LIBRARY





     This computer software library is a collection of more than 400 high quality mathematical routines for scientific and engineering applications.   All are written entirely in C language.  Many of the functions are supplied in six different arithmetic precisions: 32 bit single (24-bit significand), 64 bit IEEE double (53-bit), 64 bit DEC (56-bit), 80 or 96 bit IEEE long double (64-bit), and extended precision formats having 144-bit and 336-bit significands.  The extended precision arithmetic is included with the function library.



     The library treats about 180 different mathematical functions.  In addition to the elementary arithmetic and transcendental routines, the library includes a substantial collection of probability integrals, Bessel functions, and higher transcendental functions.



     There are complex variable routines covering complex arithmetic, complex logarithm and exponential, and complex trigonometric functions


The complex function library is available as a separate http://www.netlib.org/c9x-complex.tgz">tarball.



From the tarball readme:
Quote
This is an experimental implementation of complex variables in gcc (the GNU C language compiler) corresponding to the proposed C9X new C language specification.  Look in these net sites for the C standards documents:

  http://anubis.dkuug.dk/JTC1/SC22/WG14/">http://anubis.dkuug.dk/JTC1/SC22/WG14/



You need standard math functions in each precision to use the complexfunctions in that precision.  You can use the libraries from the cephes distribution.


The readme mentions that the library has known problems with 64-bit systems running gcc. Again, I don't know how current this information is, but it came with the library distro I found.



So I hope this helps. My digging might have turned up nothing but weeds, but after googling, I checked  CPAN, and found modules that interface with cephes and GSL, as well as complex number modules written in Perl.



-Noah