Re: languages for CAS .. was: Re: Which is the best CAS



Herman Rubin wrote:
In article <4A12E9BE.6060706@xxxxxxxxxxxxxxx>,
Richard Fateman <fateman@xxxxxxxxxxxxxxx> wrote:
Herman Rubin wrote:
.. snip...

No; I mean that if a function produced three appropriately
designated outputs, they are stored as convenient. For
example, if one wants to get the exponent and the normalized
mantissa of a float, the way to write it would be

(xp, man) = unpack(x).a

In common lisp one can write

(multiple-value-setq
(significand exponent sign)
(decode-float -3.1415))

which I think does exactly what you want. Namely,
the variable significand is 0.785375, the exponent is 2 and the sign is -1.0

and
(* significand (expt 2 exponent) sign) is -3.1415

Now look at the length of your expression and the
length of mine.

(defmacro mvs(a b)`(multiple-value-setq ,a ,b))
;; abbreviate, if you use it often

(defmacro df(a) `(decode-float ,a))
;; abbreviate, if you use it often

(mvs (m xp s) (df x)) ;; my code, and it gives the sign, too
(xp, man) = unpack(x).a ;; your code is longer.


You can do it with Lisp, but it is
clumsly, and "computer jargon" instead of mathematical
coding. The simplicity of the mathematical code for
humans is important.

Using "=" for assignment is computer jargon, as is unpack(x).a which is certainly no mathematics I'm familiar with.




If one had an array, and wanted the mean, standard deviation,
and range, one might use the call

(m,sd, r) =summary(z).

A common lisp programmer could define summary this way
(just a sketch, obviously)

(defun summary(z)
(values (/ (apply #'+ z)(length z)) ;;average.
;; compute standard deviation here
;; compute range here)

Why should we read the list three times? Reading a
list is much slower than computations.


That's why I said a sketch. Here's a more complete program that goes through the list once.

(defun summary(z)
(let ((max most-negative-double-float)
(min most-positive-double-float)
(sum 0)(len 0)(sumsq 0) av)
(dolist (r z (values (setf av (/ sum len));average
(sqrt (- (/ sumsq len)(* av av)));sd
(list min max)))

(incf sum r)
(incf sumsq (* r r))
(incf len)
(if (> r max)(setf max r))
(if (< r min)(setf min r)))))

For people who are under the mistaken impression that it is tedious to count parentheses, let me point out that the editor does most of the work, and also indents.


An oversimplification:

The argument in favor of Axiom is that it might be better if you were using a kind of alternative universe of programming in which you have, instead of (or really, in addition to) data structures or types such as byte, word, array, record, ... the notion of "categories" like monoid, group, ring, field, polynomial, and constructors for new categories.

I am assuming that the language will allow any type one wants; mathematicians have no problems with this.

I do not understand this statement. My impression is that the typical mathematician, for reasons I do not understand, has a great deal of trouble writing computer programs. Not all mathematicians of course.
Some computer programmers have a great deal of trouble with mathematics. Not all programmers of course :)
.



Relevant Pages

  • Re: Dumbing down?
    ... I think engineering training is more important. ... programmers found gainful employment during the dot-bomb era when ... they come from abstract mathematics world. ... How does the fact that you wrote a formally verified driver for X ...
    (comp.lang.lisp)
  • Re: The annotated annotated annotated C standard
    ... Standard declines to define. ... mathematics found ... And so it is for competent programmers. ... If what you say about BASIC's for loop is correct (and I am not about to ...
    (comp.programming)
  • Re: [opensuse] Re: [SLE] Novell-Microsoft: What They Arent Telling You
    ... Today there are quite literally thousands of "programmers" that do not ... These folks are *not* being educated in mathematics as a theoretical ... (e.g. for Java: use interfaces a lot; composition over inheritance; high ... skills of new-hires coming into the department. ...
    (SuSE)
  • Re: Looking for a cartoon
    ... "If you don't know math, ... posting those comments were professional programmers; ... learned mathematics considers the investment productive. ... The student contracts to set aside his infantile ...
    (sci.math)
  • Re: languages for CAS .. was: Re: Which is the best CAS
    ... if one wants to get the exponent and the normalized ... Some computer programmers have a great deal of trouble with mathematics. ... Programming design for the early computers were not so ...
    (sci.math.symbolic)

Quantcast