| View previous topic :: View next topic |
| Author |
Message |
Herman Rubin Guest
|
Posted: Sun Jun 29, 2008 6:16 am Post subject: Re: Programming skills required by mathematicians? |
|
|
In article <42b587d9-1e0c-4f4a-949f-e695d2923096@w5g2000prd.googlegroups.com>,
Marshall <marshall.spight@gmail.com> wrote:
| Quote: |
On Jun 25, 12:23 pm, hru...@odds.stat.purdue.edu (Herman Rubin) wrote:
In article <fd0e8605-ee29-4365-a130-e0baedb3d...@f63g2000hsf.googlegroups.com>,
translogi <wilem...@googlemail.com> wrote:
I am still a favourite of old fashioned Q basic.
I think it is good to know the basics in a simple way.
It maybe slower than C++ but it is easy.
And you can make very sophisticated programs with it.
[...]
Computers are essentially a fixed program, the
hardware, which then has a small initialized amount
of software, quite variable, which enables it to
try to do what the user wants. Keep this in mind;
understand what the hardware can do, which is
different on different machines, and think in those
terms, not the current poorly designed languages.
Not quite sure what you're saying here. If it's a
warning against basic, then sure. But thinking
in terms of specific machine architecture? That's
virtually never a good idea. Even if you're using
something antique like plain C, you're still a lot
better off than you are with assembly or machine
language. What is "the current poorly designed
languages" supposed to refer to?
|
The current languages do not allow the user to have
full use of the power of the computer; in fact, this
has led to declines in the quality of hardware as
well. A user who thinks that absolute value is as
expensive as a transcendental function will be making
a big mistake, and they are not taught that. Also,
the tricks around gotos slow down the computer; the
computer uses gotos, and the current procedures cause
many oft repeated steps take many times as long because
of the need to use variables instead of keeping the
state of the program just in instruction locations.
Multiple precision arithmetic is difficult because of
the hidden bit in floating point numbers and forced
normalization. Good integer arithmetic does not exist.
One needs to be able to put a list of variables before
the equals sign in a replacement statement; the ways
around it are inefficient.
I believe that one can have a weakly typed with type
override assembler with highly overloaded operators
which will take less than twice the code length as
a HLL; the optimization should be done at this stage,
not at compilation time. There should also be a decent
way of writing macros, with macro "name" not being the
first argument in using it. For example, one might
define subtraction for a new type; in that case, one
would define the =- macro to get x=y-z. BTW, this is
how the assembler instruction should look; no conversion,
and type override available. The user should know when
to "mix types"; it is not machine independent, but it is
important. Instead of trying to make things foolproof,
make it powerful; as Einstein said, nature is winning in
producing better fools.
There is more, but this should be an indication.
--
This address is for information only. I do not claim that these views
are those of the Statistics Department or of Purdue University.
Herman Rubin, Department of Statistics, Purdue University
hrubin@stat.purdue.edu Phone: (765)494-6054 FAX: (765)494-0558 |
|
| Back to top |
|
 |
| |
Ads |
Advertising
Sponsor
|
|
Jason Glumidge Guest
|
Posted: Mon Jun 30, 2008 2:25 am Post subject: Re: Programming skills required by mathematicians? |
|
|
On Jun 27, 6:59 am, Marshall <marshall.spi...@gmail.com> wrote:
| Quote: |
On Jun 26, 8:35 pm, Phil Hobbs
pcdhSpamMeSensel...@electrooptical.net> wrote:
Marshall wrote:
On Jun 26, 2:14 pm, Phil Hobbs <pcdhSpamMeSensel...@pergamos.net
wrote:
Frederick Williams wrote:
Phil Hobbs wrote:
I agree that C++ is a good choice.
You must be joking!
Why? I taught myself C++, and have used it to build things like a
big-iron clusterized electromagnetic simulator. The combination of
C-like performance with the ability to manage complexity that comes with
OO programming is very flexible and powerful.
Or did I miss something ultra-important?
You did, actually: the existence of other languages that are better
at those things.
So in other words, "No."
If you are happy with where you are, and are not concerned
about learning anything beyond what you already know,
then by all means continue as you have been.
If you are going to advise other people, then doing so from
a place of ignorance is being less than fully responsible
Marshall
|
This seems a little harsh. Games are all coded in C++ (albeit mostly
with a script wrapper layered on top), and I'd warrant they have the
majority of the top coders as their developers as well as the most
math going on, so there must be something going for c++ somewhere.
C++ is at the very least a good language to have under your belt, and
I find it surprising that anyone would think otherwise. Certainly it
has limitations - even with boost it lacks Java's library collection
and it can be decidedly idiosyncratic. However its low-level nature
can actually be a good step to learning whats going on under the hood
in general, and it is both powerful and widely supported (and one
should not ignore the importance of support to those just beginning).
Perhaps more than anything C++ templating functionality is unmatched
in imperative languages (with Java generics merely providing dynamic
casting), pushing forward techniques such as Alexandrescu's policy
based approach.
To be honest many top-notch Java coders I know are bailing from Java's
verbosity and clunkiness in favor of other languages with functional
features built upon the JVM (such as Scala say). I'd personally
recommend the OP get 101's in C++, Java, Python and Haskell and then
continue to learn whichever he finds a preference for. Lisp is worth
reading about for educational purposes in my book, and for a
mathematician list comprehension syntax in all languages is worth
investigating. I would also however echo your sentiments that the OP
should actively investigate non-imperative approaches. |
|
| Back to top |
|
 |
| |
Ads |
Advertising
Sponsor
|
|
rjf Guest
|
Posted: Mon Jun 30, 2008 2:54 am Post subject: Re: Programming skills required by mathematicians? |
|
|
On Jun 29, 7:25 pm, Jason Glumidge <Jason.Glumi...@gmail.com> wrote:
....
| Quote: |
This seems a little harsh. Games are all coded in C++ (albeit mostly
with a script wrapper layered on top), and I'd warrant they have the
majority of the top coders as their developers as well as the most
math going on, so there must be something going for c++ somewhere.
See |
http://www.franz.com/success/customer_apps/animation_graphics/naughtydog.lhtml
though the lisp/object oriented stuff is not all there is.
If the original poster was looking past college to become a video game
programmer, he probably should reconsider majoring in math. Or even
going to college. At least at my university, people don't get college
credit for learning a programming language. Or maybe they would get 1
unit, for their first language only. (15 units = one semester full
load). So taking courses in C, C++, Java, ..., just to learn a
language is not college work.
The discussion of what programming language to learn, even given the
context provided by the OP, is bound to be unproductive.
But for the unaware, consider this information from the (US) bureau of
labor statistics...
Mathematicians held about 3,000 jobs in 2006. Many people with
mathematical backgrounds also worked in other occupations. For
example, there were about 54,000 jobs as postsecondary mathematical
science teachers in 2006.
Median annual earnings of mathematicians were $86,930 in May 2006. The
middle 50 percent earned between $62,970 and $106,250. The lowest 10
percent had earnings of less than $43,500, while the highest 10
percent earned more than $132,190.30
Job competition will remain keen because employment in this occupation
is relatively small and few new jobs are expected. Master’s degree and
Ph.D. holders with a strong background in mathematics and a related
discipline, such as engineering or computer science, and who apply
mathematical theory to real-world problems will have the best job
prospects in related occupations.
http://www.bls.gov/oco/ocos043.htm
Just to pick another occupation, consider
Dental hygienists held about 167,000 jobs in 2006. Because multiple
job holding is common in this field, the number of jobs exceeds the
number of hygienists. Almost all jobs for dental hygienists were in
offices of dentists. A very small number worked for employment
services, offices of physicians, or other industries.
Median hourly earnings of dental hygienists were $30.19 in May 2006.
The middle 50 percent earned between $24.63 and $35.67 an hour. The
lowest 10 percent earned less than $19.45, and the highest 10 percent
earned more than $41.60 an hour.
[I think that $35.67 / hour is about $74,000 a year].
Job prospects are expected to remain excellent. Older dentists, who
have been less likely to employ dental hygienists, are leaving the
occupation and will be replaced by recent graduates, who are more
likely to employ one or more hygienists.
http://www.bls.gov/oco/ocos097.htm
............
So if you want to be a mathematician, beware. Learning math is good
for lots of things and can be lots of fun, but "being a mathematician"
may be unrealistic.
Also, to contribute to the general muddle, feel free to see why C is
not my favorite language,
www.cs.berkeley.edu/~fateman/papers/software.pdf
Richard Fateman, Prof. Emeritus, UC Berkeley |
|
| Back to top |
|
 |
| |
Ads |
Advertising
Sponsor
|
|
Marshall Guest
|
Posted: Mon Jun 30, 2008 7:14 am Post subject: Re: Programming skills required by mathematicians? |
|
|
On Jun 29, 7:25 pm, Jason Glumidge <Jason.Glumi...@gmail.com> wrote:
| Quote: |
On Jun 27, 6:59 am, Marshall <marshall.spi...@gmail.com> wrote:
On Jun 26, 8:35 pm, Phil Hobbs
pcdhSpamMeSensel...@electrooptical.net> wrote:
Marshall wrote:
On Jun 26, 2:14 pm, Phil Hobbs <pcdhSpamMeSensel...@pergamos.net
wrote:
Frederick Williams wrote:
Phil Hobbs wrote:
I agree that C++ is a good choice.
You must be joking!
Why? I taught myself C++, and have used it to build things like a
big-iron clusterized electromagnetic simulator. The combination of
C-like performance with the ability to manage complexity that comes with
OO programming is very flexible and powerful.
Or did I miss something ultra-important?
You did, actually: the existence of other languages that are better
at those things.
So in other words, "No."
If you are happy with where you are, and are not concerned
about learning anything beyond what you already know,
then by all means continue as you have been.
If you are going to advise other people, then doing so from
a place of ignorance is being less than fully responsible
This seems a little harsh.
|
I stand by my statement. A person who has taught himself
a programming language and advocates not learning anything
new is in no position to provide responsible answers to
someone asking about the relative merits of different languages
for a particular application. One absolutely cannot *compare*
different things if one only has information about one of them!
| Quote: |
Games are all coded in C++ (albeit mostly
with a script wrapper layered on top), and I'd warrant they have the
majority of the top coders as their developers as well as the most
math going on, so there must be something going for c++ somewhere.
|
I am sorry to inform you that the game industry is a rather small
one; still less than 10 billion dollars annually. The suggestion that
they have most of the top coders is unlikely. For while, say, 3d
graphics is indeed math-intensive, so are things like financial
software, web search, operations research algorithms, etc.
and these make a lot more money.
| Quote: |
C++ is at the very least a good language to have under your belt, and
I find it surprising that anyone would think otherwise.
|
There are plenty of people who despise C++, and some of
them even have a decent argument. I do not myself despise
it, although I tend to avoid it where possible.
| Quote: |
Certainly it
has limitations - even with boost it lacks Java's library collection
and it can be decidedly idiosyncratic. However its low-level nature
can actually be a good step to learning whats going on under the hood
in general, and it is both powerful and widely supported (and one
should not ignore the importance of support to those just beginning).
Perhaps more than anything C++ templating functionality is unmatched
in imperative languages (with Java generics merely providing dynamic
casting), pushing forward techniques such as Alexandrescu's policy
based approach.
|
I'd agree with almost all of this, especially the part about
templates.
| Quote: |
To be honest many top-notch Java coders I know are bailing from Java's
verbosity and clunkiness in favor of other languages with functional
features built upon the JVM (such as Scala say). I'd personally
recommend the OP get 101's in C++, Java, Python and Haskell and then
continue to learn whichever he finds a preference for. Lisp is worth
reading about for educational purposes in my book, and for a
mathematician list comprehension syntax in all languages is worth
investigating. I would also however echo your sentiments that the OP
should actively investigate non-imperative approaches.
|
I'd mostly agree with this too. (I haven't personally seen anyone
jumping to Scala, but it does seem to be picking up a bit of steam.)
Marshall |
|
| Back to top |
|
 |
| |
Ads |
Advertising
Sponsor
|
|
Han de Bruijn Guest
|
Posted: Mon Jun 30, 2008 11:00 am Post subject: Re: Programming skills required by mathematicians? |
|
|
Herman Rubin wrote:
| Quote: |
In article <a9c2$48633884$82a1e228$15774@news2.tudelft.nl>,
Han de Bruijn <Han.deBruijn@DTO.TUDelft.NL> wrote:
Herman Rubin wrote:
Computers are essentially a fixed program, the
hardware, which then has a small initialized amount
of software, quite variable, which enables it to
try to do what the user wants. Keep this in mind;
understand what the hardware can do, which is
different on different machines, and think in those
terms, not the current poorly designed languages.
Guess you're still thinking of an IBM mainframe with APL on it ?
No, this applies to all computers and all languages.
In fact, one would have to work hard to do anything
non-trivial with APL, but it can be done. You need
to use conditionals and recursion.
Think of a Turing machine. Any sufficiently complicated
calculator is capable of simulating a universal Turing
machine to the extent that its memory will hold out.
|
Sorry, Herman. I really don't get the point you might have.
Han de Bruijn |
|
| Back to top |
|
 |
| |
Ads |
Advertising
Sponsor
|
|
Han de Bruijn Guest
|
Posted: Mon Jun 30, 2008 11:00 am Post subject: Re: Programming skills required by mathematicians? |
|
|
Marshall wrote:
| Quote: |
On Jun 25, 12:23 pm, hru...@odds.stat.purdue.edu (Herman Rubin) wrote:
In article <fd0e8605-ee29-4365-a130-e0baedb3d...@f63g2000hsf.googlegroups.com>,
translogi <wilem...@googlemail.com> wrote:
I am still a favourite of old fashioned Q basic.
I think it is good to know the basics in a simple way.
It maybe slower than C++ but it is easy.
And you can make very sophisticated programs with it.
[...]
Computers are essentially a fixed program, the
hardware, which then has a small initialized amount
of software, quite variable, which enables it to
try to do what the user wants. Keep this in mind;
understand what the hardware can do, which is
different on different machines, and think in those
terms, not the current poorly designed languages.
Not quite sure what you're saying here. If it's a
warning against basic, then sure. But thinking
in terms of specific machine architecture? That's
virtually never a good idea. Even if you're using
something antique like plain C, you're still a lot
better off than you are with assembly or machine
language. What is "the current poorly designed
languages" supposed to refer to?
|
Knowing Herman Rubin a little bit, I just think he feels a bit slippery
here, though he won't admit. H.R. isn't much of a computer minded person
and he'd rather formulate his theoretical considerations on the backside
of an envelope, hand written, I suppose. (Not that I have any objections
against formulas written by hand ..)
Han de Bruijn |
|
| Back to top |
|
 |
| |
Ads |
Advertising
Sponsor
|
|
Jason Glumidge Guest
|
Posted: Mon Jun 30, 2008 12:14 pm Post subject: Re: Programming skills required by mathematicians? |
|
|
On Jun 30, 8:14 am, Marshall <marshall.spi...@gmail.com> wrote:
| Quote: |
On Jun 29, 7:25 pm, Jason Glumidge <Jason.Glumi...@gmail.com> wrote:
On Jun 27, 6:59 am, Marshall <marshall.spi...@gmail.com> wrote:
On Jun 26, 8:35 pm, Phil Hobbs
pcdhSpamMeSensel...@electrooptical.net> wrote:
Marshall wrote:
On Jun 26, 2:14 pm, Phil Hobbs <pcdhSpamMeSensel...@pergamos.net
wrote:
Frederick Williams wrote:
Phil Hobbs wrote:
I agree that C++ is a good choice.
You must be joking!
Why? I taught myself C++, and have used it to build things like a
big-iron clusterized electromagnetic simulator. The combination of
C-like performance with the ability to manage complexity that comes with
OO programming is very flexible and powerful.
Or did I miss something ultra-important?
You did, actually: the existence of other languages that are better
at those things.
So in other words, "No."
If you are happy with where you are, and are not concerned
about learning anything beyond what you already know,
then by all means continue as you have been.
If you are going to advise other people, then doing so from
a place of ignorance is being less than fully responsible
This seems a little harsh.
I stand by my statement. A person who has taught himself
a programming language and advocates not learning anything
new is in no position to provide responsible answers to
someone asking about the relative merits of different languages
for a particular application. One absolutely cannot *compare*
different things if one only has information about one of them!
|
Absolutely agree. However, the post your replied to didn't seem to say
that c++ was the one and only, but merely it would be a good language
for a mathematician to know. I certainly wouldn't want to see the OP
put off c++. I know several mathematicians effectively using boost
math libraries, and with boost graph books on their shelves for
example. C++ main problem is lack of libraries, but for mathematics
its not half bad.
| Quote: |
Games are all coded in C++ (albeit mostly
with a script wrapper layered on top), and I'd warrant they have the
majority of the top coders as their developers as well as the most
math going on, so there must be something going for c++ somewhere.
I am sorry to inform you that the game industry is a rather small
one; still less than 10 billion dollars annually.
|
Don't be sorry. All information is good.
| Quote: |
The suggestion that they have most of the top coders is unlikely.
|
It is my experience that the field has a far higher percentage of
guru's than business consultancy/development, and their projects are
particularly intensive in terms of coordination (with a high number of
moving parts). It would be brave to insist they are wrong to be using c
++ because there are other languages all better at individual things.
I stand by the fact that c++ is a good language to have under your
belt.
| Quote: |
For while, say, 3d
graphics is indeed math-intensive, so are things like financial
software, web search, operations research algorithms, etc.
and these make a lot more money.
|
Certainly true. Are you suggesting those examples don't use c++? (I
personally have no idea but I imagine many do - google certainly have
a very large c++ codebase).
| Quote: |
C++ is at the very least a good language to have under your belt, and
I find it surprising that anyone would think otherwise.
There are plenty of people who despise C++, and some of
them even have a decent argument. I do not myself despise
it, although I tend to avoid it where possible.
|
There are more people who despise Java in my experience. But then,
more fool them for getting that worked up about any language -
languages are just tools and you should pick the best one for the job
at hand. Often that can be c++ (for example, it is in my opinion the
easiest language to write a bnf parser in), but I'm certainly no
stroustrop obsessive (do they exist?). I think we'd agree - horses for
courses.
| Quote: |
Certainly it
has limitations - even with boost it lacks Java's library collection
and it can be decidedly idiosyncratic. However its low-level nature
can actually be a good step to learning whats going on under the hood
in general, and it is both powerful and widely supported (and one
should not ignore the importance of support to those just beginning).
Perhaps more than anything C++ templating functionality is unmatched
in imperative languages (with Java generics merely providing dynamic
casting), pushing forward techniques such as Alexandrescu's policy
based approach.
I'd agree with almost all of this, especially the part about
templates.
To be honest many top-notch Java coders I know are bailing from Java's
verbosity and clunkiness in favor of other languages with functional
features built upon the JVM (such as Scala say). I'd personally
recommend the OP get 101's in C++, Java, Python and Haskell and then
continue to learn whichever he finds a preference for. Lisp is worth
reading about for educational purposes in my book, and for a
mathematician list comprehension syntax in all languages is worth
investigating. I would also however echo your sentiments that the OP
should actively investigate non-imperative approaches.
I'd mostly agree with this too. (I haven't personally seen anyone
jumping to Scala, but it does seem to be picking up a bit of steam.)
Marshall |
|
|
| Back to top |
|
 |
| |
Ads |
Advertising
Sponsor
|
|
aruzinsky Guest
|
Posted: Tue Jul 01, 2008 3:55 pm Post subject: Re: Programming skills required by mathematicians? |
|
|
On Jun 25, 2:40 am, rAgAv <ragav.pa...@googlemail.com> wrote:
| Quote: |
Hello,
I'm a highschool graduate and I'm going to major in Mathematics this
Fall. I would like to have a foundation in programming so that it
would be useful in my later career as a mathematician with interests
in logic, numerical analysis, formal systems and that sort.
I don't know enough technicalities to seek the right sort of
programming that I should learn now. I wish to hear advice on what
sort of programming skills a pure mathematician would find useful.
Regards.
PS - At the moment, I know only the basics of C++.
|
Beats me. What would a "pure mathematician" do with computer
programming? As an EE grad student, my thesis adviser was from the
math department and taught a graduate class on numerical analysis. He
authored papers mostly on finite element analysis of fluid flow. I
always thought of him as an applied mathematician. The other math
professors that I knew only used a computer for word processing.
If you were an "applied mathematician," I would recommend Fortran and
Algol only because there are many legacy programs written in these
languages. In particular, the Collected Algorithms from ACM Vol I to
III are mostly in Algol and Fortran. |
|
| Back to top |
|
 |
| |
Ads |
Advertising
Sponsor
|
|
Marshall Guest
|
Posted: Tue Jul 01, 2008 5:46 pm Post subject: Re: Programming skills required by mathematicians? |
|
|
On Jul 1, 7:40 am, hru...@odds.stat.purdue.edu (Herman Rubin) wrote:
| Quote: |
In article <ddfb7$48688db5$82a1e228$25...@news1.tudelft.nl>,
I have programmed in Fortran, C, and assembler for
different machines.
|
Yes, those are sure good ones. Fond memories. Have
you had a chance to work with any of the languages
that have come out in the last 35 years? Some of them
are quite good.
| Quote: |
I am quite aware of even the
fact that efficiency for subroutines requires taking
into account the differences in the different machines,
and I have also stated that I can see how to produce
a somewhat high level assembler language easy to use.
|
Certainly high level assembler is easier to use
than low level assembler. Or machine language. But
it will be harder to use than pretty much anything else.
| Quote: |
Those who think HLLs are such a great idea, here is a
challenge. The function I am giving arises naturally,
and it is quite difficult to do EFFICIENTLY in any HLL.
|
One might have an application that has to respond in
such-and-such a way within x number of milliseconds.
But "efficiency" by itself is not a goal for software
development. It might be a means to an end, but never
a goal in its own right.
| Quote: |
Let x be a positive real number, whose binary expansion
is x = \sum a_i/2^i, a_i = 0 or 1. Then
f(x) = \sum i*a_i/2^i.
I have done some work on methods of generating non-uniform
random variables from uniform bits. There are some technical
reports available from the Purdue Statistics Department.
Among them are some I call "infinite precision", in that
no computer roundoff is involved. The easiest one of these
is to generate the density 2x from 0 to 1. The entire
algorithm is
I = distance to the first 1 in a random bit stream;
discard this part of the bit stream
X = U with the I-th bit after the binary point
changed to 1.
Alas, few of these are efficient, except possibly on an FPGA,
but the amount of work is finite random for all distributions
in any number of dimensions with lower semi-continuous density.
I have a recent paper with Brad Johnson on acceptance-replacement
generation of exponential and normal random variables, using
exponentials to test and reuse of successful test exponentials.
These vectorize or parallelize well if one changes the "control"
part of the algorithm somewhat, and that consideration also went
into the design of the algorithm.
|
So, how many times is this code going to get executed, and
in what application, and in what context? Unless the answers
are severe, the correct course of action is to code it in
the most straightforward way and forget it.
| Quote: |
I do know something about getting the power of the machine, and
doing operations beyond the low precision hardware. Even if only
partial, there should be a convenient way of including assembler
instructions in a program without losing "optimization"; I have
done that on the CYBER 205. I have also in my files a design for
a decent quick assembler for the 780; I cannot find what I did
on the 205, but I remember some of it, including the most complicated
single one.
|
I never worked with the CYBER, but I did a lot of coding in
Fortran on the good ol' 780. But you do know, don't you, that
those days are gone? Not only are those machines obsolete,
but the companies that made them are largely forgotten.
I'm sure there are people reading this who have never heard
of Control Data because they were born after it ceased to
be a computer company. DEC was acquired by a bigger
fish ten years ago which was then itself consumed by an
even larger fish. Today my iPhone has more than 100 times
the computing power of a 780.
The idea of assembly code inline in high level code made
sense in the 1980s but not since. The idea of hand-coded
assembly routines for speed made a lot of sense in the
1990s, for performance-critical inner loops anyway. There
are still a few scant places where that idea makes sense,
but they are getting fewer and fewer. It is harder every
year to outperform the compiler, and there is less reason
every year to try.
I used to write assembly code for some different Adobe
apps in the early 1990s: Photoshop and Premiere. The
processor being targeted was the 486, and there was
a nice chart you could flip through and see how many
cycles each instruction was. You could come up with
different approaches, sum up the cycle count, and
compare.
When the Pentium came out, that got a lot harder.
Now there was a pipeline, and the cycle count wasn't
so straightforward. You might be able to pair these
two instructions, or not.
These days the situation is ridiculous, with very long
pipelines, multiple execution units, etc. etc. and you
can't even *get* a chart.
| Quote: |
One danger of HLLs is that the user has no idea
of how long something will take.
|
That's just simply not true. Languages like C++ and
Java have quite transparent performance models; in
fact this may even be a good part of why they're
so successful. Even when using something wildly
abstract like SQL, one can still get an execution plan
out of the engine, and do various tweaks to change
it. Not that one ever has much need to.
| Quote: |
As for gotos, I find them easy to use,
and spaghetti code is best for spaghetti algorithms.
|
Sure, gotos are easy to write, but what's usually important
for code is that it be easy to read and easy to maintain,
and gotos are anathema to that.
Marshall |
|
| Back to top |
|
 |
| |
Ads |
Advertising
Sponsor
|
|
Herman Rubin Guest
|
Posted: Tue Jul 01, 2008 7:40 pm Post subject: Re: Programming skills required by mathematicians? |
|
|
In article <ddfb7$48688db5$82a1e228$25697@news1.tudelft.nl>,
Han de Bruijn <Han.deBruijn@DTO.TUDelft.NL> wrote:
| Quote: |
Marshall wrote:
On Jun 25, 12:23 pm, hru...@odds.stat.purdue.edu (Herman Rubin) wrote:
In article <fd0e8605-ee29-4365-a130-e0baedb3d...@f63g2000hsf.googlegroups.com>,
translogi <wilem...@googlemail.com> wrote:
|
[...]
| Quote: |
Computers are essentially a fixed program, the
hardware, which then has a small initialized amount
of software, quite variable, which enables it to
try to do what the user wants. Keep this in mind;
understand what the hardware can do, which is
different on different machines, and think in those
terms, not the current poorly designed languages.
Not quite sure what you're saying here. If it's a
warning against basic, then sure. But thinking
in terms of specific machine architecture? That's
virtually never a good idea. Even if you're using
something antique like plain C, you're still a lot
better off than you are with assembly or machine
language. What is "the current poorly designed
languages" supposed to refer to?
Knowing Herman Rubin a little bit, I just think he feels a bit slippery
here, though he won't admit. H.R. isn't much of a computer minded person
and he'd rather formulate his theoretical considerations on the backside
of an envelope, hand written, I suppose. (Not that I have any objections
against formulas written by hand ..)
|
I have programmed in Fortran, C, and assembler for
different machines. I am quite aware of even the
fact that efficiency for subroutines requires taking
into account the differences in the different machines,
and I have also stated that I can see how to produce
a somewhat high level assembler language easy to use.
Those who think HLLs are such a great idea, here is a
challenge. The function I am giving arises naturally,
and it is quite difficult to do EFFICIENTLY in any HLL.
Let x be a positive real number, whose binary expansion
is x = \sum a_i/2^i, a_i = 0 or 1. Then
f(x) = \sum i*a_i/2^i.
I have done some work on methods of generating non-uniform
random variables from uniform bits. There are some technical
reports available from the Purdue Statistics Department.
Among them are some I call "infinite precision", in that
no computer roundoff is involved. The easiest one of these
is to generate the density 2x from 0 to 1. The entire
algorithm is
I = distance to the first 1 in a random bit stream;
discard this part of the bit stream
X = U with the I-th bit after the binary point
changed to 1.
Alas, few of these are efficient, except possibly on an FPGA,
but the amount of work is finite random for all distributions
in any number of dimensions with lower semi-continuous density.
I have a recent paper with Brad Johnson on acceptance-replacement
generation of exponential and normal random variables, using
exponentials to test and reuse of successful test exponentials.
These vectorize or parallelize well if one changes the "control"
part of the algorithm somewhat, and that consideration also went
into the design of the algorithm.
I do know something about getting the power of the machine, and
doing operations beyond the low precision hardware. Even if only
partial, there should be a convenient way of including assembler
instructions in a program without losing "optimization"; I have
done that on the CYBER 205. I have also in my files a design for
a decent quick assembler for the 780; I cannot find what I did
on the 205, but I remember some of it, including the most complicated
single one.
One danger of HLLs is that the user has no idea of how long
something will take. As for gotos, I find them easy to use,
and spaghetti code is best for spaghetti algorithms.
--
This address is for information only. I do not claim that these views
are those of the Statistics Department or of Purdue University.
Herman Rubin, Department of Statistics, Purdue University
hrubin@stat.purdue.edu Phone: (765)494-6054 FAX: (765)494-0558 |
|
| Back to top |
|
 |
| |
Ads |
Advertising
Sponsor
|
|
aruzinsky Guest
|
Posted: Tue Jul 01, 2008 8:27 pm Post subject: Re: Programming skills required by mathematicians? |
|
|
On Jul 1, 10:16 am, hru...@odds.stat.purdue.edu (Herman Rubin) wrote:
| Quote: |
In article <84498550-6584-4d29-8703-d737ffe2e...@d45g2000hsc.googlegroups.com>,
aruzinsky <aruzin...@general-cathexis.com> wrote:
On Jun 25, 2:40=A0am, rAgAv <ragav.pa...@googlemail.com> wrote:
Hello,
.....................
PS - At the moment, I know only the basics of C++.
Beats me. What would a "pure mathematician" do with computer
programming? As an EE grad student, my thesis adviser was from the
math department and taught a graduate class on numerical analysis. He
authored papers mostly on finite element analysis of fluid flow. I
always thought of him as an applied mathematician. The other math
professors that I knew only used a computer for word processing.
Computers have been used in number theory, algebraic geometry,
computational problems which are more abstract than concrete,
as well as more "practical" problems. My technical reports,
available from the Purdue Statistics Department, are a combination
of an odd type of numerical analysis, and involve using Boolean
operations on the bit patter of floats, something which is not
in any HLL to my knowledge.
Efficient random number procedures can be mainly done in HLL,
but not with full efficiency. And I doubt that anyone can
get a full accuracy efficient procedure to generate
f(x) = x - ln(1+x) to full machine precision without using
the hardware structure. Also, on most machines, multiple
precision (I consider what is called "double" to be single)
arithmetic is a mess because of the forced normalization of
floats and the hidden bit. The factor may be higher than 10.
This is partly due to the HLLs, which have discounted fixed
point arithmetic.
If you were an "applied mathematician," I would recommend Fortran and
Algol only because there are many legacy programs written in these
languages. In particular, the Collected Algorithms from ACM Vol I to
III are mostly in Algol and Fortran.
At that time, those were the only moderately well known HLLs.
Machine independence is fine, but one must take into account
the machine to get efficiency.
--
This address is for information only. I do not claim that these views
are those of the Statistics Department or of Purdue University.
Herman Rubin, Department of Statistics, Purdue University
hru...@stat.purdue.edu Phone: (765)494-6054 FAX: (765)494-0558
|
With modern compilers, one can easily mix a HLL with assembly
language. For example, Visual C++ object code can be disassembled
into assembly language, modified, and then recompiled back to object
code.
For mental exercise and development, I recommend learning Forth which
uses Reverse Polish Notation (RPN), i.e. operands precede operators,
as in reality. Forth and RPN foster efficient programming and
utilization of RAM. Standard Forth does not use floating point, but
Forth can be modified to do anything because it is easily extensible.
Some modified versions directly use the PC FPU stack very efficiently. |
|
| Back to top |
|
 |
| |
Ads |
Advertising
Sponsor
|
|
Herman Rubin Guest
|
Posted: Tue Jul 01, 2008 9:16 pm Post subject: Re: Programming skills required by mathematicians? |
|
|
In article <84498550-6584-4d29-8703-d737ffe2ebcb@d45g2000hsc.googlegroups.com>,
aruzinsky <aruzinsky@general-cathexis.com> wrote:
| Quote: |
On Jun 25, 2:40=A0am, rAgAv <ragav.pa...@googlemail.com> wrote:
Hello,
|
.....................
| Quote: |
PS - At the moment, I know only the basics of C++.
Beats me. What would a "pure mathematician" do with computer
programming? As an EE grad student, my thesis adviser was from the
math department and taught a graduate class on numerical analysis. He
authored papers mostly on finite element analysis of fluid flow. I
always thought of him as an applied mathematician. The other math
professors that I knew only used a computer for word processing.
|
Computers have been used in number theory, algebraic geometry,
computational problems which are more abstract than concrete,
as well as more "practical" problems. My technical reports,
available from the Purdue Statistics Department, are a combination
of an odd type of numerical analysis, and involve using Boolean
operations on the bit patter of floats, something which is not
in any HLL to my knowledge.
Efficient random number procedures can be mainly done in HLL,
but not with full efficiency. And I doubt that anyone can
get a full accuracy efficient procedure to generate
f(x) = x - ln(1+x) to full machine precision without using
the hardware structure. Also, on most machines, multiple
precision (I consider what is called "double" to be single)
arithmetic is a mess because of the forced normalization of
floats and the hidden bit. The factor may be higher than 10.
This is partly due to the HLLs, which have discounted fixed
point arithmetic.
| Quote: |
If you were an "applied mathematician," I would recommend Fortran and
Algol only because there are many legacy programs written in these
languages. In particular, the Collected Algorithms from ACM Vol I to
III are mostly in Algol and Fortran.
|
At that time, those were the only moderately well known HLLs.
Machine independence is fine, but one must take into account
the machine to get efficiency.
--
This address is for information only. I do not claim that these views
are those of the Statistics Department or of Purdue University.
Herman Rubin, Department of Statistics, Purdue University
hrubin@stat.purdue.edu Phone: (765)494-6054 FAX: (765)494-0558 |
|
| Back to top |
|
 |
| |
Ads |
Advertising
Sponsor
|
|
Han de Bruijn Guest
|
Posted: Wed Jul 02, 2008 11:00 am Post subject: Re: Programming skills required by mathematicians? |
|
|
Marshall wrote:
| Quote: |
On Jul 1, 7:40 am, hru...@odds.stat.purdue.edu (Herman Rubin) wrote:
As for gotos, I find them easy to use,
and spaghetti code is best for spaghetti algorithms.
Sure, gotos are easy to write, but what's usually important
for code is that it be easy to read and easy to maintain,
and gotos are anathema to that.
|
I think nowadays nobody, except Herman, will argue in favour of gotos.
On the other hand, I find that the Object Oriented Programming paradigm
has given rise to bad programming practices, such as putting more and
more software layers on top of each other, so many that even a GigaHerz
processor can hardly plough through them, in execution time.
Han de Bruijn |
|
| Back to top |
|
 |
| |
Ads |
Advertising
Sponsor
|
|
Han de Bruijn Guest
|
Posted: Wed Jul 02, 2008 11:00 am Post subject: Re: Programming skills required by mathematicians? |
|
|
aruzinsky wrote:
| Quote: |
If you were an "applied mathematician," I would recommend Fortran and
Algol only because there are many legacy programs written in these
languages. In particular, the Collected Algorithms from ACM Vol I to
III are mostly in Algol and Fortran.
|
Algol ? I thought _that_ is outdated ! And Fortran ? Indeed there are
many programs written in that language. It has even been my mother's
tongue. But I wouldn't recommend it to anyone. My favorite is Pascal.
Han de Bruijn |
|
| Back to top |
|
 |
| |
Ads |
Advertising
Sponsor
|
|
aruzinsky Guest
|
Posted: Wed Jul 02, 2008 3:35 pm Post subject: Re: Programming skills required by mathematicians? |
|
|
On Jul 2, 2:35 am, Han de Bruijn <Han.deBru...@DTO.TUDelft.NL> wrote:
| Quote: |
aruzinsky wrote:
If you were an "applied mathematician," I would recommend Fortran and
Algol only because there are many legacy programs written in these
languages. In particular, the Collected Algorithms from ACM Vol I to
III are mostly in Algol and Fortran.
Algol ? I thought _that_ is outdated ! And Fortran ? Indeed there are
many programs written in that language. It has even been my mother's
tongue. But I wouldn't recommend it to anyone. My favorite is Pascal.
Han de Bruijn
|
Algol is outdated, but many of the 1950s algorithms written in Algol
are not. If you know some Pascal, you can probably read Algol well
enough to translate. I bet there are plenty of Algol algorithms in
Collected Algorithms from ACM that are better than their counterparts
published in Numerical Recipes in C (or Fortran). |
|
| Back to top |
|
 |
| |
Ads |
Advertising
Sponsor
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|

219 Attacks blocked
Powered by phpBB © 2001, 2005 phpBB Group
|