Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #13103 > unrolled thread
| Started by | amzoti <amzoti@gmail.com> |
|---|---|
| First post | 2013-01-12 03:23 +0000 |
| Last post | 2013-02-26 06:09 +0000 |
| Articles | 20 on this page of 64 — 18 participants |
Back to article view | Back to comp.soft-sys.math.mathematica
Mathematica and Lisp amzoti <amzoti@gmail.com> - 2013-01-12 03:23 +0000
Re: Mathematica and Lisp David Bailey <dave@removedbailey.co.uk> - 2013-01-13 02:51 +0000
Re: Mathematica and Lisp Richard Fateman <fateman@cs.berkeley.edu> - 2013-01-14 05:01 +0000
Re: Mathematica and Lisp David Bailey <dave@removedbailey.co.uk> - 2013-01-15 04:28 +0000
Re: Mathematica and Lisp Richard Fateman <fateman@cs.berkeley.edu> - 2013-01-17 04:15 +0000
Re: Mathematica and Lisp David Bailey <dave@removedbailey.co.uk> - 2013-01-18 05:49 +0000
Re: Mathematica and Lisp Richard Fateman <fateman@cs.berkeley.edu> - 2013-01-22 07:40 +0000
Re: Mathematica and Lisp David Bailey <dave@removedbailey.co.uk> - 2013-01-23 04:18 +0000
Re: Mathematica and Lisp Richard Fateman <fateman@cs.berkeley.edu> - 2013-01-24 06:17 +0000
Re: Mathematica and Lisp Richard Fateman <fateman@cs.berkeley.edu> - 2013-01-25 06:33 +0000
Re: Mathematica and Lisp Murray Eisenberg <murray@math.umass.edu> - 2013-01-26 06:37 +0000
Re: Mathematica and Lisp Murray Eisenberg <murray@math.umass.edu> - 2013-01-26 06:37 +0000
Re: Mathematica and Lisp "W. Craig Carter" <ccarter@MIT.EDU> - 2013-01-26 21:58 +0000
Re: Mathematica and Lisp Murray Eisenberg <murray@math.umass.edu> - 2013-01-16 06:39 +0000
Re: Mathematica and Lisp Richard Fateman <fateman@cs.berkeley.edu> - 2013-01-17 04:14 +0000
Re: Mathematica and Lisp David Bailey <dave@removedbailey.co.uk> - 2013-01-17 04:14 +0000
Re: Mathematica and Lisp Richard Fateman <fateman@eecs.berkeley.edu> - 2013-01-18 05:50 +0000
Re: Mathematica and Lisp W Craig Carter <ccarter@MIT.EDU> - 2013-01-18 05:50 +0000
Re: Mathematica and Lisp Murray Eisenberg <murray@math.umass.edu> - 2013-01-18 05:50 +0000
Re: Mathematica and Lisp Murray Eisenberg <murray@math.umass.edu> - 2013-01-18 05:49 +0000
Re: Mathematica and Lisp W Craig Carter <ccarter@MIT.EDU> - 2013-01-18 05:49 +0000
Re: Mathematica and Lisp John Doty <noqsiaerospace@gmail.com> - 2013-02-01 01:46 +0000
Re: Mathematica and Lisp Richard Fateman <fateman@cs.berkeley.edu> - 2013-02-02 06:15 +0000
Re: Mathematica and Lisp David Bailey <dave@removedbailey.co.uk> - 2013-02-03 07:52 +0000
Re: Mathematica and Lisp Richard Fateman <fateman@cs.berkeley.edu> - 2013-02-05 08:06 +0000
Re: Mathematica and Lisp David Bailey <dave@removedbailey.co.uk> - 2013-02-06 10:52 +0000
Re: Mathematica and Lisp Richard Fateman <fateman@cs.berkeley.edu> - 2013-02-07 02:28 +0000
Re: Mathematica and Lisp danl@wolfram.com - 2013-02-02 06:15 +0000
Re: Mathematica and Lisp Richard Fateman <fateman@cs.berkeley.edu> - 2013-02-03 07:51 +0000
Re: Mathematica and Lisp Andrzej Kozlowski <akozlowski@gmail.com> - 2013-02-03 07:52 +0000
Re: Mathematica and Lisp Richard Fateman <fateman@cs.berkeley.edu> - 2013-02-05 08:06 +0000
Re: Mathematica and Lisp David Bailey <dave@removedbailey.co.uk> - 2013-02-06 10:52 +0000
Palette problem with Feynman slash notation "Dave Snead" <dsnead6@charter.net> - 2013-02-08 10:10 +0000
Re: Mathematica and Lisp Matthias Bode <lvsaba@hotmail.com> - 2013-02-04 01:19 +0000
Re: Mathematica and Lisp John Doty <noqsiaerospace@gmail.com> - 2013-02-04 01:20 +0000
Re: Mathematica and Lisp Richard Fateman <fateman@cs.berkeley.edu> - 2013-02-06 06:51 +0000
Re: Mathematica and Lisp David Bailey <dave@removedbailey.co.uk> - 2013-02-06 10:52 +0000
Re: Mathematica and Lisp "mathgroup " <fizzymath@knology.net> - 2013-02-07 02:27 +0000
Re: Mathematica and Lisp Alex Krasnov <akrasnov@eecs.berkeley.edu> - 2013-02-05 03:23 +0000
Re: Mathematica and Lisp John Doty <noqsiaerospace@gmail.com> - 2013-02-07 02:28 +0000
Re: Mathematica and Lisp Richard Fateman <fateman@cs.berkeley.edu> - 2013-02-08 10:10 +0000
Re: Mathematica and Lisp ?iso-8859-1?Q?J=E1nos_L=F6bb?= <janos@lobb.com> - 2013-02-09 05:42 +0000
Re: Mathematica and Lisp Richard Fateman <fateman@eecs.berkeley.edu> - 2013-02-09 05:43 +0000
Re: Mathematica and Lisp Andrzej Kozlowski <akozlowski@gmail.com> - 2013-02-08 10:10 +0000
Re: Mathematica and Lisp John Doty <noqsiaerospace@gmail.com> - 2013-02-08 10:10 +0000
Re: Mathematica and Lisp Richard Fateman <fateman@cs.berkeley.edu> - 2013-02-09 05:43 +0000
Re: Mathematica and Lisp David Bailey <dave@removedbailey.co.uk> - 2013-02-10 08:34 +0000
Re: Mathematica and Lisp Matthias Bode <lvsaba@hotmail.com> - 2013-02-09 05:43 +0000
Re: Mathematica and Lisp John Doty <noqsiaerospace@gmail.com> - 2013-02-15 06:56 +0000
Re: Mathematica and Lisp David Bailey <dave@removedbailey.co.uk> - 2013-02-17 09:08 +0000
Re: Mathematica and Lisp Joe Gwinn <joegwinn@comcast.net> - 2013-02-18 10:59 +0000
Re: Mathematica and Lisp "djmpark" <djmpark@comcast.net> - 2013-02-18 11:00 +0000
Re: Mathematica and Lisp Richard Fateman <fateman@cs.berkeley.edu> - 2013-02-22 06:05 +0000
Re: Mathematica and Lisp David Bailey <dave@removedbailey.co.uk> - 2013-02-23 12:01 +0000
Re: Mathematica and Lisp Richard Fateman <fateman@cs.berkeley.edu> - 2013-02-24 04:31 +0000
Re: Mathematica and Lisp David Bailey <dave@removedbailey.co.uk> - 2013-02-25 07:19 +0000
Re: Mathematica and Lisp Richard Fateman <fateman@cs.berkeley.edu> - 2013-02-26 06:09 +0000
Re: Mathematica and Lisp Richard Fateman <fateman@cs.berkeley.edu> - 2013-01-13 02:51 +0000
Re: Mathematica and Lisp John Doty <noqsiaerospace@gmail.com> - 2013-01-16 06:38 +0000
Re: Mathematica and Lisp Richard Fateman <fateman@cs.berkeley.edu> - 2013-01-17 04:15 +0000
Re: Mathematica and Lisp John Doty <noqsiaerospace@gmail.com> - 2013-01-18 05:50 +0000
Re: Mathematica and Lisp Peter Klamser <klamser@googlemail.com> - 2013-02-24 04:31 +0000
Re: Mathematica and Lisp Richard Fateman <fateman@cs.berkeley.edu> - 2013-02-25 07:19 +0000
Re: Mathematica and Lisp John Doty <noqsiaerospace@gmail.com> - 2013-02-26 06:09 +0000
Page 1 of 4 [1] 2 3 4 Next page →
| From | amzoti <amzoti@gmail.com> |
|---|---|
| Date | 2013-01-12 03:23 +0000 |
| Subject | Mathematica and Lisp |
| Message-ID | <kcqkv4$lq5$1@smc.vnet.net> |
Hi All, It is clear the Mathematica uses Lisp as one of the example programming paradigms it pulls from and I have a general question regarding this. Many moons ago I took a Lisp class and was awful at it (Lisp was very new), but through Mathematica, have to come to understand the great power and utility of it. Would it be helpful to learn Lisp in order to improve programming skills in Mathematica? If so, what Lisp books would you recommend? What variant of Lisp would you recommend using for practice - Common Lisp, Scheme, or Clojure? Would Mathematica itself be a better choice (I am not sure if it supports all the Lisp language constructs and such). What about Haskell? Any insights and guidance are appreciated. Regards -A
[toc] | [next] | [standalone]
| From | David Bailey <dave@removedbailey.co.uk> |
|---|---|
| Date | 2013-01-13 02:51 +0000 |
| Message-ID | <kct7fj$sgo$1@smc.vnet.net> |
| In reply to | #13103 |
On 12/01/2013 03:23, amzoti wrote: > Hi All, > > It is clear the Mathematica uses Lisp as one of the example programming paradigms it pulls from and I have a general question regarding this. > > Many moons ago I took a Lisp class and was awful at it (Lisp was very new), but through Mathematica, have to come to understand the great power and utility of it. > > Would it be helpful to learn Lisp in order to improve programming skills in Mathematica? > > If so, what Lisp books would you recommend? > > What variant of Lisp would you recommend using for practice - Common Lisp, Scheme, or Clojure? Would Mathematica itself be a better choice (I am not sure if it supports all the Lisp language constructs and such). > > What about Haskell? > > Any insights and guidance are appreciated. > > Regards -A > Mathematica has a vague resemblance to LISP, but there are big differences. One in particular, is that Mathematica lists are not linked lists. That means if you add an element to a list (Append or Prepend) the whole structure has to be copied, which is expensive for long lists. This was done because lists are often used to store vectors whose components need to be accessed efficiently in arbitrary order. I'd read the Mathematica tutorial, and forget about LISP! David Bailey http://www.dbaileyconsultancy.co.uk
[toc] | [prev] | [next] | [standalone]
| From | Richard Fateman <fateman@cs.berkeley.edu> |
|---|---|
| Date | 2013-01-14 05:01 +0000 |
| Message-ID | <kd03ej$6dl$1@smc.vnet.net> |
| In reply to | #13124 |
On 1/12/2013 6:51 PM, David Bailey wrote: ... >> > Mathematica has a vague resemblance to LISP, but there are big > differences. One in particular, is that Mathematica lists are not linked > lists. David has a point: to some extent Mathematica "does Lisp wrong". Lisp has lists but also arrays and hashtables. Mathematica uses the term List, but the implementation is as an array. Then there is a SparseArray which is also not an array but a hashtable. The advantage of a true list is that you can add new elements to it without copying it. The advantage of an array is that you can access the nth element without scanning through others. Maybe it would be fairer to say that Mathematica "does data structures wrong" because it conflicts with standard usage throughout computer science. That's one reason why I think it is questionable that people should learn Mathematica's language as a first programming language. (Another reason has to do with the terribly confusing implementation of scope in Blocks, Modules, Functions, Patterns.) But that's not pertinent to this particular question. There is another aspect though, suggesting learning Lisp is not a bad idea. which is that some parts of Mathematica's underlying calculation engine are best accessed using a functional programming style. These include Map and friends, Apply, Function (&) and a handful of other constructs adapted and occasionally corrupted from Lisp or other functional-style languages. Learning a simple version of Lisp, namely Scheme, by reading the classic Structure and Interpretation of Computer Programs (SICP) by Abelson/Sussman can be an illuminating, clarifying experience, especially for people who have been exposed to any of the traditional languages or Mathematica. If you have ever wondered if languages like C++ or Java or PHP ... really need to be so complicated -- is it inherent in programming algorithms? then you should take a look at SICP. Free online. > I'd read the Mathematica tutorial, and forget about LISP! I'd recommend that you too read SICP. It's deceptively easy to get into, and many people really enjoy it. RJF
[toc] | [prev] | [next] | [standalone]
| From | David Bailey <dave@removedbailey.co.uk> |
|---|---|
| Date | 2013-01-15 04:28 +0000 |
| Message-ID | <kd2ltk$cog$1@smc.vnet.net> |
| In reply to | #13134 |
On 14/01/2013 05:01, Richard Fateman wrote:
>
> David has a point: to some extent Mathematica "does Lisp wrong". Lisp
> has lists but also arrays and hashtables. Mathematica uses the term
> List, but the implementation is as an array. Then there is a SparseArray
> which is also not an array but a hashtable.
Actually, I don't think sparse arrays are based on hash tables. You can
see the internal structure of a SparaseArray object thus:
s = SparseArray[{{1, 1} -> 1, {2, 2} -> 2, {3, 3} -> 3, {1, 3} -> 4}];
s//InputForm
SparseArray[Automatic, {3, 3}, 0, {1, {{0, 2, 3, 4}, {{1}, {3}, {2},
{3}}}, {1, 4, 2, 3}}]
The approach seems to be to index down one dimension, and then follow a
list of entries for the other dimension. I am not sure what happens in
the 1-dimensional case, but if you dump the structure out in the same
way, it clearly isn't a hash table.
Incidentally, this really is the internal structure of a sparse array -
you can replace the head of a sparse array, manipulate the structure and
reassemble a sparse array if necessary!
Of course, It makes you wonder why sparse arrays do not use hash tables!
I am less convinced that LISP did get it right - they just got there
first! Variants of LISP had to add arrays and hash tables to the basic
language, which obviously traded language simplicity for performance on
larger problems. Mathematica seems to have kept its original design (at
least in this area) over the years, even though internally, lists now
come in two flavors!
I also like the way in which Mathematica does not force people to use
functional programming. I find many situations in which functional
programming gives no perceptible gain, and can render an algorithm more
obscure. Perhaps that is because I learned Fortran as my first computer
language :)
I do tend to agree that teaching Mathematica as a first programming
language, would be a bad idea, because so much happens behind the scene
- for example the way in which multiple definitions for a function get
reordered to improve efficiency. I would imagine that some students
would get a hazy idea of what the were asking the computer to do, or how
expensive it might be.
David Bailey
http://www.dbaileyconsultancy.co.uk
[toc] | [prev] | [next] | [standalone]
| From | Richard Fateman <fateman@cs.berkeley.edu> |
|---|---|
| Date | 2013-01-17 04:15 +0000 |
| Message-ID | <kd7tsg$q3s$1@smc.vnet.net> |
| In reply to | #13143 |
On 1/14/2013 8:28 PM, David Bailey wrote:
> On 14/01/2013 05:01, Richard Fateman wrote:
>
>>
>> David has a point: to some extent Mathematica "does Lisp wrong". Lisp
>> has lists but also arrays and hashtables. Mathematica uses the term
>> List, but the implementation is as an array. Then there is a SparseArray
>> which is also not an array but a hashtable.
>
> Actually, I don't think sparse arrays are based on hash tables. You can
> see the internal structure of a SparaseArray object thus:
>
> s = SparseArray[{{1, 1} -> 1, {2, 2} -> 2, {3, 3} -> 3, {1, 3} -> 4}];
>
> s//InputForm
>
> SparseArray[Automatic, {3, 3}, 0, {1, {{0, 2, 3, 4}, {{1}, {3}, {2},
> {3}}}, {1, 4, 2, 3}}]
>
> The approach seems to be to index down one dimension, and then follow a
> list of entries for the other dimension. I am not sure what happens in
> the 1-dimensional case, but if you dump the structure out in the same
> way, it clearly isn't a hash table.
The point is that Mathematica is confusing to new users;
>
> Incidentally, this really is the internal structure of a sparse array -
> you can replace the head of a sparse array, manipulate the structure and
> reassemble a sparse array if necessary!
>
> Of course, It makes you wonder why sparse arrays do not use hash tables!
Maybe it will be in version 10. There is no way of telling from outside
the company.
>
> I am less convinced that LISP did get it right - they just got there
> first! Variants of LISP had to add arrays and hash tables to the basic
> language, which obviously traded language simplicity for performance on
> larger problems.
There is an ANSI Standard Common Lisp that has a range of features.
Arrays were in "early" Lisp at least by 1966. There were arrays in
Fortran and Algol before that, so Lisp wasn't first. If you want to
criticize languages by historical relics, you might note that Fortran
doesn't have subroutines. Oh, variants of Fortran added subroutines.
Mathematica seems to have kept its original design (at
> least in this area) over the years, even though internally, lists now
> come in two flavors!
Mathematica's internal design has apparently changed in many respects;
some WRI literature claims it's been entirely rewritten.
>
>
> I also like the way in which Mathematica does not force people to use
> functional programming.
Lisp does not force people to use functional programming. Here is a
Lisp program. (loop for i from 1 to 10 do (print i))
I find many situations in which functional
> programming gives no perceptible gain, and can render an algorithm more
> obscure.
I've not seen that be a problem for lisp programmers.
Perhaps that is because I learned Fortran as my first computer
> language :)
>
> I do tend to agree that teaching Mathematica as a first programming
> language, would be a bad idea, because so much happens behind the scene
> - for example the way in which multiple definitions for a function get
> reordered to improve efficiency. I would imagine that some students
> would get a hazy idea of what the were asking the computer to do, or how
> expensive it might be.
I think the issue is not only that it violates transparency, but that it
mis-uses terms, it can make a hash of comparing algorithms and data
structures for efficiency, it is expensive and proprietary, it has no
formal definition, and some things are done just out-and-out wrong from
the perspective of computer science and numerical analysis.
But other than that, eh..
>
> David Bailey
> http://www.dbaileyconsultancy.co.uk
>
>
[toc] | [prev] | [next] | [standalone]
| From | David Bailey <dave@removedbailey.co.uk> |
|---|---|
| Date | 2013-01-18 05:49 +0000 |
| Message-ID | <kdanpt$3d5$1@smc.vnet.net> |
| In reply to | #13182 |
On 17/01/2013 04:15, Richard Fateman wrote: > On 1/14/2013 8:28 PM, David Bailey wrote: >> On 14/01/2013 05:01, Richard Fateman wrote: >> > > The point is that Mathematica is confusing to new users; Well I'd imagine that engineers who simply want to perform a mathematical calculation - one that doesn't come straight out of the box, like an isolated integral - the Mathematica language is probably easier to use than LISP. >> > Maybe it will be in version 10. There is no way of telling from outside > the company. Possibly, but on the whole features seem to mature fast and then remain stable. > >> > > There is an ANSI Standard Common Lisp that has a range of features. > Arrays were in "early" Lisp at least by 1966. There were arrays in > Fortran and Algol before that, so Lisp wasn't first. If you want to > criticize languages by historical relics, you might note that Fortran > doesn't have subroutines. Oh, variants of Fortran added subroutines. Clearly people can argue endlessly over the merits of different languages. To me, the interesting feature of early LISP was the elegant minimalist design. It seemed to offset my irritation that foo(1,2,3) is a lot easier to read than (foo,1,2,3) and that the language did live up to its name: Lots of Irritating Sets of Parentheses! Once it had to add other constructs that elegance was lost. > > > > Mathematica seems to have kept its original design (at >> least in this area) over the years, even though internally, lists now >> come in two flavors! > > Mathematica's internal design has apparently changed in many respects; > some WRI literature claims it's been entirely rewritten. >> Well obviously it is only the external design that is directly relevant to us. I'd expect the internal design to change radically, as for example, typical available RAM soared during the two decades following 1990. >> > > I think the issue is not only that it violates transparency, but that it > mis-uses terms, it can make a hash of comparing algorithms and data > structures for efficiency, it is expensive and proprietary, it has no > formal definition, and some things are done just out-and-out wrong from > the perspective of computer science and numerical analysis. > > But other than that, eh.. Which kind of makes me wonder why you actually use Mathematica! If you listed some of the things you like about the system, it might become apparent that a variety of subtle tradeoffs were necessary to provide those features. David Bailey http://www.dbaileyconsultancy.co.uk
[toc] | [prev] | [next] | [standalone]
| From | Richard Fateman <fateman@cs.berkeley.edu> |
|---|---|
| Date | 2013-01-22 07:40 +0000 |
| Message-ID | <kdlfp1$117$1@smc.vnet.net> |
| In reply to | #13187 |
On 1/17/2013 9:49 PM, David Bailey wrote: > On 17/01/2013 04:15, Richard Fateman wrote: >> On 1/14/2013 8:28 PM, David Bailey wrote: >>> On 14/01/2013 05:01, Richard Fateman wrote: >>> > >> >> The point is that Mathematica is confusing to new users; > > Well I'd imagine that engineers who simply want to perform a > mathematical calculation - one that doesn't come straight out of the > box, like an isolated integral - the Mathematica language is probably > easier to use than LISP. Using Mathematica as a simple command language -- a front end to the symbolic mathematics application program underneath -- is quite different from using Mathematica as a language in which to build significant new applications. Even so, you seem to forget the trouble new users have in typing simple mathematics into Mathematica. The surprise when sin(x)/x turns out to be sin. >>> > >> Maybe it will be in version 10. There is no way of telling from outside >> the company. > Possibly, but on the whole features seem to mature fast and then remain > stable. I am sure that is the intention. >> >>> > >> >> There is an ANSI Standard Common Lisp that has a range of features. >> Arrays were in "early" Lisp at least by 1966. There were arrays in >> Fortran and Algol before that, so Lisp wasn't first. If you want to >> criticize languages by historical relics, you might note that Fortran >> doesn't have subroutines. Oh, variants of Fortran added subroutines. > Clearly people can argue endlessly over the merits of different > languages. To me, the interesting feature of early LISP was the elegant > minimalist design. It seemed to offset my irritation that foo(1,2,3) is > a lot easier to read than (foo,1,2,3) First of all, it would be (foo 1 2 3). No commas. and that the language did live up > to its name: Lots of Irritating Sets of Parentheses! Once it had to add > other constructs that elegance was lost. Any experienced Lisp programmer these days will use an editor that keeps track of both indentation and parentheses, and so the structure of a program will be quite evident from the indentation. A programmer will probably first notice the error in indentation and correct it by adding or removing a parenthesis. It is an enormous boon to the construction of programs with nested structure, such as if-then-else conditionals, and mathematical expressions. In case you hadn't noticed, the parenthesis structure for large deeply nested mathematical expressions is difficult for humans to comprehend accurately; fortunately the INPUT lines in Mathematica are generally short, while the OUTPUTS are the complicated ones. The prefix vs. infix issue is also a red herring. If Lisp programmers wanted to use infix they would use any of a number of free infix front ends. They rarely do. >> >> >> >> Mathematica seems to have kept its original design (at >>> least in this area) over the years, even though internally, lists now >>> come in two flavors! >> >> Mathematica's internal design has apparently changed in many respects; >> some WRI literature claims it's been entirely rewritten. >>> > Well obviously it is only the external design that is directly relevant > to us. Not if the efficiencies change drastically, which they do. I'd expect the internal design to change radically, as for > example, typical available RAM soared during the two decades following 1990. >>> > > >> >> I think the issue is not only that it violates transparency, but that it >> mis-uses terms, it can make a hash of comparing algorithms and data >> structures for efficiency, it is expensive and proprietary, it has no >> formal definition, and some things are done just out-and-out wrong from >> the perspective of computer science and numerical analysis. >> >> But other than that, eh.. > Which kind of makes me wonder why you actually use Mathematica! If you > listed some of the things you like about the system, it might become > apparent that a variety of subtle tradeoffs were necessary to provide > those features. I rarely write programs of any length in Mathematica, because (as I've said) I hold the programming language in generally low regard. On the other hand I am pretty much familiar with the language because I wrote a parser for it (in Lisp) some time ago, and in my experience one of the best ways to really learn a language is to "implement" it. I do find it an object of curiosity to see how some ideas are expressed by the symbolic mathematical routines (e.g. integration). And the Solve (and related, e.g. Reduce) programs have followed an interesting path of improvement. It is also useful for finding high-precision values of numerical library functions to compare to other programs, e.g. Bessel functions, that I was experimenting with. Unfortunately for Mathematica, I found bugs in its Bessel function (reported and acknowledged by them). Here's one in version 8 (I do not yet have version 9 installed) q=429515858585961022071539/6922263581864661506963; a=N[BesselJ[0,q],45]; b=N[BesselJ[0,q],100]; c=N[BesselJ[0,q],45]; a==c returns False. If I were using a computer to do something that required correct answers for, say, life safety, like building a bridge, I would follow WRI's advice and not use Mathematica. (see http://www.wolframalpha.com/termsofuse/)
[toc] | [prev] | [next] | [standalone]
| From | David Bailey <dave@removedbailey.co.uk> |
|---|---|
| Date | 2013-01-23 04:18 +0000 |
| Message-ID | <kdnoak$725$1@smc.vnet.net> |
| In reply to | #13247 |
On 22/01/2013 07:40, Richard Fateman wrote: >> Well I'd imagine that engineers who simply want to perform a >> mathematical calculation - one that doesn't come straight out of the >> box, like an isolated integral - the Mathematica language is probably >> easier to use than LISP. > > Using Mathematica as a simple command language -- a front end to the > symbolic mathematics application program underneath -- is quite > different from using Mathematica as a language in which to build > significant new applications. I tried to describe exactly that situation in my original comment - one in which the user had to write a little code to get what he wants. > > Even so, you seem to forget the trouble new users have in typing > simple mathematics into Mathematica. The surprise when sin(x)/x > turns out to be sin. > This is true, but one way or another, they are going to face this with any computer algebra package because in CA variables can't be restricted to be single letters - there just aren't enough of them. I used to give an introduction to Mathematica, and I used to show examples like that early on, and motivate people by pointing out that ordinary math notation is actually ambiguous - e.g. f(x)/x - once they saw that, the extra rules of Mathematica made perfect sense. >>>> > > First of all, it would be (foo 1 2 3). No commas. > Yes - a typing error, but it probably also shows how long ago I gave up on LISP! > and that the language did live up >> to its name: Lots of Irritating Sets of Parentheses! Once it had to add >> other constructs that elegance was lost. > > Any experienced Lisp programmer these days will use an editor that keeps > track of both indentation and parentheses, and so the structure of a > program will be quite evident from the indentation. A programmer > will probably first notice the error in indentation and correct it by > adding or removing a parenthesis. It is an enormous boon to the > construction of programs with nested structure, such as if-then-else > conditionals, and mathematical expressions. In case you hadn't noticed, > the parenthesis structure for large deeply nested mathematical > expressions is difficult for humans to comprehend accurately; > fortunately the INPUT lines in Mathematica are generally short, while > the OUTPUTS are the complicated ones. > > The prefix vs. infix issue is also a red herring. If Lisp programmers > wanted to use infix they would use any of a number of free infix front > ends. They rarely do. Having 3 types of brackets, definitely helps to discern the structure, even with indentation. Perhaps LISP could have been improved by permitting all three, to be used interchangeably so long as they paired correctly. Unless the infix front end distinguished reliably between code and data (which I don't think it could, in general), you would still have a problem - ideally you want to see sin(a) but (apples oranges pears) Also, if you print out an expression, you want the first format, and if you print a list, you want the second. If you print a fragment of code, you may want to see a mixture of both styles. Extra types of brackets make all that simple. > > I rarely write programs of any length in Mathematica, because (as I've > said) I hold the programming language in generally low regard. > On the other hand I am pretty much familiar with the language because > I wrote a parser for it (in Lisp) some time ago, and in my experience > one of the best ways to really learn a language is to "implement" it. Did you implement it, or just parse it? I do agree about learning a language by implementing it. Two of us once wrote a Fortran compiler in Fortran (!!), and bootstrapped it. It was widely used on Prime computers. One of the things I discovered, was that the old issue about Fortran's context sensitive grammar, was an utterly trivial problem! > > I do find it an object of curiosity to see how some ideas are > expressed by the symbolic mathematical routines (e.g. integration). > And the Solve (and related, e.g. Reduce) programs have followed > an interesting path of improvement. > > It is also useful for finding high-precision values of numerical > library functions to compare to other programs, e.g. Bessel functions, > that I was experimenting with. Unfortunately for Mathematica, I found > bugs in > its Bessel function (reported and acknowledged by them). > Here's one in version 8 (I do not yet have version 9 installed) > q=429515858585961022071539/6922263581864661506963; > > a=N[BesselJ[0,q],45]; > b=N[BesselJ[0,q],100]; > c=N[BesselJ[0,q],45]; > > a==c > returns False. > > If I were using a computer to do something that required correct answers > for, say, life safety, like building a bridge, I would follow WRI's > advice and not use Mathematica. > (see http://www.wolframalpha.com/termsofuse/) So have you found the perfect language - one in which none of the functions contain imperfections, and yet which offers anything approaching the computational sophistication of Mathematica? BTW, I wouldn't be surprised if a lot of safety critical code isn't written in Fortran! David Bailey http://www.dbaileyconsultancy.co.uk
[toc] | [prev] | [next] | [standalone]
| From | Richard Fateman <fateman@cs.berkeley.edu> |
|---|---|
| Date | 2013-01-24 06:17 +0000 |
| Message-ID | <kdqjm1$3gi$1@smc.vnet.net> |
| In reply to | #13249 |
On 1/22/2013 8:18 PM, David Bailey wrote:
....
(regarding Lisp)
> Having 3 types of brackets, definitely helps to discern the structure,
> even with indentation.
Some lisp implementations allowed for the use of ] to terminate all
open parentheses up to the prior [. It is possible to alter the meaning
of characters in ANSI Common Lisp, so almost anything can be implemented.
Perhaps LISP could have been improved by
> permitting all three, to be used interchangeably so long as they paired
> correctly.
I expect that this can be done, and maybe already exists. Mathematica
does not allow the nesting of ([{}]) except for special uses, so
building up a big expression as you type is probably about as error
prone as Lisp, if not quite as unfamiliar. Note that f(a,g(b),c) has
as many parens as the Lisp (f a (g b) c) and that using square
brackets as f[a,g[b],c] is not much different. Also note that
the highlighting of the matching left parenthesis is done in
Mathematica's current front end. A similar feature is available in Lisp
editors.
>
> Unless the infix front end distinguished reliably between code and data
> (which I don't think it could, in general),
This is generally considered a benefit for advanced programming. On the
other hand, most programmers spend their time composing programs for
which it is pretty clear what is a program. Of the various types of
data (array, vector, string, hash table, file descriptor, integer,
float, complex, rational, ..., list ...) only one could possibly be
a program, namely list. So it is perhaps not such a big problem as
you might think.
you would still have a
> problem - ideally you want to see
>
> sin(a)
>
> but
>
> (apples oranges pears)
>
> Also, if you print out an expression, you want the first format, and if
> you print a list, you want the second.
Actually, the notation (sin a) instead of Sin[a] is pretty much of
a wash.
If you print a fragment of code,
> you may want to see a mixture of both styles. Extra types of brackets
> make all that simple.
Or you may prefer uniformity. E.g. compare:
Mathematica Input, Mathematica FullForm Lisp
a+b+c Plus[a,b,c] (+ a b c)
a^2 Power[a,2] (expt a 2)
Sin[x] Sin[x] (sin x)
Also note that Mathematica has abandoned infix for such well known syntax as
the "do" loop. This would ordinarily look like
for i=1 to 10 by 2 do f(i).... but is instead Do[f[i],{i,1,10,2}].
That's pretty close to (dotimes (f i) i 1 10 2).
Incidentally, common lisp allows
(loop for i from 1 to 10 step 2 do (f i)) or some such thing.
[I don't use it much myself :)
>>
>
>> I rarely write programs of any length in Mathematica, because (as I've
>> said) I hold the programming language in generally low regard.
>> On the other hand I am pretty much familiar with the language because
>> I wrote a parser for it (in Lisp) some time ago, and in my experience
>> one of the best ways to really learn a language is to "implement" it.
>
> Did you implement it, or just parse it?
Certainly not all the application. Parser + pattern matcher + some
simple application programs like differentiation, integration. numerical
evaluation done differently; display. See my web page for free download.
>
> I do agree about learning a language by implementing it. Two of us once
> wrote a Fortran compiler in Fortran (!!), and bootstrapped it. It was
> widely used on Prime computers. One of the things I discovered, was that
> the old issue about Fortran's context sensitive grammar, was an utterly
> trivial problem!
I think there is a standard hack to recognize a "DO" statement by the
fact that there is a comma not enclosed in parentheses. Check for this
and handle the card differently. There are Fortran compilers written in
Lisp; in fact most compiler implementations depend upon an intermediate
expression tree language which requires that they include internally
a subset of what some people would recognize as Lisp -- for building
and traversing trees.
>>
>>
>>
>> If I were using a computer to do something that required correct answers
>> for, say, life safety, like building a bridge, I would follow WRI's
>> advice and not use Mathematica.
>> (see http://www.wolframalpha.com/termsofuse/)
>
> So have you found the perfect language - one in which none of the
> functions contain imperfections, and yet which offers anything
> approaching the computational sophistication of Mathematica?
I think that perfection depends on the context. Though they are
not my areas of primary interest, I suspect the Mathematica is pretty
good for some kinds of graphics (though I find it clumsy sometimes,
that is probably my unfamiliarity with the nuances of Graphics objects),
and maybe linear cellular automata.
There seems to be a fairly strong consensus that for numerical
programming there are other competitors favored in engineering schools.
>
> BTW, I wouldn't be surprised if a lot of safety critical code isn't
> written in Fortran!
I expect that is true. It would be a LOT easier to formally prove the
correctness of a FORTRAN program than a Mathematica program. And there
is even a history of proving FORTRAN compilers correct. I daresay no
proof that Mathematica is correct is likely to appear any time soon.
RJF
>
> David Bailey
> http://www.dbaileyconsultancy.co.uk
>
>
>
>
[toc] | [prev] | [next] | [standalone]
| From | Richard Fateman <fateman@cs.berkeley.edu> |
|---|---|
| Date | 2013-01-25 06:33 +0000 |
| Message-ID | <kdt90k$992$1@smc.vnet.net> |
| In reply to | #13249 |
On 1/22/2013 8:18 PM, David Bailey wrote:
....
(regarding Lisp)
> Having 3 types of brackets, definitely helps to discern the structure,
> even with indentation.
Some lisp implementations allowed for the use of ] to terminate all
open parentheses up to the prior [. It is possible to alter the meaning
of characters in ANSI Common Lisp, so almost anything can be implemented.
Perhaps LISP could have been improved by
> permitting all three, to be used interchangeably so long as they paired
> correctly.
I expect that this can be done, and maybe already exists. Mathematica
does not allow the nesting of ([{}]) except for special uses, so
building up a big expression as you type is probably about as error
prone as Lisp, if not quite as unfamiliar. Note that f(a,g(b),c) has
as many parens as the Lisp (f a (g b) c) and that using square
brackets as f[a,g[b],c] is not much different. Also note that
the highlighting of the matching left parenthesis is done in
Mathematica's current front end. A similar feature is available in Lisp
editors.
>
> Unless the infix front end distinguished reliably between code and data
> (which I don't think it could, in general),
This is generally considered a benefit for advanced programming. On the
other hand, most programmers spend their time composing programs for
which it is pretty clear what is a program. Of the various types of
data (array, vector, string, hash table, file descriptor, integer,
float, complex, rational, ..., list ...) only one could possibly be
a program, namely list. So it is perhaps not such a big problem as
you might think.
you would still have a
> problem - ideally you want to see
>
> sin(a)
>
> but
>
> (apples oranges pears)
>
> Also, if you print out an expression, you want the first format, and if
> you print a list, you want the second.
Actually, the notation (sin a) instead of Sin[a] is pretty much of
a wash.
If you print a fragment of code,
> you may want to see a mixture of both styles. Extra types of brackets
> make all that simple.
Or you may prefer uniformity. E.g. compare:
Mathematica Input, Mathematica FullForm Lisp
a+b+c Plus[a,b,c] (+ a b c)
a^2 Power[a,2] (expt a 2)
Sin[x] Sin[x] (sin x)
Also note that Mathematica has abandoned infix for such well known syntax as
the "do" loop. This would ordinarily look like
for i=1 to 10 by 2 do f(i).... but is instead Do[f[i],{i,1,10,2}].
That's pretty close to (dotimes (f i) i 1 10 2).
Incidentally, common lisp allows
(loop for i from 1 to 10 step 2 do (f i)) or some such thing.
[I don't use it much myself :)
>>
>
>> I rarely write programs of any length in Mathematica, because (as I've
>> said) I hold the programming language in generally low regard.
>> On the other hand I am pretty much familiar with the language because
>> I wrote a parser for it (in Lisp) some time ago, and in my experience
>> one of the best ways to really learn a language is to "implement" it.
>
> Did you implement it, or just parse it?
Certainly not all the application. Parser + pattern matcher + some
simple application programs like differentiation, integration. numerical
evaluation done differently; display. See my web page for free download.
>
> I do agree about learning a language by implementing it. Two of us once
> wrote a Fortran compiler in Fortran (!!), and bootstrapped it. It was
> widely used on Prime computers. One of the things I discovered, was that
> the old issue about Fortran's context sensitive grammar, was an utterly
> trivial problem!
I think there is a standard hack to recognize a "DO" statement by the
fact that there is a comma not enclosed in parentheses. Check for this
and handle the card differently. There are Fortran compilers written in
Lisp; in fact most compiler implementations depend upon an intermediate
expression tree language which requires that they include internally
a subset of what some people would recognize as Lisp -- for building
and traversing trees.
>>
>>
>>
>> If I were using a computer to do something that required correct answers
>> for, say, life safety, like building a bridge, I would follow WRI's
>> advice and not use Mathematica.
>> (see http://www.wolframalpha.com/termsofuse/)
>
> So have you found the perfect language - one in which none of the
> functions contain imperfections, and yet which offers anything
> approaching the computational sophistication of Mathematica?
I think that perfection depends on the context. Though they are
not my areas of primary interest, I suspect the Mathematica is pretty
good for some kinds of graphics (though I find it clumsy sometimes,
that is probably my unfamiliarity with the nuances of Graphics objects),
and maybe linear cellular automata.
There seems to be a fairly strong consensus that for numerical
programming there are other competitors favored in engineering schools.
>
> BTW, I wouldn't be surprised if a lot of safety critical code isn't
> written in Fortran!
I expect that is true. It would be a LOT easier to formally prove the
correctness of a FORTRAN program than a Mathematica program. And there
is even a history of proving FORTRAN compilers correct. I daresay no
proof that Mathematica is correct is likely to appear any time soon.
RJF
>
> David Bailey
> http://www.dbaileyconsultancy.co.uk
>
>
>
>
[toc] | [prev] | [next] | [standalone]
| From | Murray Eisenberg <murray@math.umass.edu> |
|---|---|
| Date | 2013-01-26 06:37 +0000 |
| Message-ID | <kdvtjv$fof$1@smc.vnet.net> |
| In reply to | #13249 |
On Jan 24, 2013, at 1:18 AM, Richard Fateman <fateman@cs.berkeley.edu> wrote: > On 1/22/2013 8:18 PM, David Bailey wrote: > .... > (regarding Lisp) > >> Having 3 types of brackets, definitely helps to discern the structure, >> even with indentation. >> > ... Note that f(a,g(b),c) has > as many parens as the Lisp (f a (g b) c) and that using square > brackets as f[a,g[b],c] is not much different. In many situations, in Mathematica one may use f[a, g@b, c] which is much easier to read that the FullForm equivalent (with the nested brackets). --- Murray Eisenberg murray@math.umass.edu Mathematics & Statistics Dept. Lederle Graduate Research Tower phone 413 549-1020 (H) University of Massachusetts 413 545-2838 (W) 710 North Pleasant Street fax 413 545-1801 Amherst, MA 01003-9305
[toc] | [prev] | [next] | [standalone]
| From | Murray Eisenberg <murray@math.umass.edu> |
|---|---|
| Date | 2013-01-26 06:37 +0000 |
| Message-ID | <kdvtk5$fon$1@smc.vnet.net> |
| In reply to | #13249 |
On Jan 25, 2013, at 1:34 AM, Richard Fateman <fateman@cs.berkeley.edu> wrote: > ... > I think that perfection depends on the context. Though they are > not my areas of primary interest, I suspect the Mathematica is pretty > good for some kinds of graphics (though I find it clumsy sometimes, > that is probably my unfamiliarity with the nuances of Graphics objects), > and maybe linear cellular automata. > There seems to be a fairly strong consensus that for numerical > programming there are other competitors favored in engineering schools. At least some of that "fairly strong consensus" may be ill-founded today, after Mathematica's numerical methods have evolved. Typically I encounter engineers and scientists who assure me that M****b is oh so much better than Mathematica, yet they have never actually tried Mathematica in a serious way or looked into efficiency comparisons. They were raised on M****b and so they're convinced it's the be-all and end-all for numerical work, and how dare anybody try to tell them otherwise -- any evidence to the contrary be damned. While one can compile certain functions within Mathematica, of course it's difficult for any interpreted language to compete for running efficiency with a compiled language. --- Murray Eisenberg murray@math.umass.edu Mathematics & Statistics Dept. Lederle Graduate Research Tower phone 413 549-1020 (H) University of Massachusetts 413 545-2838 (W) 710 North Pleasant Street fax 413 545-1801 Amherst, MA 01003-9305
[toc] | [prev] | [next] | [standalone]
| From | "W. Craig Carter" <ccarter@MIT.EDU> |
|---|---|
| Date | 2013-01-26 21:58 +0000 |
| Message-ID | <ke1ji7$jnf$1@smc.vnet.net> |
| In reply to | #13249 |
On Jan 26, 2013, at 1:38 AM, Murray Eisenberg <murray@math.umass.edu> wrote: > On Jan 25, 2013, at 1:34 AM, Richard Fateman <fateman@cs.berkeley.edu> wrote: > >> ... >> . >> There seems to be a fairly strong consensus that for numerical >> programming there are other competitors favored in engineering schools. > > At least some of that "fairly strong consensus" may be ill-founded today, after Mathematica's numerical methods have evolved. > > Typically I encounter engineers and scientists who assure me that M****b is oh so much better than Mathematica, yet they have never actually tried Mathematica in a serious way or looked into efficiency comparisons. They were raised on M****b and so they're convinced it's the be-all and end-all for numerical work, and how dare anybodtry to tell them otherwise -- any evidence to the contrary be damned. > I believe that this is an accurate stereotype of my engineering colleagues---I've been struggling to persuade them to try something else for years now. There are some math and cs departments (eg, my institution) that default to M*b as well for teaching and numerical computations. Many claim that the syntax is too obscure; I'm curious to see if the new predictive interface alleviates this. For the engineers, I believe the recalcitrance could be reduced with *many* more working and documented examples of NDSolve. The wolfram tutorial on advanced numerical solutions to pdes http://www.wolfram.com/learningcenter/tutorialcollection/ is fine but sparse on examples; the book doesn't target engineers. WCC
[toc] | [prev] | [next] | [standalone]
| From | Murray Eisenberg <murray@math.umass.edu> |
|---|---|
| Date | 2013-01-16 06:39 +0000 |
| Message-ID | <kd5huk$jk6$1@smc.vnet.net> |
| In reply to | #13134 |
On Jan 14, 2013, at 11:31 PM, David Bailey <dave@removedbailey.co.uk.math.umass.edu> wrote: > I do tend to agree that teaching Mathematica as a first programming > language, would be a bad idea, because so much happens behind the scene > - for example the way in which multiple definitions for a function get > reordered to improve efficiency. I would imagine that some students > would get a hazy idea of what the were asking the computer to do, or how > expensive it might be. It all depends on just what you want somebody to accomplish when learning his/her first programming language. I've thought about that a lot over the some 30 years that I taught FORTRAN, Pascal, APL, J, and Mathematica in university math courses. (My very first programming language was Assembly for a Univac I, followed shortly by octal-coded machine instructions for a paper-tape input computer, and then FORTRAN II -- all while I was an undergraduate. A decade later, BASIC, APL, Pascal; subsequently, J and Mathematica. Even later, a smattering of C, Perl, Python, Java. I've even dabbled a tiny bit with Forth and Snobol.) So what is essential for a first exposure to programming? To me, the essentials are: (0) Understanding carefully what the problem is, including what is given and what is to be found. (1) Identifying the objects (data) and what is to be done with them (operations, functions, procedures). (2) Breaking up a larger problem into its constituent parts. (3) Isolating the big ideas from the smaller technical points. (4) Expressing things within the constraints of a precise syntax. (5) Suitably modularizing the code in accordance with (2) and (3). (6) Making the code readable through judicious choice of names along with sufficient but non-redundant comments. (7) Making the code maintainable -- by the original author or others. (8) Being able to test and debug the code. (9) For numerical work, understanding and coping with roundoff and other errors due to the limitations of finite precision. (10) Recognizing when and knowing how to code an operation repetitively -- whether explicitly (iteratively or recursively) or implicitly (functionally). (11) Recognizing when and knowing how to express conditionals (whether via an explicit If, Which, etc., or instead as is possible in Mathematica, separate definitions of the same function for different cases). Must the first-language learner get closer what s/he is "asking the computer to do" than might be the case with Mathematica? If so, how should you reasonably decide how deep to descend? (If you don't know what the ultimate actual binary code is, how could you know what the computer is _actually_ doing?) My experience, in fact, is that the higher the language level -- such as that possible with Mathematica or APL or J -- then the easier it is to master these essentials. All too often I have seen students unable to ascend to effective programming with a higher-level language if their minds were rotted by the first exposure being to too low-level a language. (And that is despite my personal learning path that ascended from the ridiculous to the sublime.) --- Murray Eisenberg murray@math.umass.edu Mathematics & Statistics Dept. Lederle Graduate Research Tower phone 413 549-1020 (H) University of Massachusetts 413 545-2838 (W) 710 North Pleasant Street fax 413 545-1801 Amherst, MA 01003-9305
[toc] | [prev] | [next] | [standalone]
| From | Richard Fateman <fateman@cs.berkeley.edu> |
|---|---|
| Date | 2013-01-17 04:14 +0000 |
| Message-ID | <kd7tra$q33$1@smc.vnet.net> |
| In reply to | #13161 |
On 1/15/2013 10:39 PM, Murray Eisenberg wrote: > On Jan 14, 2013, at 11:31 PM, David Bailey <dave@removedbailey.co.uk.math.umass.edu> wrote: > >> I do tend to agree that teaching Mathematica as a first programming >> language, would be a bad idea, because so much happens behind the scene >> - for example the way in which multiple definitions for a function get >> reordered to improve efficiency. I would imagine that some students >> would get a hazy idea of what the were asking the computer to do, or how >> expensive it might be. > > > It all depends on just what you want somebody to accomplish when learning his/her first programming language. There are several issues here. For a starter, 4-year colleges generally do not offer credit for "a course to teach you to program in language X" in a department of computer science. There may be such courses in physics, statistics, etc departments, but this should be classified as a utility course, akin to "how to use the microwave oven in the lunchroom". An introductory computer science course, which probably will incidentally teach the fundamentals of some programming language, would normally be concerned with questions like "what is it that a computer can do, and how". And "what is the relationship of a programming language to a computer?" Certainly, for a curious mind, it is natural to ask how a computer, a machine which one is told can only add, compare, branch (or whatever), can read a program in Java, C, Mathematica, Lisp etc, and interpret this in some predetermined way. This is what makes SICP so interesting. It won't tell you the shortest route to getting a web page running. Who needs to know anything about anything if you can use PHP or Ruby on Rails. When I taught a course to Freshman that involved computer algebra systems, they were not curious about how to break up programs etc. They wanted to know how the Risch Integration algorithm worked and why their own calculus course didn't include it. I've flushed your notes because my mail sending programming says it will not do lines more than 79 characters, and your message has them..
[toc] | [prev] | [next] | [standalone]
| From | David Bailey <dave@removedbailey.co.uk> |
|---|---|
| Date | 2013-01-17 04:14 +0000 |
| Message-ID | <kd7trq$q3b$1@smc.vnet.net> |
| In reply to | #13161 |
On 16/01/2013 06:39, Murray Eisenberg wrote: > > > > It all depends on just what you want somebody to accomplish when learning his/her first programming language. This is, of course, the key. However, I would hope that at least some students will continuw to emerge with an understanding of what goes on at the bottom level - otherwise we are getting cut off from the roots of a vital technology. > > I've thought about that a lot over the some 30 years that I taught FORTRAN, Pascal, APL, J, and Mathematica in university math courses. (My very first programming language was Assembly for a Univac I, followed shortly by octal-coded machine instructions for a paper-tape input computer, and then FORTRAN II -- all while I was an undergraduate. A decade later, BASIC, APL, Pascal; subsequently, J and Mathematica. Even later, a smattering of C, Perl, Python, Java. I've even dabbled a tiny bit with Forth and Snobol.) > Wow - you sound a bit like me, I didn't touch Perl, Forth, APL, or Python (except to discover I hated them), but I did a lot with LISP and Prolog, and a few more obscure languages - Algol 68, and Coral! > So what is essential for a first exposure to programming? To me, the essentials are: > > (0) Understanding carefully what the problem is, including what is given and what is to be found. > > (1) Identifying the objects (data) and what is to be done with them (operations, functions, procedures). > > (2) Breaking up a larger problem into its constituent parts. > > (3) Isolating the big ideas from the smaller technical points. > > (4) Expressing things within the constraints of a precise syntax. > > (5) Suitably modularizing the code in accordance with (2) and (3). > > (6) Making the code readable through judicious choice of names along with sufficient but non-redundant comments. > > (7) Making the code maintainable -- by the original author or others. > > (8) Being able to test and debug the code. > > (9) For numerical work, understanding and coping with roundoff and other errors due to the limitations of finite precision. > > (10) Recognizing when and knowing how to code an operation repetitively -- whether explicitly (iteratively or recursively) or implicitly (functionally). > > (11) Recognizing when and knowing how to express conditionals (whether via an explicit If, Which, etc., or instead as is possible in Mathematica, separate definitions of the same function for different cases). > > Must the first-language learner get closer what s/he is "asking the computer to do" than might be the case with Mathematica? If so, how should you reasonably decide how deep to descend? (If you don't know what the ultimate actual binary code is, how could you know what the computer is _actually_ doing?) > > My experience, in fact, is that the higher the language level -- such as that possible with Mathematica or APL or J -- then the easier it is to master these essentials. All too often I have seen students unable to ascend to effective programming with a higher-level language if their minds were rotted by the first exposure being to too low-level a language. (And that is despite my personal learning path that ascended from the ridiculous to the sublime.) > I used to work in compiler development, so I have been right down to the bit-level in a very serious way. However, even that isn't the end nowadays, because computers contain hidden layers of microcode, etc. For example, the 32-bit Intel architecture has been largely the same across many processors over the years, while the insides have changed radically. Your list is fine, but it doesn't seem to address the issue of code efficiency. For some areas, this is vital (and for others it is irrelevant), and it is not uncommon for someone to test out an idea on a small dataset, without any realisation that it will not scale well to real world problems. Sometimes that is a question of the choice of algorithm, but Mathematica has a lot of subtle issues (such as not Appending to long lists) that aren't true in other languages. Also rules like "functional constructs are more efficient", are only true because of the way Mathematica is implemented - they are not universal truths. David Bailey http://www.dbaileyconsultancy.co.uk
[toc] | [prev] | [next] | [standalone]
| From | Richard Fateman <fateman@eecs.berkeley.edu> |
|---|---|
| Date | 2013-01-18 05:50 +0000 |
| Message-ID | <kdanr4$3e1$1@smc.vnet.net> |
| In reply to | #13161 |
On 1/16/2013 8:54 PM, W Craig Carter wrote: > On Jan 17, 13, at 12:14 PM, Richard Fateman wrote: > >> On 1/15/2013 10:39 PM, Murray Eisenberg wrote: >>> On Jan 14, 2013, at 11:31 PM, David Bailey <dave@removedbailey.co.uk.math.umass.edu> wrote: >>> >>> >>> >>> It all depends on just what you want somebody to accomplish when learning his/her first programming language. >> There are several issues here. >> For a starter, 4-year colleges generally do not offer credit for "a >> course to teach you to program in language X" in a department of >> computer science. >> There may be such courses in physics, statistics, etc departments, >> but this should be classified as a utility course, akin to "how to use >> the microwave oven in the lunchroom". > > Was this analogy meant to be pejorative? Not especially,. just illustrative. I have no problem with physicists (etc) teaching each other programming, as long as they don't think that they know "computer science" as a consequence of knowing a little FORTRAN. I have met physical scientists who assume that a computer scientist knows LOTS of programming languages, not just FORTRAN. I have seen programming languages designed by physicists who tried to learn by osmosis, but made some fundamental errors. Microwave ovens can be fairly complicated, with power settings, times, and extra features like convection, buttons for defrost, and "popcorn".... But I would not confuse "how to use a microwave" with general knowledge of electromagnetism, signal generation and propagation in the microwave part of the spectrum, and biological effects of such. Anyway, that's the idea. > > I teach such a course and receive current and a posteriori feedback on the benefits of learning to rapidly construct a model, compute it, and visualize it. I hope it is not called Introduction to Computer Science. > Equally important, the students learn math and a means to acquire more math on their own---and quickly. So the course is something like "Introduction to Mathematical Modeling in Material Science" perhaps "... with an introduction to programming language X...". That's fine. There's a course at UC Berkeley in Engineering E 7, which teaches simple numerical analysis, introduces modeling etc. Its relation to the computer science curriculum tends to evolve, partly because engineers think that their students don't need to know more about computers than they do. > I teach fundamental concepts of my discipline by using novice programming, numerical analysis, symbolic algebra: voila, canonical discipline knowledge and transferable skills in one course. eh,sounds like E7 except last I heard, it didn't include symbolic algebra, but made some fuss about object-oriented programming. > > The "microwave usage" analogy diminishes the importance of an indispensable tool to an applied scientist or engineer. I think a microwave oven is indispensable too :) > > I have physical science colleagues who consider programing and linear algebra to be superfluous because they use spreadsheet tools. I think that is justifiable, for some people. Many mathematicians consider computers quite worthless because to them, mathematics has to do with creating proofs, and computers (mostly) don't do this. Some professional engineers lived their whole careers using tables in handbooks. Times change, of course, but not all engineers do terribly novel things. It is unlikely that an engineer will be called upon to write one, much less a collection, of different sorting programs. So a course on algorithms that provided such an experience would seem to be, vocationally speaking, unnecessary. Though the exercise might be intellectually enlightening nevertheless. > I consider their myopic view marginally more perverse than (paraphrasing) `classifying computer language tools as microwave ovens for those who don't build microwaves or understand their operating principles'. It is too late at night for me to figure this out, but I suspect we are agreeing, mostly.. RJF
[toc] | [prev] | [next] | [standalone]
| From | W Craig Carter <ccarter@MIT.EDU> |
|---|---|
| Date | 2013-01-18 05:50 +0000 |
| Message-ID | <kdanrf$3ea$1@smc.vnet.net> |
| In reply to | #13161 |
On Jan 17, 13, at 13:50 PM, Richard Fateman wrote:
> On 1/16/2013 8:54 PM, W Craig Carter wrote:
>> On Jan 17, 13, at 12:14 PM, Richard Fateman wrote:
>>>>
>>> There may be such courses in physics, statistics, etc departments,
>>> but this should be classified as a utility course, akin to "how to use
>>> the microwave oven in the lunchroom".
>>
>> Was this analogy meant to be pejorative?
> Not especially,. just illustrative.
OK, no harm, no foul. I think we nearly agree. There are certainly parts of "real computer science" that would benefit engineers. I don't mistake what I do as "real computer science" or "real mathematics". My only goal is to teach the students how to think. I find Mathematica an excellent tool to do that, and they acquire useful tools in the process. I am confident that I am doing the right thing.
I spend far too much time defending this position; so I am sensitized to the microwave comment. Please consider the comment below on this.
>
> I have met physical scientists who assume that a computer scientist knows LOTS of
> programming languages, not just FORTRAN. I have seen programming languages designed
> by physicists who tried to learn by osmosis, but made some fundamental errors.
True. I agree that most of my colleagues are unaware of large difference between computer science and programming in a language. I imagine this is a source of frustration to many computer scientists. However, there are many examples of the converse misunderstandings as well.
>>
> I hope it is not called Introduction to Computer Science.
I have no illusions that I'm teaching computer science. However, I am pleased that I can explain a Hamming distance metric and the students can immediately see the utility of the concept, but I don't expect them to construct an efficient algorithm to compute a metric. However, I would be very pleased if my applied science students tried to construct an algorithm---however inefficient---out of mere curiousity.
>> Equally important, the students learn math and a means to acquire more math on their own---and quickly.
> So the course is something like "Introduction to Mathematical Modeling in Material Science"
> perhaps "... with an introduction to programming language X...".
Correct. I confess to the sin of pride with the content of that course. I believe every applied science department should have one like it. Linear algebra isn't required for engineers at my institution. I consider this extremely short sighted. However, to convince a curriculum committee to agree, I had to make the course serve multiple purposes---including an introduction to linear algebra.
>> I teach fundamental concepts of my discipline by using novice programming, numerical analysis, symbolic algebra: voila, canonical discipline knowledge and transferable skills in one course.
> eh,sounds like E7 except last I heard, it didn't include symbolic algebra, but
> made some fuss about object-oriented programming.
No such fuss in my case: it pleases me when see they difference between Cos[Pi] and Cos[ArcCos[-1.0]] and when to use one or the other. I realize there are finer points of interval arithmetic that I don't comprehend as fully as I'd like, but I don't think this should disqualify me from teaching the nature of precision and symbolic computation.
>
>>
>> The "microwave usage" analogy diminishes the importance of an indispensable tool to an applied scientist or engineer.
> I think a microwave oven is indispensable too :)
Indeed--my life would be much richer without microwave ovens; but that wealth was purchased with no effort whatsoever and I don't have any transferable skills besides those which transfer between popcorn and frozen dinners.
The intellectual benefits of learning how to use a microwave shouldn't be compared to those of learning a useful tool with utilities beyond what the manufacturer imagined.
>>
>> I have physical science colleagues who consider programing and linear algebra to be superfluous because they use spreadsheet tools.
> I think that is justifiable, for some people. Many mathematicians consider computers quite worthless
> because to them, mathematics has to do with creating proofs, and computers (mostly) don't do this.
That's a fairly broad brush, but OK. However, I consider that inflexible viewpoint ("worthless") as anything but shameful intolerance for that group of many.
>
> Some professional engineers lived their whole careers using tables in handbooks. Times change,
> of course, but not all engineers do terribly novel things.
Agreed. I imagine (hope) that you might agree that description is not limited to engineers.
>
> It is unlikely that an engineer will be called upon to write one, much less a collection, of
> different sorting programs. So a course on algorithms that provided such an experience would
> seem to be, vocationally speaking, unnecessary. Though the exercise might be intellectually enlightening
> nevertheless.
My opinion is that distinctions between computer scientists, engineers, mathematicians, physicists, etc continue to become much more diffuse; this makes me optimistic---but it also might make me uninformed.
I am not sure if you would classify yourself as a computer scientist or as a mathematician--I would guess you would be more content not to classify yourself within one discipline at all---and you may object with others trying to classify your contributions as one or the other?
[toc] | [prev] | [next] | [standalone]
| From | Murray Eisenberg <murray@math.umass.edu> |
|---|---|
| Date | 2013-01-18 05:50 +0000 |
| Message-ID | <kdanrv$3el$1@smc.vnet.net> |
| In reply to | #13161 |
I did debate with myself whether to include efficiency in the desiderata for a first exposure to programming. Had I included it, it might have been expressed like this: (12) Considering how memory and time constraints affect the programming approach. Another possible item could be "elegance" -- whatever that is. But I had hoped that points (2)-(7), which address what one might call "clarity" would suffice in that direction. On Jan 16, 2013, at 11:15 PM, David Bailey <dave@removedbailey.co.uk.math.umass.edu> wrote: > On 16/01/2013 06:39, Murray Eisenberg wrote: >> >> >> >> It all depends on just what you want somebody to accomplish when learning his/her first programming language. > This is, of course, the key. However, I would hope that at least some > students will continuw to emerge with an understanding of what goes on > at the bottom level - otherwise we are getting cut off from the roots of > a vital technology. >> >> I've thought about that a lot over the some 30 years that I taught FORTRAN, Pascal, APL, J, and Mathematica in university math courses. (My very first programming language was Assembly for a Univac I, followed shortly by octal-coded machine instructions for a paper-tape input computer, and then FORTRAN II -- all while I was an undergraduate. A decade later, BASIC, APL, Pascal; subsequently, J and Mathematica. Even later, a smattering of C, Perl, Python, Java. I've even dabbled a tiny bit with Forth and Snobol.) >> > Wow - you sound a bit like me, I didn't touch Perl, Forth, APL, or > Python (except to discover I hated them), but I did a lot with LISP and > Prolog, and a few more obscure languages - Algol 68, and Coral! > >> So what is essential for a first exposure to programming? To me, the essentials are: >> >> (0) Understanding carefully what the problem is, including what is given and what is to be found. >> >> (1) Identifying the objects (data) and what is to be done with them (operations, functions, procedures). >> >> (2) Breaking up a larger problem into its constituent parts. >> >> (3) Isolating the big ideas from the smaller technical points. >> >> (4) Expressing things within the constraints of a precise syntax. >> >> (5) Suitably modularizing the code in accordance with (2) and (3). >> >> (6) Making the code readable through judicious choice of names along with sufficient but non-redundant comments. >> >> (7) Making the code maintainable -- by the original author or others. >> >> (8) Being able to test and debug the code. >> >> (9) For numerical work, understanding and coping with roundoff and other errors due to the limitations of finite precision. >> >> (10) Recognizing when and knowing how to code an operation repetitively -- whether explicitly (iteratively or recursively) or implicitly (functionally). >> >> (11) Recognizing when and knowing how to express conditionals (whether via an explicit If, Which, etc., or instead as is possible in Mathematica, separate definitions of the same function for different cases). >> >> Must the first-language learner get closer what s/he is "asking the computer to do" than might be the case with Mathematica? If so, how should you reasonably decide how deep to descend? (If you don't know what the ultimate actual binary code is, how could you know what the computer is _actually_ doing?) >> >> My experience, in fact, is that the higher the language level -- such as that possible with Mathematica or APL or J -- then the easier it is to master these essentials. All too often I have seen students unable to ascend to effective programming with a higher-level language if their minds were rotted by the first exposure being to too low-level a language. (And that is despite my personal learning path that ascended from the ridiculous to the sublime.) >> > I used to work in compiler development, so I have been right down to the > bit-level in a very serious way. However, even that isn't the end > nowadays, because computers contain hidden layers of microcode, etc. For > example, the 32-bit Intel architecture has been largely the same across > many processors over the years, while the insides have changed radically. > > Your list is fine, but it doesn't seem to address the issue of code > efficiency. For some areas, this is vital (and for others it is > irrelevant), and it is not uncommon for someone to test out an idea on a > small dataset, without any realisation that it will not scale well to > real world problems. Sometimes that is a question of the choice of > algorithm, but Mathematica has a lot of subtle issues (such as not > Appending to long lists) that aren't true in other languages. Also rules > like "functional constructs are more efficient", are only true because > of the way Mathematica is implemented - they are not universal truths. > > David Bailey > http://www.dbaileyconsultancy.co.uk --- Murray Eisenberg murray@math.umass.edu Mathematics & Statistics Dept. Lederle Graduate Research Tower phone 413 549-1020 (H) University of Massachusetts 413 545-2838 (W) 710 North Pleasant Street fax 413 545-1801 Amherst, MA 01003-9305
[toc] | [prev] | [next] | [standalone]
| From | Murray Eisenberg <murray@math.umass.edu> |
|---|---|
| Date | 2013-01-18 05:49 +0000 |
| Message-ID | <kdanpn$3d3$1@smc.vnet.net> |
| In reply to | #13161 |
Comments interspersed below. On Jan 16, 2013, at 11:14 PM, Richard Fateman <fateman@cs.berkeley.edu> wrote: > On 1/15/2013 10:39 PM, Murray Eisenberg wrote: >> On Jan 14, 2013, at 11:31 PM, David Bailey <dave@removedbailey.co.uk.math.umass.edu> wrote: >> >>> I do tend to agree that teaching Mathematica as a first programming >>> language, would be a bad idea, because so much happens behind the scene >>> - for example the way in which multiple definitions for a function get >>> reordered to improve efficiency. I would imagine that some students >>> would get a hazy idea of what the were asking the computer to do, or how >>> expensive it might be. >> >> >> It all depends on just what you want somebody to accomplish when learning his/her first programming language. > > There are several issues here. > For a starter, 4-year colleges generally do not offer credit for "a > course to teach you to program in language X" in a department of > computer science. > There may be such courses in physics, statistics, etc departments, > but this should be classified as a utility course, akin to "how to use > the microwave oven in the lunchroom". Yes! Whenever I taught or reviewed a language, it was within a math course, and the purpose was to apply the language to do math. Especially: (a) to better learn the math by "teaching the computer to do it", i.e., start by implementing basic ideas such as an elementary row reduction and build up in stages to more sophisticated things like orthogonal projection and least-squares solutions; (b) to experiment and visualize; and (c ) in the case of a numerical analysis course, to implement the methods, apply them, and try to find out how good the results were. > > > . . . When I taught a course to Freshman that involved computer algebra > systems, they were not curious about how to break up programs etc. > They wanted to know how the Risch Integration algorithm worked and > why their own calculus course didn't include it. Exactly the sort of reaction one can pray to get! (BTW, one of the many texts from which I taught calculus over the years was by Lipman Bers. Contrary to the practice of every other calculus text I encountered, Bers organized the treatment of symbolic integration not by method but rather by form of the integrand -- just the approach that an integration algorithm would typically need to do.) Getting more OT: Another instructive example Frank Wattenberg showed me years ago, for calculus: when finding antiderivatives, eventually one wants to talk about elementary functions not having elementary antiderivatives. A standard example is e^(-x^2/2). And then you ask Mathematica to integrate Exp[-x^2] and -- boom! -- you obtain a constant times Erf[x], a seemingly "closed-form" answer. Then one can get some serious discussion going about what "elementary" and "closed form" mean. --- Murray Eisenberg murray@math.umass.edu Mathematics & Statistics Dept. Lederle Graduate Research Tower phone 413 549-1020 (H) University of Massachusetts 413 5 (W) 710 North Pleasant Street fax 413 545-1801 Amherst, MA 01003-9305
[toc] | [prev] | [next] | [standalone]
Page 1 of 4 [1] 2 3 4 Next page →
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web