arrow_back What is an algorithm?

12 views
What is an algorithm?

An algorithm is a specific set of actions that when carried out on data (input) of the allowed type will produce an output. This is the meaning in mathematical discourse. There are related meanings in use:

- The algorithm may be implemented as a program in a computer language. This program may itself be referred to as the algorithm.
- In texts on the subject of algorithm, the word may be given a mathematical definition, turning an algorithm into a mathematical object (compare the uses of proof).

Example

One might express a simpleminded algorithm for calculating a zero of a function $f(x)$ using Newton's Method by saying
"Start with a guess $x$ and calculate $x-\frac{f(x)}{f^{\prime}(x)}$ repeatedly until
$f(x)$ gets sufficiently close to 0 or the process has gone on too long."
One could spell this out in more detail this way:
1. Choose an accuracy $\epsilon$, the maximum number of iterations $N$, and a guess $s$.
2. Let $n=0$.
3. If $\left|f^{\prime}(s)\right|<\epsilon$ then stop with the message "derivative too small".
4. Replace $n$ by $n+1$.
5. If $n>N$, then stop with the message "too many iterations".
6. Let $r=s-\frac{f(s)}{f^{\prime}(s)}$.
7. If $|f(r)|<\epsilon$ then stop; otherwise go to step 3 with $s$ replaced by $r$.

Observe that neither description of the algorithm is in a programming language, but that the second one is precise enough that it could be translated into most programming languages quite easily. Nevertheless, it is not a program.

by SIlver Status
(18,309 points)

Related questions

Notice: Undefined index: avatar in /home/customer/www/mathsgee.com/public_html/qa-theme/AVEN/qa-theme.php on line 993
What is a learning community?
What is a learning community?What is a learning community? ...
close

Notice: Undefined index: avatar in /home/customer/www/mathsgee.com/public_html/qa-theme/AVEN/qa-theme.php on line 993
Speak the answer. What is 2 + 2 ?
Speak the answer. What is 2 + 2 ? Speak the answer. What is 2 + 2 ? &nbsp; &nbsp; ...
close

Notice: Undefined index: avatar in /home/customer/www/mathsgee.com/public_html/qa-theme/AVEN/qa-theme.php on line 993
What is a time series?
What is a time series?What is a time series? ...
close

Notice: Undefined index: avatar in /home/customer/www/mathsgee.com/public_html/qa-theme/AVEN/qa-theme.php on line 993
What is financial risk?
What is financial risk?What is financial risk? ...
close

Notice: Undefined index: avatar in /home/customer/www/mathsgee.com/public_html/qa-theme/AVEN/qa-theme.php on line 993