What is the function of capitalism? To my understanding, all systems have a function.  For instance, the function of the respiratory system is to supply oxygen to the body.  The function of the digestive system is to break down and disseminate nutrients.  The function of a mass transit system is to facilitate large scale public transport.  

Capitalism is defined in Merriam-Webster as, 


  an economic system characterized by private or corporate ownership of capital goods, by investments that are determined by private decision, and by prices, production, and the distribution of goods that are determined mainly by competition in a free market


So clearly, capitalism is a system, but I can't glean from that definition its purpose.

What would most economists consider the function of capitalism?

Please be clear to separate, if you will, this system's function from the functions of other economic systems in your answer.
Capitalism is defined as an economic and political system in which a country's trade and industry are controlled by private owners for profit, rather than by the state.

It functions as an allocation mechanism which generally yields the most optimal results under the Fundamental theorems of welfare economics and prevents issues such as Tragedy of the commons which a communist system would fail to deal with (unless all resources were heavily policed and regulated with knowledge of every consumers utility functions).

Under a pure capitalist system, government intervention in the market place is viewed as harmful.

However according to mainstream economic theory, there is some benefit to have from government intervention when dealing with  externalities, market saturation and responding to Business Cycles.