Mathematica is a functional language. A program that calculates n!, n factorial looks like this:
f[n_] := Apply[Times, Range[n]]
The function f[5] yields 120 = 5!
Explanation of the code:
- Range[5] by itself yields {1, 2, 3, 4, 5}
- Times[a,b] yields a*b.
- Apply[Times, {1,2,3,4,5}] yields Times[Times[Times[Times[1, 2], 3], 4], 5]
Functional programming goes back to the 1950's when the programming language Lisp was developed. Since then Lisp has always been in use ( in some dialect ) for the development of highly complicated systems like Artificial Intelligence (AI) systems. But unexpectedly for the time the first Yahoo Store web application has been built in Lisp also.
Please follow this blog
Search this blog
Subscribe to:
Post Comments (Atom)
Popular Posts
-
Among lectures on Calculus I,II and III, ( Introduction to ) Linear Algebra and ( Introduction to ) Differential Equations from the UCCS ( ...
-
Problem: We want to calculate the sum of the elements of a list of numbers. Suppose this list is named l and has been assigned the value {1,...
-
Today I started to read the Ramanujan biography ( The e-book version, of course. ) The book looks promising. What was it like to communicate...
-
I found a set of video lectures on Abstract Algebra. MATH E-222 Abstract Algebra - http://www.extension.harvard.edu/openlearning/math222/ E...
-
Ramanujan's genius (r) was discovered by Hardy (l) At a very young age Ramanujan designed the following formula for a 3 by 3 magic sq...
Welcome to The Bridge
Mathematics: is it the fabric of MEST?
This is my voyage
My continuous mission
To uncover hidden structures
To create new theorems and proofs
To boldly go where no man has gone before
(Raumpatrouille – Die phantastischen Abenteuer des Raumschiffes Orion, colloquially aka Raumpatrouille Orion was the first German science fiction television series. Its seven episodes were broadcast by ARD beginning September 17, 1966. The series has since acquired cult status in Germany. Broadcast six years before Star Trek first aired in West Germany (in 1972), it became a huge success.)
No comments:
Post a Comment