mersenneforum.org

mersenneforum.org (https://www.mersenneforum.org/index.php)
-   Software (https://www.mersenneforum.org/forumdisplay.php?f=10)
-   -   suggested computer language for explaining some algorithms (https://www.mersenneforum.org/showthread.php?t=24596)

bhelmes 2019-07-17 23:24

suggested computer language for explaining some algorithms
 
A peaceful and pleasent night for you,


what kind of computer language would you suggest for a mathematical book about number theory in order to illustrate the algorithms ?


The programming language should be

a) easy to understand,
b) supported for a long time (20 years at least) and
c) usable for different operation systems


I used Mupad some years ago, but it is vanished.


Recommandations ?


Greetings from the polynomial rings :cmd: :geek::petrw1:

Bernhard

chalsall 2019-07-17 23:28

[QUOTE=bhelmes;521824]Recommandations ?[/QUOTE]

While I personally can't stand it (it uses indentation for code blocks), Python would probably be a good choice.

VBCurtis 2019-07-18 00:36

Perhaps psuedocode for illustration, but actual code isn't called for in a math text.

If you can't explain the algo in human language, your exposition needs work.

hansl 2019-07-18 01:40

PARI/GP is convenient for math and number theory related algorithms.

kriesel 2019-07-18 02:39

Just bouncing some ideas around here:
natural language, constructs like if then, else, until, while, for, and parentheses;
whichever language more readers of the book are likely to already know;
perhaps vary the language among a very small set according to which seems to best suit the specific situation;
something included at Rosetta Code;
something available at no additional cost or very low for your students if this is for teaching;
Wolfram (Mathematica) but very costly;
stay with what you know; MATLAB has an optional toolbox with MuPAD (and interfaces with various other languages) [URL]https://en.wikipedia.org/wiki/MATLAB[/URL].
MATLAB student cost doesn't look too bad.

LaurV 2019-07-18 05:48

Pascal.

No (big) difference from pseudocode, human-like, easy to explain any algorithm in it, easy to be re-written in any other language. In C, you can easy compile most of Pascal source code just #defining "begin" to "{", end to ";}", and a couple of other tricks.

Technically, if you have the logic diagram (with blocks) in front of you, or in your mind, writing Pascal programs from it is just a piece of pizza...

After learning Fortran and Basic in high school (for Fortran we used punched cards on a [URL="https://ro.wikipedia.org/wiki/Felix_C"]Felix C256[/URL] our highschool owned, and for Basic it was the early days of the intel 8080, etc and we had a [URL="https://ro.wikipedia.org/wiki/Felix_M"]M18[/URL] with centronix console - i.e. printing on paper, this was earlier than the displays and terminals era), we went to uni where they used to teach us Pascal (on [URL="https://cdn.hackaday.io/files/10579452611936/PICT0002.JPG"]Coral[/URL], - you MUST click this link! - and serial DAF2020/VT100 terminals in all the building, no listing papers and punch cards anymore), and it was such a revelation... (we studied C started from the second year at uni).

kriesel 2019-07-18 13:11

[QUOTE=LaurV;521843]Pascal.
...
After learning Fortran and Basic in high school (for Fortran we used punched cards on a [URL="https://ro.wikipedia.org/wiki/Felix_C"]Felix C256[/URL] our highschool owned, and for Basic it was the early days of the intel 8080, etc and we had a [URL="https://ro.wikipedia.org/wiki/Felix_M"]M18[/URL] with centronix console - i.e. printing on paper, this was earlier than the displays and terminals era), we went to uni where they used to teach us Pascal (on [URL="https://cdn.hackaday.io/files/10579452611936/PICT0002.JPG"]Coral[/URL], - you MUST click this link! - and serial DAF2020/VT100 terminals in all the building, no listing papers and punch cards anymore), and it was such a revelation... (we studied C started from the second year at uni).[/QUOTE]
Pascal occurs to me as a language with a great past but not so much a future.
I first learned Fortran in the wait-for-a-keypunch-to-be-free days, then BASIC, various assemblers, c, Pascal, others. Pascal seemed a step up from Fortran toward natural language, and c a step in the other direction toward assembler. [url]https://en.wikipedia.org/wiki/Pascal_(programming_language[/url])

Happy5214 2019-07-18 19:35

Current college students have virtually no experience with Pascal (which is a shame, since I've heard great things about it). One of my professors was a huge fan of PL/I, lamenting its loss to C.

I think you should probably use pseudocode when targeting a non-CS audience. If it needs to be an actual, modern language, Python and Ruby are readable, cross-platform languages you can use.

xilman 2019-07-18 20:27

[QUOTE=bhelmes;521824]what kind of computer language would you suggest for a mathematical book about number theory in order to illustrate the algorithms ?
[/QUOTE]If you need any specific programming language to explain your algorithms, you have failed to explain your algorithm properly. There are far too many language-specific irritations in any given language.

Almost any form of pseudo-code should be sufficient. That used by Knuth in TAOCP is a classic of clear and precise specification.

kriesel 2019-07-18 22:50

[QUOTE=xilman;521886]Almost any form of pseudo-code should be sufficient. That used by Knuth in TAOCP is a classic of clear and precise specification.[/QUOTE]MIX?!


Nice avatar. But be careful of using it in real life. Around here, 4 could get you 0 to the chin.

bhelmes 2019-07-19 00:47

[QUOTE=VBCurtis;521828]Perhaps psuedocode for illustration, but actual code isn't called for in a math text.

If you can't explain the algo in human language, your exposition needs work.[/QUOTE]


Perhaps my english knowledge is not perfect, and may be the chinese reader will not detect every thought, therefore a second explication could improve some knowledge transfair easier.


All times are UTC. The time now is 11:53.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.