As of May 4 2007 the scripts will autodetect your timezone settings. Nothing here has to be changed, but there are a few things

Please follow this blog

Search this blog

Tuesday, January 5, 2010

Mathematica is a functional language

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.

No comments:

Post a Comment

Popular Posts

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.)