General directions. (1) You may use a computer algebra system (such as Mathemati
ID: 2893260 • Letter: G
Question
General directions.
(1) You may use a computer algebra system (such as Mathematica, Matlab, etc)or a pro-
gramming language (such as C++, Java, etc) or possibly some other appropriate soft-
ware of your choice.
(2) The words "A point (a vector) is given" mean that its coordinates (components) are
given.
The words "A line is given" mean that its equation is given. You can use as an input
either equation of the line in some form or its initial point and direction vector.
The words "A plane is given" mean that its general equation is given. You can use as
an input either this equation or the vector of coefficients.
The words "Determine . . . find . . . " mean that you are asked to create a program(or
some kind of software implementation) that takes as input the given data and returns
the required equations.
The problem. Four points A,B,C and D in R3 are given.
(1) Determine whether these four points are coplanar(i.e. lie on the same plane).
(2) If A,B,C,D are coplanar, findnd that plane.
(3) If A,B,C,D are not coplanar, find the plane that contains points A and C and which
is parallel to (B,D)-line.
Please use either Matlab or Mathematica and comment the code so I know whats going on...please!
Explanation / Answer
There are really two kinds of languages:
- languages that are designed to minimize the time programmers spend programming
- languages that are designed to minimize the time computers spend computing
The first category are languages that are easy to program in. It is composed of interpreted languages: Python, Julia, R, MATLAB... The most popular free alternative is likely Python. In some domains, like biology or statistics, it might be R. If you feel the visceral need to cough up some cash, then you could buy a MATLAB license. They all offer easy ways to plot graphs, do complex mathematics (eigenvalues, inverse matrices, conjugate gradient, Monte-Carlo), query databases, the web...
The second category is composed of C/C++ and - God forbid - clunky old Fortran. They are harder to program but should be more computationally efficient. If the programs are well written.
The default option should be to minimize the time you spend programming and go with the first category. Your time is valuable, the computer's is cheap. So minimize the time you spend programming and maximize the time doing actual physics. As Google puts it (and they do a fair amount of compute): Python where we can, C++ where we must.
There is a tired argument that to do high performance computing it is absolutely necessary to use low level languages such as C and C++. However, most high-performance physics software will devolve the heavy lifting to external libraries, such as BLAS, LAPACK, FFTW, and others. In that case, whether there libraries are called from a language of the first or second category has little implication on the speed code.
Furthermore, most languages of the first category offer some easy way to interface with languages of the second category. Most physics software is such that the computer spends most of its time in 5% of the code, eg in the kernel. So it is always possible to move that kernel to C/C++ later on and interface with it in the interpreted language. The best of both worlds! Google Cython for the python way of doing this.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.