Compound interest is a financial term that refers to the exponential nature of interest that compounds over time. But if you gain an intuitive understanding of the concept you can fruitfully apply it to many domains.

Compound interest: Your money makes you money.

Exponential growth: Your new customers get you new customers.

Viral spread: Infected people infect people.

Are you seeing the pattern? These all share the same exponential dynamics. The outcome of the growth becomes an agent of growth itself. You can creatively apply this concept to many situations.

When you’re building a habit like exercising or learning a musical instrument, the skills that you gain become the launching point for the next skills you want to gain. The outcome of your practice is more skills, which makes the next practice more productive. Most achievements are impossible without intuitively grasping this concept.

Here’s a program in Go that will calculate compound interest:

package main

import (
	"fmt"
	"math"
	"os"
)

func main() {
	// Parse numbers from the input provided.
	var initial, rate, years float64
	fmt.Sscanf(os.Args[1], "%f dollars at %f percent for %f years", &initial, &rate, &years)

	// Calculate the compound interest.
	compounded := initial * math.Pow(1.0+(rate/100), years)
	fmt.Printf("will compound to become %v.\n", int(compounded))
}

Let’s run this program to demonstrate a few compound interest examples.

% go build compound.go
% ./compound "1000 dollars at 5 percent for 10 years"  
will compound to become 1628.

% ./compound "1000 dollars at 5 percent for 50 years"
will compound to become 11467.

% ./compound "1000 dollars at 10 percent for 50 years"
will compound to become 117390.

% ./compound "1000 dollars at 15 percent for 50 years"
will compound to become 1083657.

% ./compound "1000 dollars at 15 percent for 100 years"
will compound to become 1174313450.

With compound interest, time becomes your ally.