From: Philip Haddad
Subject: Lisp Math Engine
Date: 
Message-ID: <ba57c4f9.0411151758.34bb6fd4@posting.google.com>
Hi all
I am an avid Lisp programmer, as well as being interested in writing
games. The two don't seem to mix well, usually though. I believe this
is unforunate, since Lisp has many concepts that would be very useful
for writing games such as lexical closures and macros.
Doing math fast is not Lisp's forte however. C++ is really good at
math. I want to write a math engine for Lisp, and I was wondering what
may have already been implemented in Lisp (I know the basic trig
functions, etc). I want to add vectors, quaternions, basic calc, polor
co-ordinate systems and the like as well.
Currently, I am reading chapters 4 and 5 of LaMothe's "Tricks of the
Game Porgramming Gurus", and will probably follow his math engine
model. Is there a better one?
What kind of functions would you like to see in a math engine? I could
use some ideas from those people who know anaylitic geometry. If you
have any ideas, please post them here, or email me please.
Hopefully, this math engine will make Lisp better at developing
standerd game constructs such as floating cameras and graphics
rasterization.
Please do not start a programming language flame war here, that's not
what this is meant to be. I have my reasons for liking Lisp, I also
have my reasons for disliking C++, but this thread is not meant to get
into all of that.
Also, if you don't know Lisp, that's ok, please still free to give me
your ideas and suggestions.

Regards
Philip Haddad
·············@gmail.com

From: Neo-LISPer
Subject: Re: Lisp Math Engine
Date: 
Message-ID: <1565109.Ct7tJb829T@yahoo.com>
Philip Haddad wrote:

> Doing math fast is not Lisp's forte however.

Correction. Lisp is the best language for doing math fast.
From: Philip Haddad
Subject: Re: Lisp Math Engine
Date: 
Message-ID: <ba57c4f9.0411160339.1994c44d@posting.google.com>
Neo-LISPer <··········@yahoo.com> wrote in message news:<··················@yahoo.com>...
> Philip Haddad wrote:
> 
> > Doing math fast is not Lisp's forte however.
> 
> Correction. Lisp is the best language for doing math fast.

What makes you say that?

-- 
Certum quod factum.
Philip Haddad
From: Peter Scott
Subject: Re: Lisp Math Engine
Date: 
Message-ID: <7e267a92.0411160959.7fd7b187@posting.google.com>
·············@gmail.com (Philip Haddad) wrote in message news:<····························@posting.google.com>...
> Neo-LISPer <··········@yahoo.com> wrote in message news:<··················@yahoo.com>...
> > Philip Haddad wrote:
> > 
> > > Doing math fast is not Lisp's forte however.
> > 
> > Correction. Lisp is the best language for doing math fast.
> 
> What makes you say that?

I'm not sure I'd go so far as to say that Lisp is the *best* language
for doing math fast, but it does have some great advantages:

* It has lots of good data types like arbitrary-precision numbers,
rationals, and complex numbers---and it uses them by default. If you
write a lisp program to calculate 50!, it will give you
30414093201713378043612608166064768844377641568960512000000000000. If
you ask it to divide 4 by 5, the answer will be 4/5, and the compiler
can do various optimizations to do these calculations quickly.

* It has a good class system that lets you define new things that work
a lot like built-in Lisp types. Want a matrix data type? Fine, write a
matrix class and make a custom printer for it to print matrices in a
pretty format, and define arithmetic operations on it.

* It has macros. These don't apply specifically to math, but they're
just amazing any way you cut it. I wrote a symbolic differentiation
and basic algebraic simplification program that was made much much
more elegant by defining my own control structures with macros.

* Compiler macros. These let you give optimization hints to the
compiler. For example, in a regular expression package, you might
define a compiler macro to transform this:

(match-regexp "c[ad]+r" "caddaadar")

into:

(match-regexp #<COMPILED-REGEXP #x100629C1> "caddaadar")

which compiles the constant regular expression at compile time, not
runtime, giving a speed boost.

* Symbols and easy syntax. It's nice to be able to internally
represent 4*x^2+3 as '(+ (* 4 (^ x 2)) 3) and be able to work with
that data structure easily.

* You can use infix syntax with the infix package. See
<http://www.cliki.net/infix> for more information. Example: #I(4*x^2 +
3).

And if you decide that you want low-level stuff in certain parts of
the code for speed, you can add some compiler declarations.

-Peter
From: GP lisper
Subject: Re: Lisp Math Engine
Date: 
Message-ID: <1100953665.Q8612/M2/y9V5lqzjAkwcA@teranews>
On 16 Nov 2004 09:59:08 -0800, <·········@gmail.com> wrote:
> ·············@gmail.com (Philip Haddad) wrote in message news:<····························@posting.google.com>...
>> Neo-LISPer <··········@yahoo.com> wrote in message news:<··················@yahoo.com>...
>> > Philip Haddad wrote:
>> > 
>> > > Doing math fast is not Lisp's forte however.
>> > 
>> > Correction. Lisp is the best language for doing math fast.
>> 
>> What makes you say that?
>
> I'm not sure I'd go so far as to say that Lisp is the *best* language
> for doing math fast, but it does have some great advantages:
>
> * It has lots of good data types like arbitrary-precision numbers,
> rationals, and complex numbers---and it uses them by default. If you
> write a lisp program to calculate 50!, it will give you
> 30414093201713378043612608166064768844377641568960512000000000000.


Well, 50! was interesting, but what really rocked me was

(/ ( 500! ) ( 499! ))

I'm firmly in the *best* camp now.


-- 
Everyman has three hearts;
one to show the world, one to show friends, and one only he knows.
From: David Steuber
Subject: Re: Lisp Math Engine
Date: 
Message-ID: <87pt28ikww.fsf@david-steuber.com>
GP lisper <········@CloudDancer.com> writes:

> Well, 50! was interesting, but what really rocked me was
> 
> (/ ( 500! ) ( 499! ))
> 
> I'm firmly in the *best* camp now.

What is so exciting about a result of 500?

I was looking at a series that used lots of factorials, so I thought I
would do a momoized version of the factorial function.  It works
pretty well, but it would probably not be a good idea to use it for
really big numbers because of the memory used to remember:

(let ((factorials (make-array 100 :adjustable t :initial-element nil)))
  (defun n! (n)
    "Returns n!.  Memoization via an array for speed is done."
    (when (< (length factorials) n)
      (adjust-array factorials (+ n 100) :initial-element nil))
    (if (< n 1)
        1
        (let ((f (aref factorials (1- n))))
          (if f
              f
              (setf (aref factorials (1- n))
                    (* n (n! (1- n)))))))))

It's a fairly naive implementation, but the second time (n! 2000) is
called is a lot faster than the first time.

-- 
An ideal world is left as an excercise to the reader.
   --- Paul Graham, On Lisp 8.1
From: Duane Rettig
Subject: Re: Lisp Math Engine
Date: 
Message-ID: <4u0rk5ru8.fsf@franz.com>
David Steuber <·····@david-steuber.com> writes:

> GP lisper <········@CloudDancer.com> writes:
> 
> > Well, 50! was interesting, but what really rocked me was
> > 
> > (/ ( 500! ) ( 499! ))
> > 
> > I'm firmly in the *best* camp now.
> 
> What is so exciting about a result of 500?

Nothing.  I think what GP Lisper discovered was the interesting
phenomenon of bignum printing.

If you define a fact function, and do (fact 1000) at the top level,
you'll get a page full of integers, and on a slow machine the delay
might be noticable.  However, if you evaluate
(- (fact 1000) (fact 1000)), you get 0 with no noticable delay.

Why is that?  Because calculating (fact 1000) takes less time than
printing the result.  (fact 1000) consists of a series of bignum
multiplications, and fixnum subtractions.  Printing a bignum requires
a series of divides by the print-base, at least as many as there are
digits to print (these divisions are usually optimized to perform
fewer of them on bignums, by using the largest power of the print-base
that can slice off very small bignums or fixnums which can then be
re-divided by the print-base much more efficiently).  The point is
that printing 8000+ digits takes a lot longer than calculating them,
and _far_ longer than printing a 0.

> I was looking at a series that used lots of factorials, so I thought I
> would do a momoized version of the factorial function.  It works
> pretty well, but it would probably not be a good idea to use it for
> really big numbers because of the memory used to remember:
> 
> (let ((factorials (make-array 100 :adjustable t :initial-element nil)))
>   (defun n! (n)
>     "Returns n!.  Memoization via an array for speed is done."
>     (when (< (length factorials) n)
>       (adjust-array factorials (+ n 100) :initial-element nil))
>     (if (< n 1)
>         1
>         (let ((f (aref factorials (1- n))))
>           (if f
>               f
>               (setf (aref factorials (1- n))
>                     (* n (n! (1- n)))))))))
> 
> It's a fairly naive implementation, but the second time (n! 2000) is
> called is a lot faster than the first time.

Sometimes memoization is worth it, but one must consider and accept
both the time and space cost of doing so - saving close to 2000 bignums
may clog up a generational gc with small nurseries.  When the calculations
are done outright,  the intermediate bignums are ephemeral, or possibly
reused.

-- 
Duane Rettig    ·····@franz.com    Franz Inc.  http://www.franz.com/
555 12th St., Suite 1450               http://www.555citycenter.com/
Oakland, Ca. 94607        Phone: (510) 452-2000; Fax: (510) 452-0182   
From: Bradley J Lucier
Subject: Re: Lisp Math Engine
Date: 
Message-ID: <cno1sp$o03@arthur.cs.purdue.edu>
In article <·············@franz.com>, Duane Rettig  <·····@franz.com> wrote:
>Why is that?  Because calculating (fact 1000) takes less time than
>printing the result.

Only if you use a slow method for bignum printing and a fast method for
factorials.

Here's the results with Gambit-C 4.0 beta11 on a 500MHz PowerBook:

fact.scm:

(declare (standard-bindings)(extended-bindings)(block)(not safe))
(define-macro (FIX . body)
  `(let ()
     (declare (fixnum))
     ,@body))

(define (fact n)
  (if (FIX (< n 2))
      1
      (* n (fact (FIX (- n 1))))))

[zakon2-iro-umontreal-ca:~] bjlucier% gsc
Gambit Version 4.0 beta 11

> (compile-file "fact")
#t
> 
*** EOF again to exit
[zakon2-iro-umontreal-ca:~] bjlucier% gsi -:m10000
Gambit Version 4.0 beta 11

> (load "fact")
"/Users/bjlucier/fact.o1"
> (define a (time (fact 10000)))
(time (fact 10000))
    1571 ms real time
    1400 ms cpu time (1340 user, 60 system)
    6 collections accounting for 36 ms real time (20 user, 0 system)
    71115200 bytes allocated
    no minor faults
    no major faults
> (time (with-output-to-file "crap1" (lambda () (display a))))
(time (with-output-to-file "crap1" (lambda () (display a))))
    537 ms real time
    470 ms cpu time (440 user, 30 system)
    2 collections accounting for 13 ms real time (10 user, 0 system)
    12845060 bytes allocated
    no minor faults
    no major faults
> (define a (time (fact 1000)))     
(time (fact 1000))
    19 ms real time
    20 ms cpu time (10 user, 10 system)
    no collections
    1012616 bytes allocated
    no minor faults
    no major faults
> (time (with-output-to-file "crap2" (lambda () (display a))))
(time (with-output-to-file "crap2" (lambda () (display a))))
    18 ms real time
    10 ms cpu time (10 user, 0 system)
    no collections
    144388 bytes allocated
    no minor faults
    no major faults
> 
*** EOF again to exit
[zakon2-iro-umontreal-ca:~] bjlucier% wc crap[12]
       0       1   35660 crap1
       0       1    2568 crap2
       0       2   38228 total
From: David Steuber
Subject: Re: Lisp Math Engine
Date: 
Message-ID: <876540f28a.fsf@david-steuber.com>
Duane Rettig <·····@franz.com> writes:

> David Steuber <·····@david-steuber.com> writes:
> > 
> > What is so exciting about a result of 500?
> 
> Nothing.  I think what GP Lisper discovered was the interesting
> phenomenon of bignum printing.

In the Joy of Pi thread, I probably have published just about the
slowest possible way to print bignums.  I suppose I could make it
worse with some effort though.

> Sometimes memoization is worth it, but one must consider and accept
> both the time and space cost of doing so - saving close to 2000 bignums
> may clog up a generational gc with small nurseries.  When the calculations
> are done outright,  the intermediate bignums are ephemeral, or possibly
> reused.

In this instance, the idea of multiplying the same numbers over and
over again seemed pretty repugnant.  I don't expect a normal program
would need to memoize the factorial function though.  Perhaps Lisp
allows a programmer to be productive enough to code both ways and
test.

In any event, I've been convinced that Common Lisp is a very good
language for numeric work for some time now.

-- 
An ideal world is left as an excercise to the reader.
   --- Paul Graham, On Lisp 8.1
From: Joe Marshall
Subject: Re: Lisp Math Engine
Date: 
Message-ID: <is7x287i.fsf@ccs.neu.edu>
Duane Rettig <·····@franz.com> writes:

> If you define a fact function, and do (fact 1000) at the top level,
> you'll get a page full of integers, and on a slow machine the delay
> might be noticable.  However, if you evaluate
> (- (fact 1000) (fact 1000)), you get 0 with no noticable delay.
>
> Why is that?  Because calculating (fact 1000) takes less time than
> printing the result.  (fact 1000) consists of a series of bignum
> multiplications, and fixnum subtractions.  Printing a bignum requires
> a series of divides by the print-base, at least as many as there are
> digits to print (these divisions are usually optimized to perform
> fewer of them on bignums, by using the largest power of the print-base
> that can slice off very small bignums or fixnums which can then be
> re-divided by the print-base much more efficiently).  The point is
> that printing 8000+ digits takes a lot longer than calculating them,
> and _far_ longer than printing a 0.

There is a story (I forget who the principal's were) about two
competing Lisp vendors.  One of them got a poor performance review
because (fact 1000) took so long to compute.  They changed their
printer to print bignums by computing the digits in left-to-right
order and suddenly appeared to be much quicker.
From: GP lisper
Subject: Re: Lisp Math Engine
Date: 
Message-ID: <1101647458.dQFTZiN/4dee25uNOLoPhw@teranews>
On 20 Nov 2004 10:45:35 -0500, <·····@david-steuber.com> wrote:
> GP lisper <········@CloudDancer.com> writes:
>
>> Well, 50! was interesting, but what really rocked me was
>> 
>> (/ ( 500! ) ( 499! ))
>> 
>> I'm firmly in the *best* camp now.
>
> What is so exciting about a result of 500?

That it is 500.  Lisp did the long division afterall, or is there some
compiler shortcut that #lisp is unaware of ?

Try it in another language.  All the ones I thought of at the time
will not return 500.  It's the bignum support, invisible to the user.
Fortran (the 'king' of numeric computation) requires special attention
for similar problems, I can remember far too many times needing to fix
some fortran due to a new problem space.  I get the feeling those sort
of fixes are not required in lisp.

Another thing I've noticed as a result of this question is how
effortless it was to write this test in lisp.  Two simple lines, and I
used to think that perl was concise.  Guess how many lines for Fortran?


-- 
Everyman has three hearts;
one to show the world, one to show friends, and one only he knows.
From: George Neuner
Subject: Re: Lisp Math Engine
Date: 
Message-ID: <qsakp01svfsp9fbrns3vu0bvtqd42pna9m@4ax.com>
On 16 Nov 2004 03:39:21 -0800, ·············@gmail.com (Philip Haddad)
wrote:

>Neo-LISPer <··········@yahoo.com> wrote in message news:<··················@yahoo.com>...
>> Philip Haddad wrote:
>> 
>> > Doing math fast is not Lisp's forte however.
>> 
>> Correction. Lisp is the best language for doing math fast.
>
>What makes you say that?

I think Neo is pointing out that "doing math fast" is not the same as
"doing fast math" ... which is what the OP wanted.

Lisp wins at "doing math fast" because you can quickly set up a
problem from scratch and compute an answer in a reasonable time.  The
end to end time is usually less (sometimes far less) than in other
languages.  Lisp also has advantages evaluating complicated algorithms
(which may be slowed by code complexity in other languages) and in
problems involving very large values.

"doing fast math", however, ignores coding time and focuses on the raw
performance of compiled code.  Lisp is generally slower in the
"normal" cases of calculations involving fixnums, floats, reals and
even complex numbers.  It generally takes tweaking to ballpark the
performance of C code for non-trivial problems.  Matching C's
performance in Lisp can require "unnatural" structuring of the problem
and even implementation specific hacks like disabling GC.

George
-- 
for email reply remove "/" from address
From: Neo-LISPer
Subject: Re: Lisp Math Engine
Date: 
Message-ID: <2928302.J0j1v3iKNH@yahoo.com>
George Neuner wrote:

> On 16 Nov 2004 03:39:21 -0800, ·············@gmail.com (Philip Haddad)
> wrote:
> 
>>Neo-LISPer <··········@yahoo.com> wrote in message
>>news:<··················@yahoo.com>...
>>> Philip Haddad wrote:
>>> 
>>> > Doing math fast is not Lisp's forte however.
>>> 
>>> Correction. Lisp is the best language for doing math fast.
>>
>>What makes you say that?
> 
> I think Neo is pointing out that "doing math fast" is not the same as
> "doing fast math" ... which is what the OP wanted.

Actually, no. I noticed the poor wording, but didn't try to intentionally
misunderstand the OP. Before I found Lisp, for doing math, I was always
torn between using C++ or something like Matlab. But because Lisp combines

* the speed of C type of languages,
* interactivity better than in Matlab (very important),
* FFI and Fortran-to-Lisp compilers to take advantage of all the code
already written,
* unparalleled expressiveness, 

one would be a complete fool not to use it for doing [fast] math [fast].
From: Neo-LISPer
Subject: Re: Lisp Math Engine
Date: 
Message-ID: <1767758.rb2A1mg22t@yahoo.com>
Neo-LISPer wrote:

> * the speed of C type of languages,

... BTW, this applies to CMUCL, which is what I'm using. I make no
assertions about other implementations.
From: Camm Maguire
Subject: Re: Lisp Math Engine
Date: 
Message-ID: <543bz8sbmg.fsf@intech19.enhanced.com>
Greetings!  GCL too, in my experience.

Take care,

Neo-LISPer <··········@yahoo.com> writes:

> Neo-LISPer wrote:
> 
> > * the speed of C type of languages,
> 
> ... BTW, this applies to CMUCL, which is what I'm using. I make no
> assertions about other implementations.

-- 
Camm Maguire			     			····@enhanced.com
==========================================================================
"The earth is but one country, and mankind its citizens."  --  Baha'u'llah
From: George Neuner
Subject: Re: Lisp Math Engine
Date: 
Message-ID: <vp7lp0htobk867pdbj04tpi9vtm3c2tk1i@4ax.com>
On Tue, 16 Nov 2004 10:52:41 -0800, Neo-LISPer <··········@yahoo.com>
wrote:

>George Neuner wrote:
>> 
>> I think Neo is pointing out that "doing math fast" is not the same as
>> "doing fast math" ... which is what the OP wanted.
>
>Actually, no. I noticed the poor wording, but didn't try to intentionally
>misunderstand the OP. 

I didn't think you misunderstood, I noticed that you used the same
phrasing as Philip: 

> [Philip] Doing math fast is not Lisp's forte however.
> [Neo]    Correction. Lisp is the best language for doing math fast.

and I inferred a tone of sarcasm because it was a one line post.
Sorry if I misunderstood.

George
-- 
for email reply remove "/" from address
From: Matthias
Subject: Re: Lisp Math Engine
Date: 
Message-ID: <36wzn1hk3ov.fsf@hundertwasser.ti.uni-mannheim.de>
George Neuner <·········@comcast.net> writes:

> On 16 Nov 2004 03:39:21 -0800, ·············@gmail.com (Philip Haddad)
> wrote:
> 
> >Neo-LISPer <··········@yahoo.com> wrote in message news:<··················@yahoo.com>...
> >> Philip Haddad wrote:
> >> 
> >> > Doing math fast is not Lisp's forte however.
> >> 
> >> Correction. Lisp is the best language for doing math fast.
> >
> >What makes you say that?
> 
> I think Neo is pointing out that "doing math fast" is not the same as
> "doing fast math" ... which is what the OP wanted.
> 
> Lisp wins at "doing math fast" because you can quickly set up a
> problem from scratch and compute an answer in a reasonable time.  The
> end to end time is usually less (sometimes far less) than in other
> languages. 

If you have a math problem to solve with the computer, you might want
to consider a special purpose language as Matlab/Octave/Scilab/... for
numerics or Mathematica/Maple/Maxima/...  for symbolical computations.
Often, these will do fast math very fast.
From: Surendra Singhi
Subject: Re: Lisp Math Engine
Date: 
Message-ID: <cnbo0k$a46$1@news.asu.edu>
Philip Haddad wrote:
> Hi all
> I am an avid Lisp programmer, as well as being interested in writing
> games. The two don't seem to mix well, usually though. I believe this
> is unforunate, since Lisp has many concepts that would be very useful
> for writing games such as lexical closures and macros.
> Doing math fast is not Lisp's forte however. C++ is really good at

I feel lisp compilers has lot of potential for generating codes which 
can be very easily parallelized, atleast for small parallel clusters. In 
fact there was some paper on computer architecture in 60's (I forgot the 
author's name and the title of paper), the main point of the paper was 
that von neumann architecture should die and people should embrace 
functional programming architecture because it allows easy parallelization.
There were efforts on the author's idea but it didn't really take off, 
but what I feel is that lisp code because of its side-effect free nature 
is much more amenable to parallelization. And hence lisp code can be 
much faster than the one which is written in much more imperative(or 
sequential) style. But, these are just random thoughts.

> math. I want to write a math engine for Lisp, and I was wondering what
> may have already been implemented in Lisp (I know the basic trig
> functions, etc). I want to add vectors, quaternions, basic calc, polor
> co-ordinate systems and the like as well.
> Currently, I am reading chapters 4 and 5 of LaMothe's "Tricks of the
> Game Porgramming Gurus", and will probably follow his math engine
> model. Is there a better one?
> What kind of functions would you like to see in a math engine? I could
> use some ideas from those people who know anaylitic geometry. If you
> have any ideas, please post them here, or email me please.

I would like to see an open source MATLAB or Mathematica in Lisp. I am 
not sure if they fit into your definition of a math engine or not, but I 
want to see an open source application for math like them. They charge a 
hell lot of money for their tools.

> Hopefully, this math engine will make Lisp better at developing
> standerd game constructs such as floating cameras and graphics
> rasterization.

I feel you can take an initiative in developing a high performance maths 
library or package, with a standard interface, which can be used for 
developing the above applications as well as for games.

> Please do not start a programming language flame war here, that's not
> what this is meant to be. I have my reasons for liking Lisp, I also
> have my reasons for disliking C++, but this thread is not meant to get
> into all of that.
I am already sick of those.

> Regards
> Philip Haddad
> ·············@gmail.com

One last thing, there is an open source software called R (some 
descendant of S) for statistics, I don't know much about it, but the 
language which it uses is very much lisp like. You can look into it.

-- 
Surendra Singhi

www.public.asu.edu/~sksinghi
From: Peter Seibel
Subject: Re: Lisp Math Engine
Date: 
Message-ID: <m3u0rqmsqx.fsf@javamonkey.com>
Surendra Singhi <·········@netscape.net> writes:

> I would like to see an open source MATLAB or Mathematica in Lisp. I
> am not sure if they fit into your definition of a math engine or
> not, but I want to see an open source application for math like
> them. They charge a hell lot of money for their tools.

You mean like:

  <http://maxima.sourceforge.net/>

-Peter

-- 
Peter Seibel                                      ·····@javamonkey.com

         Lisp is the red pill. -- John Fraser, comp.lang.lisp
From: Kenny Tilton
Subject: Re: Lisp Math Engine
Date: 
Message-ID: <JKdmd.14460$ld2.1675464@twister.nyc.rr.com>
Peter Seibel wrote:

> Surendra Singhi <·········@netscape.net> writes:
> 
> 
>>I would like to see an open source MATLAB or Mathematica in Lisp. I
>>am not sure if they fit into your definition of a math engine or
>>not, but I want to see an open source application for math like
>>them. They charge a hell lot of money for their tools.
> 
> 
> You mean like:
> 
>   <http://maxima.sourceforge.net/>

GPL is the poison pill.

kt

-- 
Cells? Cello? Celtik?: http://www.common-lisp.net/project/cells/
Why Lisp? http://alu.cliki.net/RtL%20Highlight%20Film
From: Surendra Singhi
Subject: Re: Lisp Math Engine
Date: 
Message-ID: <cnbs2d$b4m$1@news.asu.edu>
Kenny Tilton wrote:

> 
> 
> Peter Seibel wrote:
> 
>> Surendra Singhi <·········@netscape.net> writes:
>>
>>
>>> I would like to see an open source MATLAB or Mathematica in Lisp. I
>>> am not sure if they fit into your definition of a math engine or
>>> not, but I want to see an open source application for math like
>>> them. They charge a hell lot of money for their tools.
>>
>>
>>
>> You mean like:
>>
>>   <http://maxima.sourceforge.net/>
> 
> 
> GPL is the poison pill.
> 
> kt
> 
Whats wrong with GPL?

-- 
Surendra Singhi

www.public.asu.edu/~sksinghi
From: Kenneth Tilton
Subject: Re: Lisp Math Engine
Date: 
Message-ID: <ktilton-556EC3.01013116112004@nyctyp02-ge0.rdc-nyc.rr.com>
In article <············@news.asu.edu>,
 Surendra Singhi <·········@netscape.net> wrote:

> Kenny Tilton wrote:
> 
> > 
> > 
> > Peter Seibel wrote:
> > 
> >> Surendra Singhi <·········@netscape.net> writes:
> >>
> >>
> >>> I would like to see an open source MATLAB or Mathematica in Lisp. I
> >>> am not sure if they fit into your definition of a math engine or
> >>> not, but I want to see an open source application for math like
> >>> them. They charge a hell lot of money for their tools.
> >>
> >>
> >>
> >> You mean like:
> >>
> >>   <http://maxima.sourceforge.net/>
> > 
> > 
> > GPL is the poison pill.
> > 
> > kt
> > 
> Whats wrong with GPL?

"poison pill" is just an expression from the world of mergers and 
acquisitions, specifically hostile takeovers, specifically fending them 
off by taking on some obligation which any acquirer would then perforce 
undertake, hence making acquisition unattractive.

So the GPL is fine as long the obligations it imposes (you must deliver 
your original source also under GPL any time you distribute a work which 
uses a GPL library) are agreeable. 

Those obligations are not always agreeable to all people, so I was just 
pointing out the restriction.

kenny
From: Friedrich Dominicus
Subject: Re: Lisp Math Engine
Date: 
Message-ID: <87fz3ae10h.fsf@fbigm.here>
Surendra Singhi <·········@netscape.net> writes:

>> kt
>>
> Whats wrong with GPL?
Nothing if you think and feel like RMS otherwise...

Regards
Friedrich

-- 
Please remove just-for-news- to reply via e-mail.
From: K. Ari Krupnikov
Subject: Re: Lisp Math Engine
Date: 
Message-ID: <86sm77g5fm.fsf@deb.lib.aero>
Surendra Singhi <·········@netscape.net> writes:

> Kenny Tilton wrote:
> 
> > GPL is the poison pill.
> > kt
> >
> Whats wrong with GPL?

It destroys value, didn't you guys listen to Ballmer?

Ari.

-- 
Elections only count as free and trials as fair if you can lose money
betting on the outcome.
From: Surendra Singhi
Subject: Re: Lisp Math Engine
Date: 
Message-ID: <cnh8rf$657$1@news.asu.edu>
K. Ari Krupnikov wrote:
> Surendra Singhi <·········@netscape.net> writes:
> 
> 
>>Kenny Tilton wrote:
>>
>>
>>>GPL is the poison pill.
>>>kt
>>>
>>
>>Whats wrong with GPL?
> 
> 
> It destroys value, didn't you guys listen to Ballmer?
> 
> Ari.
> 
Who is Ballmer? I am hearing his name for the first time.

-- 
Surendra Singhi

www.public.asu.edu/~sksinghi
From: Ron Garret
Subject: Re: Lisp Math Engine
Date: 
Message-ID: <rNOSPAMon-92B66A.22202217112004@corp.supernews.com>
In article <············@news.asu.edu>,
 Surendra Singhi <·········@netscape.net> wrote:

> K. Ari Krupnikov wrote:
> > Surendra Singhi <·········@netscape.net> writes:
> > 
> > 
> >>Kenny Tilton wrote:
> >>
> >>
> >>>GPL is the poison pill.
> >>>kt
> >>>
> >>
> >>Whats wrong with GPL?
> > 
> > 
> > It destroys value, didn't you guys listen to Ballmer?
> > 
> > Ari.
> > 
> Who is Ballmer? I am hearing his name for the first time.

http://www.google.com/search?q=ballmer

(What in the world do they teach you at ASU?)

rg
From: David Steuber
Subject: Re: Lisp Math Engine
Date: 
Message-ID: <877jojl1p1.fsf@david-steuber.com>
Ron Garret <·········@flownet.com> writes:

> In article <············@news.asu.edu>,
>  Surendra Singhi <·········@netscape.net> wrote:
> > > 
> > Who is Ballmer? I am hearing his name for the first time.
> 
> http://www.google.com/search?q=ballmer
> 
> (What in the world do they teach you at ASU?)

I think the most succinct answer can be found here:

  http://www.crackaddict.com/~jonas/dancemonkeyboy.mov

-- 
An ideal world is left as an excercise to the reader.
   --- Paul Graham, On Lisp 8.1
From: Kenny Tilton
Subject: Re: Lisp Math Engine
Date: 
Message-ID: <DF1nd.7988$Yh2.2336163@twister.nyc.rr.com>
David Steuber wrote:

> Ron Garret <·········@flownet.com> writes:
> 
> 
>>In article <············@news.asu.edu>,
>> Surendra Singhi <·········@netscape.net> wrote:
>>
>>>Who is Ballmer? I am hearing his name for the first time.
>>
>>http://www.google.com/search?q=ballmer
>>
>>(What in the world do they teach you at ASU?)
> 
> 
> I think the most succinct answer can be found here:
> 
>   http://www.crackaddict.com/~jonas/dancemonkeyboy.mov
> 

Oh. My. God. :)

kt

-- 
Cells? Cello? Celtik?: http://www.common-lisp.net/project/cells/
Why Lisp? http://alu.cliki.net/RtL%20Highlight%20Film
From: Ron Garret
Subject: Re: Lisp Math Engine
Date: 
Message-ID: <rNOSPAMon-74E7C8.18404118112004@corp.supernews.com>
In article <······················@twister.nyc.rr.com>,
 Kenny Tilton <·······@nyc.rr.com> wrote:

> David Steuber wrote:
> 
> > Ron Garret <·········@flownet.com> writes:
> > 
> > 
> >>In article <············@news.asu.edu>,
> >> Surendra Singhi <·········@netscape.net> wrote:
> >>
> >>>Who is Ballmer? I am hearing his name for the first time.
> >>
> >>http://www.google.com/search?q=ballmer
> >>
> >>(What in the world do they teach you at ASU?)
> > 
> > 
> > I think the most succinct answer can be found here:
> > 
> >   http://www.crackaddict.com/~jonas/dancemonkeyboy.mov
> > 
> 
> Oh. My. God. :)

Hey, it worked so well for Howard Dean...

rg
From: David Steuber
Subject: Re: Lisp Math Engine
Date: 
Message-ID: <4ddd570c.0411180929.e842e5a@posting.google.com>
Ron Garret <·········@flownet.com> wrote in message news:<·······························@corp.supernews.com>...
> In article <············@news.asu.edu>,
>  Surendra Singhi <·········@netscape.net> wrote:
> > > 
> > Who is Ballmer? I am hearing his name for the first time.
> 
> http://www.google.com/search?q=ballmer

Another goodie:

  http://www.crackaddict.com/~jonas/balmer.mov
From: Ole ROHNE
Subject: Re: Lisp Math Engine
Date: 
Message-ID: <ebwy8h2rrmc.fsf@trtdaq1.cern.ch>
> > You mean like:
> >   <http://maxima.sourceforge.net/>
> GPL is the poison pill.

In my understanding, if someone were to use Maxima spit out the
formulas for a game style math engine, the resulting product would not
be subject to GPL contamination - as long as it doesn't contain Maxima
source text. So in this case, GPL is not a poison pill.

Ole
From: Christopher C. Stacy
Subject: Re: Lisp Math Engine
Date: 
Message-ID: <usm79h0ip.fsf@news.dtpq.com>
Ole ROHNE <······@trtdaq1.cern.ch> writes:

> > > You mean like:
> > >   <http://maxima.sourceforge.net/>
> > GPL is the poison pill.
> 
> In my understanding, if someone were to use Maxima spit out the
> formulas for a game style math engine, the resulting product would not
> be subject to GPL contamination - as long as it doesn't contain Maxima
> source text. So in this case, GPL is not a poison pill.

Of course not.  I am typing this message in Emacs, 
and my message isn't GPL'd, either!
From: Surendra Singhi
Subject: Re: Lisp Math Engine
Date: 
Message-ID: <cndh4r$j10$3@news.asu.edu>
Peter Seibel wrote:

> Surendra Singhi <·········@netscape.net> writes:
> 
> 
>>I would like to see an open source MATLAB or Mathematica in Lisp. I
>>am not sure if they fit into your definition of a math engine or
>>not, but I want to see an open source application for math like
>>them. They charge a hell lot of money for their tools.
> 
> 
> You mean like:
> 
>   <http://maxima.sourceforge.net/>
> 
> -Peter
> 
Thanks for the link.
Does MATLAB still uses lisp?

-- 
Surendra Singhi

www.public.asu.edu/~sksinghi
From: Raymond Toy
Subject: Re: Lisp Math Engine
Date: 
Message-ID: <sxdlld1a0mh.fsf@rtp.ericsson.se>
>>>>> "Surendra" == Surendra Singhi <·········@netscape.net> writes:

    Surendra> Peter Seibel wrote:

    >> Surendra Singhi <·········@netscape.net> writes:
    >> 
    >>> I would like to see an open source MATLAB or Mathematica in Lisp. I
    >>> am not sure if they fit into your definition of a math engine or
    >>> not, but I want to see an open source application for math like
    >>> them. They charge a hell lot of money for their tools.
    >> You mean like:
    >> <http://maxima.sourceforge.net/>
    >> -Peter
    >> 
    Surendra> Thanks for the link.
    Surendra> Does MATLAB still uses lisp?

I don't think MATLAB ever used lisp.  But maxima still uses Lisp.

Ray
From: Surendra Singhi
Subject: Re: Lisp Math Engine
Date: 
Message-ID: <cne4ok$m8a$1@news.asu.edu>
Raymond Toy wrote:
>>>>>>"Surendra" == Surendra Singhi <·········@netscape.net> writes:
> 
> 
>     Surendra> Peter Seibel wrote:
> 
>     >> Surendra Singhi <·········@netscape.net> writes:
>     >> 
>     >>> I would like to see an open source MATLAB or Mathematica in Lisp. I
>     >>> am not sure if they fit into your definition of a math engine or
>     >>> not, but I want to see an open source application for math like
>     >>> them. They charge a hell lot of money for their tools.
>     >> You mean like:
>     >> <http://maxima.sourceforge.net/>
>     >> -Peter
>     >> 
>     Surendra> Thanks for the link.
>     Surendra> Does MATLAB still uses lisp?
> 
> I don't think MATLAB ever used lisp.  But maxima still uses Lisp.
> 

In the maxima home page, it says that Maxima was precursor to Matlab and 
Mathematica, so I thought that maybe earlier versions of MATLAB were 
also written using lisp. Anyway, thanks for correcting me.

-- 
Surendra Singhi

www.public.asu.edu/~sksinghi
From: Christopher C. Stacy
Subject: Re: Lisp Math Engine
Date: 
Message-ID: <u3bz9gv1u.fsf@news.dtpq.com>
Surendra Singhi <·········@netscape.net> writes:

> Raymond Toy wrote:
> >>>>>>"Surendra" == Surendra Singhi <·········@netscape.net> writes:
> >     Surendra> Peter Seibel wrote:
> >     >> Surendra Singhi <·········@netscape.net> writes:
> >     >>     >>> I would like to see an open source MATLAB or
> > Mathematica in Lisp. I
> >     >>> am not sure if they fit into your definition of a math engine or
> >     >>> not, but I want to see an open source application for math like
> >     >>> them. They charge a hell lot of money for their tools.
> >     >> You mean like:
> >     >> <http://maxima.sourceforge.net/>
> >     >> -Peter
> >     >>     Surendra> Thanks for the link.
> >     Surendra> Does MATLAB still uses lisp?
> > I don't think MATLAB ever used lisp.  But maxima still uses Lisp.
> >
> 
> In the maxima home page, it says that Maxima was precursor to Matlab
> and Mathematica, so I thought that maybe earlier versions of MATLAB
> were also written using lisp. Anyway, thanks for correcting me.

It's a pretty misleading statement.
From: Christopher C. Stacy
Subject: Re: Lisp Math Engine
Date: 
Message-ID: <uwtwlh0l5.fsf@news.dtpq.com>
Surendra Singhi <·········@netscape.net> writes:

> Peter Seibel wrote:
> 
> > Surendra Singhi <·········@netscape.net> writes:
> >
> >>I would like to see an open source MATLAB or Mathematica in Lisp. I
> >>am not sure if they fit into your definition of a math engine or
> >>not, but I want to see an open source application for math like
> >>them. They charge a hell lot of money for their tools.
> > You mean like:
> >   <http://maxima.sourceforge.net/>
> > -Peter
> >
> Thanks for the link.
> Does MATLAB still uses lisp?

I was unaware that MATLAB ever had anything to do with Lisp.
However, the commercial version of Macsyma[1] includes the
capabilities of MATLAB.  (It includes a MATLAB->Macsyma compiler,
will load MATLAB program source files, as well as allowing you
to mix MATLAB with Macsyma in the interactive workbook; it has
the necesssart various array features and main library.)

Macsyma was originally developed in the 1970s at MIT.
Many people still consider it to be superior to the more
recently written programs such as Mathematica.

[1]There is an open-source version of Macsyma called "Maxima".
It's based on a version of the program from 25 years ago, and I
think it's about a decade behind the commercial version in terms
of major features and bug fixes.  Maxima is very useful, though.
The commercial version also has a fancy visualization system,
and LAPACK,  and many other goodies.

The commercial version of Macsyma is available from Symbolics,
which you can reach at 703-455-0430.  I don't think the product
is being actively developed or supported.  It has full documentation.
Runs on Windows and maybe on Linux.  I worked on the program back 
in 1994.  but don't have any current relationship with the company.
From: Camm Maguire
Subject: Re: Lisp Math Engine
Date: 
Message-ID: <54y8h0qwzm.fsf@intech19.enhanced.com>
Greetings!

Please don't forget

http://axiom.axiom-developer.org/

Take care,

Surendra Singhi <·········@netscape.net> writes:

> Peter Seibel wrote:
> 
> > Surendra Singhi <·········@netscape.net> writes:
> >
> >>I would like to see an open source MATLAB or Mathematica in Lisp. I
> >>am not sure if they fit into your definition of a math engine or
> >>not, but I want to see an open source application for math like
> >>them. They charge a hell lot of money for their tools.
> > You mean like:
> >   <http://maxima.sourceforge.net/>
> > -Peter
> >
> Thanks for the link.
> Does MATLAB still uses lisp?
> 
> -- 
> Surendra Singhi
> 
> www.public.asu.edu/~sksinghi

-- 
Camm Maguire			     			····@enhanced.com
==========================================================================
"The earth is but one country, and mankind its citizens."  --  Baha'u'llah
From: Sashank Varma
Subject: Re: Lisp Math Engine
Date: 
Message-ID: <none-A667D8.08205816112004@news.vanderbilt.edu>
In article <············@news.asu.edu>,
 Surendra Singhi <·········@netscape.net> wrote:

> One last thing, there is an open source software called R (some 
> descendant of S) for statistics, I don't know much about it, but the 
> language which it uses is very much lisp like. You can look into it.

R is good for statistics and supports the associated mathematics
(e.g., linear algebra, probability) but lacks the broad coverage of
systems like Macsyma, Maple, and Mathematica.

As far as the Lispiness of the language, R mixes the Algol-like
syntax of S with the semantics of Scheme/Lisp.   As a result, I had
very little difficulty learning R and, whenever I vennture off the
beaten path, I find it quite easy to guess what R will do based on
the Lisp analogy.
From: Surendra Singhi
Subject: Re: Lisp Math Engine
Date: 
Message-ID: <cndh3d$j10$2@news.asu.edu>
Sashank Varma wrote:

> In article <············@news.asu.edu>,
>  Surendra Singhi <·········@netscape.net> wrote:
> 
> 
>>One last thing, there is an open source software called R (some 
>>descendant of S) for statistics, I don't know much about it, but the 
>>language which it uses is very much lisp like. You can look into it.
> 
> 
> R is good for statistics and supports the associated mathematics
> (e.g., linear algebra, probability) but lacks the broad coverage of
> systems like Macsyma, Maple, and Mathematica.
> 
> As far as the Lispiness of the language, R mixes the Algol-like
> syntax of S with the semantics of Scheme/Lisp.   As a result, I had
> very little difficulty learning R and, whenever I vennture off the
> beaten path, I find it quite easy to guess what R will do based on
> the Lisp analogy.
Any idea what is the base language which was used to develop R 
compiler/system/package?


-- 
Surendra Singhi

www.public.asu.edu/~sksinghi
From: rif
Subject: Re: Lisp Math Engine
Date: 
Message-ID: <wj0sm79a7y6.fsf@five-percent-nation.mit.edu>
Surendra Singhi <·········@netscape.net> writes:

> Sashank Varma wrote:
> 
> > In article <············@news.asu.edu>,
> >  Surendra Singhi <·········@netscape.net> wrote:
> >
> >> One last thing, there is an open source software called R (some
> >> descendant of S) for statistics, I don't know much about it, but
> >> the language which it uses is very much lisp like. You can look
> >> into it.
> > R is good for statistics and supports the associated mathematics
> > (e.g., linear algebra, probability) but lacks the broad coverage of
> > systems like Macsyma, Maple, and Mathematica.
> > As far as the Lispiness of the language, R mixes the Algol-like
> > syntax of S with the semantics of Scheme/Lisp.   As a result, I had
> > very little difficulty learning R and, whenever I vennture off the
> > beaten path, I find it quite easy to guess what R will do based on
> > the Lisp analogy.
> Any idea what is the base language which was used to develop R
> compiler/system/package?
> 
> 
> -- 
> Surendra Singhi
> 
> www.public.asu.edu/~sksinghi

R is written in C.

I have written a Common Lisp to R gateway which allows me to call R
functions from CL and get the results back.  I use it mainly to take
advantage of R's extremely good plotting functionality, and to
generate random numbers easily from various distributions.

rif
From: Debian User
Subject: Re: Lisp Math Engine
Date: 
Message-ID: <419A5CA7.3040702@dds.nl>
rif wrote:

> 
> 
> R is written in C.
> 
> I have written a Common Lisp to R gateway which allows me to call R
> functions from CL and get the results back.  I use it mainly to take
> advantage of R's extremely good plotting functionality, and to
> generate random numbers easily from various distributions.
> 
> rif
> 

Have a look at xlispstat.  It is a statistics system written in lisp and 
allows dynamic graphics and has all the usual distributions.
From: Marco Antoniotti
Subject: Re: Lisp Math Engine
Date: 
Message-ID: <drtmd.16$E26.25924@typhoon.nyu.edu>
Debian User wrote:
> 
> 
> rif wrote:
> 
>>
>>
>> R is written in C.
>>
>> I have written a Common Lisp to R gateway which allows me to call R
>> functions from CL and get the results back.  I use it mainly to take
>> advantage of R's extremely good plotting functionality, and to
>> generate random numbers easily from various distributions.
>>
>> rif
>>
> 
> Have a look at xlispstat.  It is a statistics system written in lisp and 
> allows dynamic graphics and has all the usual distributions.
> 

xlispstat is not Common Lisp.

Cheers
--
Marco
From: Ivan Boldyrev
Subject: Re: Lisp Math Engine
Date: 
Message-ID: <bc8472xt29.ln2@ibhome.cgitftp.uiggm.nsc.ru>
On 8931 day of my life ···@mit.edu wrote:
> I have written a Common Lisp to R gateway which allows me to call R
> functions from CL and get the results back.  I use it mainly to take
> advantage of R's extremely good plotting functionality, and to
> generate random numbers easily from various distributions.

Is it a public project?  Can I download your code?

-- 
Ivan Boldyrev

                        Today is the first day of the rest of your life.
From: Jan Rychter
Subject: Re: Lisp Math Engine
Date: 
Message-ID: <m27jogw2c9.fsf@tnuctip.rychter.com>
>>>>> "Ivan" == Ivan Boldyrev <···············@cgitftp.uiggm.nsc.ru> writes:
 Ivan> On 8931 day of my life ···@mit.edu wrote:
 >> I have written a Common Lisp to R gateway which allows me to call R
 >> functions from CL and get the results back.  I use it mainly to take
 >> advantage of R's extremely good plotting functionality, and to
 >> generate random numbers easily from various distributions.

 Ivan> Is it a public project?  Can I download your code?

At the risk of getting flamed, here's a "me too". This kind of code
would be quite useful. I had been looking for it a while ago and I've
been hoping someone would do this as part of the omega project.

--J.
From: Peter Seibel
Subject: Re: Lisp Math Engine
Date: 
Message-ID: <m3y8h2msuq.fsf@javamonkey.com>
·············@gmail.com (Philip Haddad) writes:

> Hi all

> I am an avid Lisp programmer, as well as being interested in writing
> games. The two don't seem to mix well, usually though. I believe
> this is unforunate, since Lisp has many concepts that would be very
> useful for writing games such as lexical closures and macros. Doing
> math fast is not Lisp's forte however. C++ is really good at math.

Hmmm. At various times Lisp has been required to complete with FORTRAN
for numeric processing. And *FORTRAN* is really good at math. Which is
not to say that it always won. But it was in the game. Have you read
the paper "Fast Floating-Point Computation in Common Lisp"? It, along
with some other papers that might be of interest, are linked from:

  <http://openmap.bbn.com/~kanderso/performance/>

-Peter

-- 
Peter Seibel                                      ·····@javamonkey.com

         Lisp is the red pill. -- John Fraser, comp.lang.lisp
From: Geoffrey Summerhayes
Subject: Re: Lisp Math Engine
Date: 
Message-ID: <_ljmd.8991$rc.713039@news20.bellglobal.com>
"Philip Haddad" <·············@gmail.com> wrote in message ·································@posting.google.com...
> Hi all
> I am an avid Lisp programmer, as well as being interested in writing
> games. The two don't seem to mix well, usually though. I believe this
> is unforunate, since Lisp has many concepts that would be very useful
> for writing games such as lexical closures and macros.
> Doing math fast is not Lisp's forte however. C++ is really good at
> math. I want to write a math engine for Lisp, and I was wondering what
> may have already been implemented in Lisp (I know the basic trig
> functions, etc). I want to add vectors, quaternions, basic calc, polor
> co-ordinate systems and the like as well.
> Currently, I am reading chapters 4 and 5 of LaMothe's "Tricks of the
> Game Porgramming Gurus", and will probably follow his math engine
> model. Is there a better one?

Last time I looked at a book by LaMothe it was out of date,
had mistakes, a less than admirable programming style, plus
some of the worst jokes I've seen in a text. IIRC, he also
targeted DirectX for doing graphics.

The DX9 SDK appears targeted for C++,'managed' C++, VB, and C#.
I suspect the easiest way to do a DX-Lisp game would be to implement
the graphics and physics engine, bones, skinning, collision, etc.
in C++ and handle the game logic in Lisp. The task of setting up
FLI for DX gives me the willies.

--
Geoff 
From: Philip Haddad
Subject: Re: Lisp Math Engine
Date: 
Message-ID: <ba57c4f9.0411161259.d6a829d@posting.google.com>
"Geoffrey Summerhayes" <·······@NhOoStPmAaMil.com> wrote in message news:<····················@news20.bellglobal.com>...
> "Philip Haddad" <·············@gmail.com> wrote in message ·································@posting.google.com...
> > Hi all
> > I am an avid Lisp programmer, as well as being interested in writing
> > games. The two don't seem to mix well, usually though. I believe this
> > is unforunate, since Lisp has many concepts that would be very useful
> > for writing games such as lexical closures and macros.
> > Doing math fast is not Lisp's forte however. C++ is really good at
> > math. I want to write a math engine for Lisp, and I was wondering what
> > may have already been implemented in Lisp (I know the basic trig
> > functions, etc). I want to add vectors, quaternions, basic calc, polor
> > co-ordinate systems and the like as well.
> > Currently, I am reading chapters 4 and 5 of LaMothe's "Tricks of the
> > Game Porgramming Gurus", and will probably follow his math engine
> > model. Is there a better one?
> 
> Last time I looked at a book by LaMothe it was out of date,
> had mistakes, a less than admirable programming style, plus
> some of the worst jokes I've seen in a text. IIRC, he also
> targeted DirectX for doing graphics.
> 
> The DX9 SDK appears targeted for C++,'managed' C++, VB, and C#.
> I suspect the easiest way to do a DX-Lisp game would be to implement
> the graphics and physics engine, bones, skinning, collision, etc.
> in C++ and handle the game logic in Lisp. The task of setting up
> FLI for DX gives me the willies.

I meant "Tricks of the 3d game programming gurus" It's only about a
year old. DirectX is awful software, but that's beside the point.

-- 
Certum quod factum.
Philip Haddad
From: Mark McConnell
Subject: Re: Lisp Math Engine
Date: 
Message-ID: <d3aed052.0411160737.7e735689@posting.google.com>
·············@gmail.com (Philip Haddad) wrote in message news:<····························@posting.google.com>...
> Doing math fast is not Lisp's forte however.

A common misconception.

http://www.cons.org/cracauer/lisp.html

http://openmap.bbn.com/~kanderso/performance/

http://www-2.cs.cmu.edu/Groups/AI/html/hyperspec/HyperSpec/Body/sym_declare.html#declare

> I want to write a math engine for Lisp, and I was wondering what
> may have already been implemented in Lisp

I share your enthusiasm for this!

> (I know the basic trig functions, etc).

Not to mention arc hyperbolic sine in the complex plane :-)

http://www-2.cs.cmu.edu/Groups/AI/html/cltl/clm/node128.html
http://www-2.cs.cmu.edu/Groups/AI/html/cltl/clm/_24769_figure12731.gif

> I want to add vectors, quaternions, basic calc, polor
> co-ordinate systems and the like as well.

As other posters have pointed out, Maxima is a leading system with all
these features and far more.  Reduce is another Lisp-based computer
algebra system with more of a flavor of abstract algebra.  You'd also
have fun writing your own.
From: Philip Haddad
Subject: Re: Lisp Math Engine
Date: 
Message-ID: <ba57c4f9.0411161301.45d4f434@posting.google.com>
> As other posters have pointed out, Maxima is a leading system with all
> these features and far more.  Reduce is another Lisp-based computer
> algebra system with more of a flavor of abstract algebra.  You'd also
> have fun writing your own.

That's the point. I'm doing this for fun in my spare time. Hopefully,
when fisished it will benefit the Lisp community in some way.

-- 
Certum quod factum.
Philip Haddad
From: Andreas Eder
Subject: Re: Lisp Math Engine
Date: 
Message-ID: <m38y91otyr.fsf@banff.eder.de>
·············@gmail.com (Philip Haddad) writes:

> That's the point. I'm doing this for fun in my spare time. Hopefully,
> when fisished it will benefit the Lisp community in some way.

Instead of witing your own toy system, you could join the maxima
development team. This way the whole community could profit and you
would have your fun too, because improving an already world-calss
system is much more fun.

Andreas
-- 
Wherever I lay my .emacs, there's my $HOME.
From: Philip Haddad
Subject: Re: Lisp Math Engine
Date: 
Message-ID: <ba57c4f9.0411161703.7ad0e02a@posting.google.com>
···············@yahoo.com (Mark McConnell) wrote in message news:<····························@posting.google.com>...
> ·············@gmail.com (Philip Haddad) wrote in message news:<····························@posting.google.com>...
> As other posters have pointed out, Maxima is a leading system with all
> these features and far more.  Reduce is another Lisp-based computer
> algebra system with more of a flavor of abstract algebra.  You'd also
> have fun writing your own.

Also I don't want to use other programs like matlab etc. because I
want these to be in Lisp, and also a PART of Lisp. Ultimate functional
programming here guys!

-- 
Certum quod factum.
Philip Haddad
From: xstream
Subject: Re: Lisp Math Engine
Date: 
Message-ID: <10pl953q88s6me7@corp.supernews.com>
"Philip Haddad" <·············@gmail.com> wrote in message
·································@posting.google.com...
> Hi all
> I am an avid Lisp programmer, as well as being interested in writing
> games. The two don't seem to mix well, usually though. I believe this
> is unforunate, since Lisp has many concepts that would be very useful
> for writing games such as lexical closures and macros.
> Doing math fast is not Lisp's forte however. C++ is really good at
> math. I want to write a math engine for Lisp, and I was wondering what
> may have already been implemented in Lisp (I know the basic trig
> functions, etc). I want to add vectors, quaternions, basic calc, polor
> co-ordinate systems and the like as well.
> What kind of functions would you like to see in a math engine? I could
> use some ideas from those people who know anaylitic geometry. If you
> have any ideas, please post them here, or email me please.

Several good ideas have been already been proposed by previous responders.
As someone who loves using Lisp as an engineering tool I think you probably
want to look into

(a) some good linear algebra basics that allow the user to engage into some
intuitive and efficient matrix calculations (ala Matlab, I would say),

(b) maybe some finite elements for approximation work (useful in surface and
curves calculations from graphics to solid modeling in CAD/CAM with numerous
applications in electrical engineering, naval engineering, aeronautics, even
chemical engineering in reactor kinetics simulations etc.

(b) maybe attempt some bit-true representations of arithmetic on the
underlying implementations so someone can implement DSP routines of any
(within reason) desirable precision and accuracy efficiently. How can one
write e.g. cepstral (this is not "spectral") analysis if one must "spit
blood" to implement a DFT which is already alien to theoreticians who only
know classical Fourier integrals. The number of users for DSP libraries
would be gigantic as the applications are truly numerous. I have done some
of these for companies I have been involved with mainly because I wanted to
use Common Lisp as the simulation tool platform to verify underlying VLSI
hardware block functionality. For instance in time-based assertion
simulation of real-life analog events ALL current digital simulators throw
up their hands because they do not provide the time granularity real life
offers in subpicosecond scale (something that in deep submicron
semiconductors starts to surface and bother designers). Lisp allows you to
customize concurrency, deadlock, synchronization or lack thereof  in
intuitive ways. It also allows you to memoize functions that enable
efficient emulation of actual hardware designs (nobody will design a 32x32
but mutliplier implementing say a Wallace tree) when a lookup table with
precalculated results will do the job in aceptable time and silicon space.

I think your effort is noble and commendable. Your idea must be applauded
and encouraged in any way possible. My hat off to you!

Panos C. Lekkas
From: Marco Antoniotti
Subject: Re: Lisp Math Engine
Date: 
Message-ID: <IGxmd.17$E26.27542@typhoon.nyu.edu>
xstream wrote:
> "Philip Haddad" <·············@gmail.com> wrote in message
> ·································@posting.google.com...
> 
>>Hi all
>>I am an avid Lisp programmer, as well as being interested in writing
>>games. The two don't seem to mix well, usually though. I believe this
>>is unforunate, since Lisp has many concepts that would be very useful
>>for writing games such as lexical closures and macros.
>>Doing math fast is not Lisp's forte however. C++ is really good at
>>math. I want to write a math engine for Lisp, and I was wondering what
>>may have already been implemented in Lisp (I know the basic trig
>>functions, etc). I want to add vectors, quaternions, basic calc, polor
>>co-ordinate systems and the like as well.
>>What kind of functions would you like to see in a math engine? I could
>>use some ideas from those people who know anaylitic geometry. If you
>>have any ideas, please post them here, or email me please.
> 
> 
> Several good ideas have been already been proposed by previous responders.
> As someone who loves using Lisp as an engineering tool I think you probably
> want to look into
> 
> (a) some good linear algebra basics that allow the user to engage into some
> intuitive and efficient matrix calculations (ala Matlab, I would say),

matlisp.sf.net?




> 
> (b) maybe some finite elements for approximation work (useful in surface and
> curves calculations from graphics to solid modeling in CAD/CAM with numerous
> applications in electrical engineering, naval engineering, aeronautics, even
> chemical engineering in reactor kinetics simulations etc.

www.femlisp.org?

Cheers
--
Marco
From: xstream
Subject: Re: Lisp Math Engine
Date: 
Message-ID: <10pleubf67qs10a@corp.supernews.com>
"Marco Antoniotti" <·······@cs.nyu.edu> wrote in message
·······················@typhoon.nyu.edu...
>
> > (a) some good linear algebra basics that allow the user to engage into
some
> > intuitive and efficient matrix calculations (ala Matlab, I would say),
>
> matlisp.sf.net?
>
>> > (b) maybe some finite elements for approximation work (useful in
surface and
> > curves calculations from graphics to solid modeling in CAD/CAM with
numerous
> > applications in electrical engineering, naval engineering, aeronautics,
even
> > chemical engineering in reactor kinetics simulations etc.
>
> www.femlisp.org?
>

Thank you for pointing out these 2 nice links. I was not aware of them. Neat
starting point!

I can easily see though possible extensions to what they have implemented
respectively . There is a significant difference as to what a software
developer needs to have access to in order to produce a tool or product, as
opposed to a tool user who just needs to be able to customize his/her tool's
capabilities to suit application needs. I am not sure which context Philip
is exactly interested in, to start with. I (conveniently for me) took the
liberty of presuming the latter, but of course I may be wrong.

Thanks again for these links.

Panos C. Lekkas
·······@ieee.org
From: Philip Haddad
Subject: Re: Lisp Math Engine
Date: 
Message-ID: <ba57c4f9.0411170519.659a7c13@posting.google.com>
> (b) maybe attempt some bit-true representations of arithmetic on the
> underlying implementations so someone can implement DSP routines of any
> (within reason) desirable precision and accuracy efficiently. How can one
> write e.g. cepstral (this is not "spectral") analysis if one must "spit
> blood" to implement a DFT which is already alien to theoreticians who only
> know classical Fourier integrals. The number of users for DSP libraries
> would be gigantic as the applications are truly numerous. I have done some
> of these for companies I have been involved with mainly because I wanted to
> use Common Lisp as the simulation tool platform to verify underlying VLSI
> hardware block functionality. For instance in time-based assertion
> simulation of real-life analog events ALL current digital simulators throw
> up their hands because they do not provide the time granularity real life
> offers in subpicosecond scale (something that in deep submicron
> semiconductors starts to surface and bother designers). Lisp allows you to
> customize concurrency, deadlock, synchronization or lack thereof  in
> intuitive ways. It also allows you to memoize functions that enable
> efficient emulation of actual hardware designs (nobody will design a 32x32
> but mutliplier implementing say a Wallace tree) when a lookup table with
> precalculated results will do the job in aceptable time and silicon space.

Well, thanks for the ideas. I think that Fourier (integrals) series is
a good idea, also the beauty of Open Source is that after I've written
the basic engine, you can download it and add stuff to it (like
Wallace trees). I wasn't planning on making this engine directly
applicable to raw video, which it sounded like you were talking about
by "digital simulators". I would also like to implement the Taylor
expansion series as well, even though I don't think it has a direct
application to games.
This is meant to be a programmers library. It's not going to have a
GUI or anything (although it would be pretty easy to hack one on).
When finished, the programmer will just have to put:
(load "math-engine.lisp")
at the top of his file, and have all of my functions locally. He would
probably have to export my symbol packages as well.

> I think your effort is noble and commendable. Your idea must be applauded
> and encouraged in any way possible. My hat off to you!

Thank you very much for that.
 
> Panos C. Lekkas

-- 
Certum quod factum.
Philip Haddad
From: Vladimir Sedach
Subject: Re: Lisp Math Engine
Date: 
Message-ID: <87d5ycqxn3.fsf@shawnews.cg.shawcable.net>
I'm going to go against the bulk of the replies and strongly recommend
that you keep your library as small and fast as possible. There are
dozens of C++ libraries for 3d math, but most of them either have too
many useless features or aren't as fast as they could be. All you
really need for interactive 3d are vectors (single and double float
specialized _only_), matrices (I think restricting them to 4x4
wouldn't be a bad beginning), and some basic algebraic operations on
them (addition, multiplication, eigenvalue, inverse), and quaternions
and associated operations. Don't bother with differential/integral
calculus methods, series, or approximation methods until you need them
(in which case you're going to have a strong motivation for doing them
right - numerical libraries aren't all that fun to work on), or better
yet release the library with a good license and encourage use (I'm
looking forward to it!), and people will give back their contributions
that they found useful. The important thing is to make the code easy
to extend and fast. Most importantly, provide a hook for getting
matrices from/to the various OpenGL bindings in various CL
implementations fast.

Vladimir

PS - what's up with game programmers calling everything an "engine?"
Does the math engine power your math car or something? :)
From: Philip Haddad
Subject: Re: Lisp Math Engine
Date: 
Message-ID: <ba57c4f9.0411181913.343bb691@posting.google.com>
Vladimir Sedach <(string-downcase (concatenate 'string last-name (subseq first-name 0 1)))@cpsc.ucalgary.ca> wrote in message news:<··············@shawnews.cg.shawcable.net>...
> I'm going to go against the bulk of the replies and strongly recommend
> that you keep your library as small and fast as possible. There are
> dozens of C++ libraries for 3d math, but most of them either have too
> many useless features or aren't as fast as they could be. All you
> really need for interactive 3d are vectors (single and double float
> specialized _only_), matrices (I think restricting them to 4x4
> wouldn't be a bad beginning), and some basic algebraic operations on
> them (addition, multiplication, eigenvalue, inverse), and quaternions
> and associated operations. Don't bother with differential/integral
> calculus methods, series, or approximation methods until you need them
> (in which case you're going to have a strong motivation for doing them
> right - numerical libraries aren't all that fun to work on), or better
> yet release the library with a good license and encourage use (I'm
> looking forward to it!), and people will give back their contributions
> that they found useful. The important thing is to make the code easy
> to extend and fast. Most importantly, provide a hook for getting
> matrices from/to the various OpenGL bindings in various CL
> implementations fast.

I like it. That is a good idea, start small, and grow later. I will
begin with the vector and matrix operations. Unforatntly I'll have to
hold off untill the weekend cause of school :(

> Vladimir
> 
> PS - what's up with game programmers calling everything an "engine?"
> Does the math engine power your math car or something? :)
lol

-- 
Certum qoud factum.
Philip Haddad
From: Philip Haddad
Subject: Re: Lisp Math Engine
Date: 
Message-ID: <ba57c4f9.0411301315.484b223d@posting.google.com>
###############################################################################
## UPDATE
###############################################################################

This may be a little premature, but I wanted to get my first couple
ideas out there. I have defined a vector structure a printing method
for it as well as the dot-product and the normalization functions. I
wanted to put the code I have developed so far on paste.lisp.org,
however it is down at the moment, so this post will be rather long.
Here is the complete source I have as of 11\30\04.
Please note that I realize the code uses magnitude and direction
(polar system), however I mean it to use the x- and y-components of
the vectors. I was just confused on the representations and haven't
made the appriate changes to the code yet. So mag and dir should
basically be x-component and y-component.

(defpackage "MATH-ENGINE"
  (:use "COMMON-LISP")
  (:use "HAMILTON-COMMON-LISP"))
(defpackage "MATH-ENGINE-USER" (:use "MATH-ENGINE"))
(in-package "MATH-ENGINE")

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; Documentation for math-engine.lisp
;;;;
;;;; This package provides vectors, matrices (up to 4x4) and all of
their
;;;; operations, as well as quaternions and all of their operations.
This
;;;; package is designed to be small, fast, and is designed mainly for
those
;;;; interested in writing games or testing speed in Lisp.
;;;;
;;;; This package is meant to be easily extended, therefore it is
distrubuted
;;;; under the GPL. See http://www.gnu.org for more information.
;;;;
;;;; Usage: You can either compile this package on your top-level
http://www.
;;;; cons.org/cmucl or you can type this at the top of a source file
you want
;;;; to include all of the definitions in:
;;;; (load "/path/to/math-engine.lisp")
;;;; If you just want my symbols, then just do:
;;;; (defpackage "MY-PACKAGE"
;;;;   (:use "MATH-ENGINE"))
;;;;
;;;; A note on the quaternion package: all of the quaternion functions
and
;;;; structures were written by Pascal B. and have not been altered
much. I am
;;;; planing to add a read-object function, and define better type
functions,
;;;; however the core system was written by him.
;;;;
;;;; Please send any feedback or comments to me at:
;;;; ·············@gmail.com
;;;; Also, please feel free to add on any functions you feel are
lacking, and
;;;; show them to me, I will do my best to add the ones I feel are
useful into
;;;; the engine.
;;;;
;;;; Copyright (C) 2004 Philip Haddad (·············@gmail.com) 
11\19\04
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;; Vector functions and structures

(defstruct (vect (:conc-name v-)
		 (:print-object print-vector))
  (magnitude 0.0 :type short-float) ; magnitude
  (direction 0.0 :type short-float)) ; direction

(defmethod print-vector (v stream)
  "Simply returns vector's length and angle."
  (format stream "#V(~A,~A)" (v-magnitude v) (v-direction v)))

(defun vector-norm (mag dir)
  "Returns the norm of a vector."
  (make-vect :magnitude mag
	     :direction dir)
  (sqrt (+ (* mag mag)
	   (* dir dir))))

(defun dot-product (mag1 dir1 mag2 dir2)
  "Returns the dot-product of two vectors."
  (make-vect :magnitude mag1
	     :direction dir1)
  (make-vect :magnitude mag2
	     :direction dir2)
  (+ (* mag1 mag2) (* dir1 dir2)))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

I have a few questions:
1) How can I use deftype to define a vect type? Can I even use deftype
to accomplish this?
2)While I was defining the vector-norm function, I noticed that I
seems to do the same thing as if you calculated the magnitude of the
vector. Here is the norm definition:
|V| = sqrt(v1^2 + v2^2)
Isn't that the same as calculating the magnitude of the vector? If not
how is normalizing the vector different from finding its magnitude?
3) How do I define a macro\function that will allow me to define a
reader type for vect? I mean so when the read functions sees #V(2 3)
it knows that we are talking about a vector here. Will it
automatically happen if I define a type with deftype (see 1)? I don't
want anyone to do it for me, but if you could point me in the right
direction, that would be awesome.
4) What do think of the code? Any comments/suggestions? I will be
putting this on the web where it will be able to downloaded. I have
not purchased the URL yet, but it won't be too long now.

Thanks, and if you do like what I have here, please let me know:
·············@gmail.com

-- 
Certum quod factum.
Philip Haddad