Home Page of Dennis J. Darland's Physics Programming


This Project started April 9, 2018 at 2:15am.

Email: Mail To: pal at dennisdarland dot com
Comments welcome
For other things I'm doing see my home page.

Priorities for practicing (or learning) languages

  1. Unicon - Reference Information - Comments
  2. Maple - Reference Information - Comments
  3. C language - Reference Information - Comments
  4. WildLIFE - Reference Information - Comments
  5. Common LISP - Reference Information - Comments
  6. APL - Reference Information - Comments
  7. C++ - Reference Information - Comments
  8. Swi Prolog - Reference Information - Comments
  9. Poly ML - Reference Information - Comments
  10. Maxima - Reference Information - Comments
  11. OCaml - Reference Information - Comments
  12. Haskell (coming) - Reference Information - Comments
  13. Eiffel - Reference Information - Comments
  14. Mozart (Oz) - Reference Information - Comments
  15. Ada - Reference Information - Comments
  16. Ruby - Reference Information - Comments
  17. Java - Reference Information - Comments
  18. Snobol4 - Reference Information - Comments
  19. Icon (coming) - Reference Information - Comments
  20. GNU Prolog - Reference Information - Comments
  21. Objective C (coming) - Reference Information - Comments
  22. Objective C++ (coming) - Reference Information - Comments
  23. Fortran - Reference Information - Comments
  24. Python - Reference Information - Comments
  25. Perl - Reference Information - Comments
  26. Bertrand - Reference Information - Comments

Problems I have made for myself

  1. Sometimes physicists take c (the speed of light), h (Plank's constant) and possibly other constants as having a value of 1.0.
    I have seen, e.g. Leonard Susskind do this in some of his Modern Physics Lectures.
    When I went to add the URL - the location had moved. Also there are more lectures than when I studied them several years ago.
    I am excited about this. These lectures are at about the correct level for me.
    The problem I set for myself is what are the units of length, mass, and time - if converted to the mks system - in order to let these constants be 1.0?
    Languages
  2. bertrand language
    1. My Problem 1 - pb01.txt
    2. My Problem 1 - outputI discovered output goes to stderr rather than stdout.
  3. c language
    1. My Problem 1 - glob.h
    2. My Problem 1 - pb01.c Compute units so c = 1.0, h = 1.0 and mass of electron = 1.0
    3. My Problem 2 - pb02.c - Just a check for arctrig functions in WildLIFE
    4. My Problem 1 - outputI found & fixed error - see comments - on algebra in .c file.
    5. My Problem 2 - arctrig output
  4. Maple language
    1. My Problem 1 - init_glob.mxt
    2. My Problem 1 - pb01.mxt Compute units so c = 1.0, h = 1.0 and mass of electron = 1.0
    3. My Problem 1 - output
  5. Maxima language
    1. My Problem 1 - init_glob.mxt
    2. My Problem 1 - pb01.max - Solved symbolically Compute units so c = 1.0, h = 1.0 and mass of electron = 1.0
    3. My Problem 1 - pb02.max - Solved numerically - I had difficulty with both is same program. Compute units so c = 1.0, h = 1.0 and mass of electron = 1.0
    4. My Problem 1 - symbolic output
    5. My Problem 1 - numeric output
  6. WildLIFE language
    1. My Problem 2 - pb01.lf - arctrig functions for WildLIFE
    2. My Problem 2 - arctrig output

Problems from Halliday-Resnick solved by programming

I'm planning to study physics.
I'm starting with my text I used in 1970.
The textbook is Physics: Parts I & II
By David Halliday & Robert Resnick.
Second printing April 1967.
I plan to solve problems with my computer.
See The Problems from the book I am solving.
Although, some information in the book is dated, classical physics has not, I think.
I think no one likely to my putting solutions to a small number of problems from this old text on the web.
Especially, since answers to odd numbered problems are given in the back of the book.

I hope to advance beyond that!
I'm trying several languages - to review my knowledge.
Before long, I expect to be mainly using Maple & Maxima.
I will mainly solve problems in other languages, if new language concepts are used.
Doing this gives me examples of basic programming constructs in these languages!!!
Because there is so much to get through, and I know some of it,
I am only going to program a limited number of problems. (Approximately one per chapter.)
I am going, also, to use varying language constructs in the languages,
in order to get such practice.
I've started adding start & finish times of programs. - Using echo, date & cat commands in Linux.
Also adding any special instructions to run programs in source code.

8/18/2018 - Just getting restarted on this.
I have, for the time being, decided to focus on Maple.
Also to do one problem per chapter.
I am rustier at the physics than I thought.

  1. ada language
    1. Chapter 1 - Problems 1-3 - pb01.adb
    2. Chapter 1 - Problems 1-3 - output
  2. APL language
    1. I should speak louder!
    2. Chapter 1 - Problems 1-3 - pb01.mp4
    3. Chapter 2 - Problem 5 - pb02.mp4
  3. c language
    1. Chapter 1 - Problems 1-3 - glob.h
    2. Chapter 1 - Problems 1-3 - pb01.c
    3. Chapter 2 - Problem 5 - pb02.c (I added dot and cross products)
    4. Chapter 4 - Problem 3 - pb03.c
    5. Chapter 6 - Problem 5 - pb06.c
    6. Chapter 1 - Problems 1-3 - output
    7. Chapter 2 - Problem 5 - output (I added dot and cross products)
    8. Chapter 4 - Problem 3 - output
    9. Chapter 6 - Problem 5 - output
  4. clisp language
    1. Chapter 1 - Problem 1 - glob.lsp
    2. Chapter 1 - Problem 1 - pb01.lsp
    3. Chapter 2 - Problem 5 - pb02.lsp - better tests for cross product. hecked with Maple
    4. Chapter 1 - Problem 1 - output
    5. Chapter 2 - Problem 5 - output
  5. c++ language
    1. Chapter 1 - Problems 1-3 - glob.h
    2. Chapter 1 - Problems 1-3 - pb01.cpp
    3. Chapter 2 - Problem 5 - pb02.cpp (I added dot and cross products)
    4. Chapter 1 - Problems 1-3 - output
    5. Chapter 2 - Problem 5 - output (I added dot and cross products)
  6. Eiffel language
    1. Chapter 1 - Problems 1-3 - PB01.e
    2. Chapter 1 - Problem 1 - output
  7. Fortran language
    1. Chapter 1 - Problem 1 - glob.f
    2. Chapter 1 - Problem 1 - pb01.f
    3. Chapter 1 - Problem 1 - output
  8. GNU Prolog language
    1. Chapter 1 - Problem 1 - glob.pl
    2. Chapter 1 - Problem 1 - pb01.pl
    3. Chapter 1 - Problem 1 - output
  9. Java language
    1. Chapter 1 - Problems 1-3 - Glob.java
    2. Chapter 1 - Problems 1-3 - Pb01.java
    3. Chapter 1 - Problems 1-3 - output
  10. Maple language
    1. Chapter 1 - Problem 1 - glob.mxt
    2. Chapter 1 - Problem 1 - pb01.mxt
    3. Chapter 2 - Problem 5 - pb02.mxt (I added dot and cross products) - better tests for cross product
    4. Chapter 3 - Problem 5 - pb03.mxt
    5. Chapter 4 - Problem 3 - pb04.mxt
    6. Chapter 5 - Problem 5 - pb05.mxt
    7. Chapter 7 - Problem 1 - pb07.mxt
    8. Chapter 1 - Problem 1 - output
    9. Chapter 2 - Problem 5 - output (I added dot and cross products)
    10. Chapter 3 - Problem 5 - output
    11. Chapter 4 - Problem 3 - output
    12. Chapter 5 - Problem 5 - output
    13. Chapter 7 - Problem 1 - output (My answers differ slightly from those in book.)
  11. Maxima language
    1. Chapter 1 - Problem 1 - glob.max
    2. Chapter 1 - Problem 1 - pb01.max
    3. Chapter 2 - Problem 5 - pb01.max
    4. Chapter 1 - Problem 1 - output
    5. Chapter 2 - Problem 5 - output
  12. Objective Caml language
    1. Chapter 1 - Problem 1 - pb01.ml
    2. Chapter 1 - Problem 1 - output
  13. Oz language
    1. Chapter 1 - Problems 1-3 - pb011.oz
    2. Chapter 1 - Problems 1-3 - output
    Need to learn:
    1. Include another file
    2. Need to learn input
  14. Perl language
    1. Chapter 1 - Problem 1 - glob.pm
    2. Chapter 1 - Problems 1-3 - pb01.pl (Perl)
    3. Chapter 1 - Problems 1-3 - output
  15. Polyml language
    1. Chapter 1 - Problem 1 - glob.ml
    2. Chapter 1 - Problem 1 - pb01.ml
    3. Chapter 2 - Problem 5 - pb02.ml
    4. Chapter 1 - Problem 1 - output
    5. Chapter 2 - Problem 5 - output
  16. Python language
    1. Chapter 1 - Problems 1-3 - glob.py
    2. Chapter 1 - Problems 1-3 - pb01.py
    3. Chapter 1 - Problems 1-3 - output
  17. Ruby language
    1. Chapter 1 - Problem 1 - glob.rb
    2. Chapter 1 - Problem 1 - pb01.rb
    3. Chapter 2 - Problem 5 - pb01.rb
    4. Chapter 1 - Problem 1 - output
    5. Chapter 2 - Problem 5 - output
  18. Snobol4 language
    1. Chapter 1 - Problem 1 - pb01.sno
    2. Chapter 1 - Problem 1 - output
  19. Swipl language(6.6.4)
    1. Chapter 1 - Problem 1 - glob.pl (prolog)
    2. Chapter 1 - Problem 1 - pb01.pl (prolog)
    3. Chapter 1 - Problem 1 - output
  20. Swipl language(7.2.2)
    1. Chapter 1 - Problem 1 - glob.pl (prolog)
    2. Chapter 1 - Problem 1 - pb01.pl (prolog)
    3. Chapter 2 - Problem 5 - pb01.pl (prolog)
    4. Chapter 1 - Problem 1 - output
    5. Chapter 2 - Problem 5 - output
  21. Unicon language
    1. Chapter 1 - Problem 1 - glob.icn
    2. Chapter 1 - Problem 1 - pb01.icn
    3. Chapter 2 - Problem 5 - pb02.icn (I added dot and cross products)
    4. Chapter 4 - Problem 3 - pb04.icn
    5. Chapter 1 - Problem 1 - output
    6. Chapter 2 - Problem 5 - output (I added dot and cross products)
    7. Chapter 4 - Problem 3 - output
  22. WildLIFE language
    1. Chapter 1 - Problem 1 - glob.lf
    2. Chapter 1 - Problem 1 - pb01.lf
    3. Chapter 2 - Problem 5 - pb02.lf (I added dot and cross products)
    4. Chapter 5 - Problem 5 - pb05.lf
    5. Chapter 1 - Problem 1 - output
    6. Chapter 2 - Problem 5 - output (I added dot and cross products)
    7. Chapter 5 - Problem 5 - output

Comments and Opinions on the merits of these languages, especially for math and physics.

  1. ada language - opinions
    1. Still to inexperienced to judge.
    2. I think it is not a popular language.
  2. APL language - opinions
    1. Extensive use of non-structured programing (especially goto's) bad for large programs.
  3. Bertrand language - opinions
    1. It's not a general purpose language.
    2. It is mostly a research language into constraint programming.
  4. c language - opinions
    1. Popular language.
    2. I know it well (or did).
    3. Extensive use of pointers and consequent need for memory management creates difficulies.
  5. clisp language - opinions
    1. An AI language - which could be useful in aspects of math/physics.
    2. E.g. maxima is written in it.
    3. I do not know it very well (yet).
  6. c++ language - opinions
    1. Popular language.
    2. I think complexity of the language is a problem.
    3. I want to introduce c++ features as slowly as I can, but I want to write really good c++ code.
    4. After I have more experience with C++, I can judge better.
    5. I am doing some reading on C++, as well as referring to the books.
    6. I am doing this because I enjoy programming - at any rate when I am not asked to do the impossible.
  7. Eiffel language - opinions
    1. Seems com
    2. Still to inexperienced to judge.
    3. I think it is not a popular language.
    4. I like some of the ideas - like contracts - but think they could be difficult to use in physics
  8. Fortran language - opinions
    1. It has changes a great deal since I learned it.
    2. Would need to learn better before judging.
  9. GNU Prolog language - opinions
    1. I am too inexperienced to judge.
    2. I investigated this because of problems porting the Goedel language from SICStus Prolog to Swi Prolog.
    3. However, Goedel relied heavily on Modules & GNU Prolog hss no support for Modules - therefore, I am not pursuing it.
    4. Swi Prolog has Modules - but there are other difficulties.
  10. Haskell language - opinions
    1. I am too inexperienced to judge.
  11. Icon language - opinions
    1. One of my favorite languages.
    2. I mostly use Unicon now - which is, mostly, a superset of Icon.
  12. Java language - opinions
    1. Is complex - like C++.
    2. But no pointers and mempry management is easier.
  13. Maple language - opinions
    1. Is very powerful for math/physics
    2. Mostly I will just have to learn how to use libraries provided.
    3. I will be learning more physics from programming in other languages - Maple does too much for me.
  14. Maxima language - opinions
    1. Like Maple, powerful.
    2. Unlike Maple, it is free and open source.
    3. But Maple is faster, in my experience and I know Maple better.
  15. Objective C language - opinions
    1. I am too inexperienced to judge.
  16. Objective C++ language - opinions
    1. I am too inexperienced to judge.
  17. Objective ocaml language - opinions
    1. I am too inexperienced to judge.
  18. Oz language - opinions
    1. I am too inexperienced to judge.
  19. Perl language - opinions
    1. I am too inexperienced to judge.
    2. Unicon, Ruby, Perl, and Python seem to have similar capabilities.
    3. I like Unicon best, although it seems to be not very popular.
    4. Next is Ruby.
    5. Perl is last.
  20. Polyml language - opinions
    1. I am inexperienced, but I know Isabelle is written in it, so I would like to learn it better.
  21. Python language - opinions
    1. I am too inexperienced to judge.
    2. Unicon, Ruby, Perl, and Python seem to have similar capabilities.
    3. I like Unicon best, although it seems to be not very popular.
    4. Next is Ruby.
    5. Perl is last.
  22. Ruby language - opinions
    1. I have written quite a bit of Ruby.
    2. Unicon, Ruby, Perl, and Python seem to have similar capabilities.
    3. I like Unicon best, although it seems to be not very popular.
    4. Next is Ruby.
    5. Perl is last.
  23. Snobol4 language - opinions
    1. I find it very intuitive for string processing.
    2. Product of Ralph Griswold, as Icon later was.
    3. Unicon is object oriented and derived from Icon.
    4. Extensive use of goto's in snobol4 easily can result in spaghetti code.
    5. Very good for small programs manipulating strings.
    6. Some of my code is at:
      health study and
      time study
  24. Swipl language - opinions
    1. Prolog - Programming in Logic
    2. An AI language.
    3. I have written some for my philosophy.
  25. Unicon language - opinions
    1. Unicon is a very high level object oriented language derived from Icon.
    2. String capabilities similar to snobol but without the goto's.
  26. WildLIFE language - opinions
    1. Not very popular - I don't know of anyone else using it.
    2. I sort of rescued it!
    3. Most similar to prolog.
    4. LIFE stands for:
      Logic
      Inheritance
      Functions
      and
      Equations
    5. I have written some for my philosophy.
This page has been visited times since April 30, 2018.