In
computer programming
Computer programming is the process of performing a particular computation (or more generally, accomplishing a specific computing result), usually by designing and building an executable computer program. Programming involves tasks such as anal ...
, a scientific programming language can refer to two degrees of the same concept.
In a wide sense, a scientific programming language is a
programming language
A programming language is a system of notation for writing computer programs. Most programming languages are text-based formal languages, but they may also be graphical. They are a kind of computer language.
The description of a programming ...
that is used widely for
computational science and
computational mathematics. In this sense, C/C++ and Python
can be considered scientific programming languages.
In a stronger sense, a scientific programming language is one that is designed and optimized for the use of mathematical
formula and
matrices
Matrix most commonly refers to:
* ''The Matrix'' (franchise), an American media franchise
** ''The Matrix'', a 1999 science-fiction action film
** "The Matrix", a fictional setting, a virtual reality environment, within ''The Matrix'' (franchis ...
.
Such languages are characterized not only by the availability of libraries performing mathematical or scientific functions, but by the syntax of the language itself.
For example, neither C++ nor Python have built-in matrix types or functions for matrix arithmetic (addition, multiplication etc.); instead, this functionality is made available through standard libraries. Scientific programming languages in the stronger sense include
ALGOL
ALGOL (; short for "Algorithmic Language") is a family of imperative computer programming languages originally developed in 1958. ALGOL heavily influenced many other languages and was the standard method for algorithm description used by the ...
,
APL,
Fortran,
J,
Julia
Julia is usually a feminine given name. It is a Latinate feminine form of the name Julio and Julius. (For further details on etymology, see the Wiktionary entry "Julius".) The given name ''Julia'' had been in use throughout Late Antiquity (e.g ...
,
Maple
''Acer'' () is a genus of trees and shrubs commonly known as maples. The genus is placed in the family Sapindaceae.Stevens, P. F. (2001 onwards). Angiosperm Phylogeny Website. Version 9, June 2008 nd more or less continuously updated since http ...
,
MATLAB
MATLAB (an abbreviation of "MATrix LABoratory") is a proprietary multi-paradigm programming language and numeric computing environment developed by MathWorks. MATLAB allows matrix manipulations, plotting of functions and data, implementa ...
and
R.
Scientific programming languages should not be confused with scientific language in general, which refers loosely to the higher standards in precision, correctness and concision expected from practitioners of the
scientific method
The scientific method is an empirical method for acquiring knowledge that has characterized the development of science since at least the 17th century (with notable practitioners in previous centuries; see the article history of scientific ...
.
Examples
Linear algebra
Scientific programming languages provide facilities to work with
linear algebra
Linear algebra is the branch of mathematics concerning linear equations such as:
:a_1x_1+\cdots +a_nx_n=b,
linear maps such as:
:(x_1, \ldots, x_n) \mapsto a_1x_1+\cdots +a_nx_n,
and their representations in vector spaces and through matrices ...
. For example, the following Julia program solves a
system of linear equations:
A = rand(20, 20) # A is a 20x20 matrix
b = rand(20) # b is a 20-element vector
x = A\b # x is the solution to A*x = b
Working with large vectors and matrices is a key feature of these languages, as linear algebra lays the foundation to
mathematical optimization, which in turn enables major applications such as
deep learning.
Mathematical optimization
In a scientific programming language, we can compute function optima with a syntax close to mathematical language. For instance, the following Julia code finds the minimum of the
polynomial
In mathematics, a polynomial is an expression consisting of indeterminates (also called variables) and coefficients, that involves only the operations of addition, subtraction, multiplication, and positive-integer powers of variables. An example ...
.
using Optim
P(x,y) = x^2 - 3x*y + 5y^2 - 7y + 3
z₀ = 0.0
0.0 # starting point for optimization algorithm
optimize(z -> P(z...), z₀, Newton();
autodiff = :forward)
In this example,
Newton's method for minimizing is used. Modern scientific programming languages will use
automatic differentiation
In mathematics and computer algebra, automatic differentiation (AD), also called algorithmic differentiation, computational differentiation, auto-differentiation, or simply autodiff, is a set of techniques to evaluate the derivative of a function s ...
to compute the gradients and Hessians of the function given as input; cf.
differentiable programming
Differentiable programming is a programming paradigm in which a numeric computer program can be differentiated throughout via automatic differentiation.
This allows for gradient-based optimization of parameters in the program, often via grad ...
. Here, automatic forward differentiation has been chosen for that task.
Older scientific programming languages such as the venerable Fortran would require the programmer to pass, next to the function to be optimized, a function that computes the gradient, and a function that computes the Hessian.
With more knowledge of the function to be minimized, more efficient algorithms can be used. For instance,
convex optimization
Convex optimization is a subfield of mathematical optimization that studies the problem of minimizing convex functions over convex sets (or, equivalently, maximizing concave functions over convex sets). Many classes of convex optimization pr ...
provides faster computations when the function is convex,
quadratic programming
Quadratic programming (QP) is the process of solving certain mathematical optimization problems involving quadratic functions. Specifically, one seeks to optimize (minimize or maximize) a multivariate quadratic function subject to linear constr ...
provides faster computations when the function is at most quadratic in its variables, and
linear programming when the function is at most linear.
See also
*
Linear algebra
Linear algebra is the branch of mathematics concerning linear equations such as:
:a_1x_1+\cdots +a_nx_n=b,
linear maps such as:
:(x_1, \ldots, x_n) \mapsto a_1x_1+\cdots +a_nx_n,
and their representations in vector spaces and through matrices ...
*
Mathematical optimization
**
Convex optimization
Convex optimization is a subfield of mathematical optimization that studies the problem of minimizing convex functions over convex sets (or, equivalently, maximizing concave functions over convex sets). Many classes of convex optimization pr ...
**
Linear programming
**
Quadratic programming
Quadratic programming (QP) is the process of solving certain mathematical optimization problems involving quadratic functions. Specifically, one seeks to optimize (minimize or maximize) a multivariate quadratic function subject to linear constr ...
*
Scientific terminology
Scientific terminology is the part of the language that is used by scientists in the context of their professional activities. While studying nature, scientists often encounter or create new material or immaterial objects and concepts and are comp ...
References
{{reflist
Programming paradigms