Compound interest: annual compounding

Inputs

  • principal amount
  • rate of interest (annual)
  • number of years

Outputs

  • future value (or end-of-period value or terminal value)

Neuron type

Best algorithm has been found - locked

Patterns

Pattern Input Output
1.
principal amount: 1000
rate of interest (annual): 10
number of years: 2
future value (or end-of-period value or terminal value): 1210
2.
principal amount: 1000
rate of interest (annual): 6
number of years: 5
future value (or end-of-period value or terminal value): 1338.23
3.
principal amount: 10000
rate of interest (annual): 5
number of years: 3
future value (or end-of-period value or terminal value): 11576.25

Applicable neurons

  • Multiple (x × y)
  • Division (x ÷ y)
  • x to the a (xª)
  • Percentage (X% / 100)
  • x + 1
  • Rounding to whole hundredths of something
  • character <
  • character l
  • tag title
  • \\d
  • empty string
  • character y
  • String can contains only characters, digits, space
  • seconds per day

Algorithm

Test

Code made by AI:
/**
 * 1: 
 *
 * @return {Array}
 */
function neuron501()
{
return [1];
}

/**
 * 0: 
 *
 * @return {Array}
 */
function neuron500()
{
return [0];
}

/**
 * Connect - two inputs: 
 *
 * @param x1 Variable A
 * @param x2 Variable B
 * @return {Array}
 */
function neuron520(x1, x2)
{
return [x1.toString()+x2.toString()];
}

/**
 * 100: 
 * 
 * @return {Array}
 */
function neuron537()
{
  var outputs = [];

  arr = neuron501();
  outputs[0] = arr[0];

  arr = neuron500();
  outputs[1] = arr[0];

  arr = neuron520(outputs[1], outputs[1]);
  outputs[2] = arr[0];

  arr = neuron520(outputs[0], outputs[2]);
  outputs[3] = arr[0];

  return[outputs[3]];
}


/**
 * Division (x ÷ y): X / Y
 *
 * @param x1 first number
 * @param x2 second number
 * @return {Array}
 */
function neuron17(x1, x2)
{
math.config({number: 'BigNumber', precision: 64}); return [math.eval(Number(x1) + '/'+Number(x2)).toString()];
}

/**
 * Percentage (X% / 100): 
 * 
 * @param x1 Number in percentage
 * @return {Array}
 */
function neuron536(x1)
{
  var outputs = [];
  outputs[0] = x1;

  arr = neuron537();
  outputs[1] = arr[0];

  arr = neuron17(outputs[0], outputs[1]);
  outputs[2] = arr[0];

  return[outputs[2]];
}


/**
 * 1: 
 *
 * @return {Array}
 */
function neuron501()
{
return [1];
}

/**
 * Plus (x + y): The addition of two whole numbers is the total amount of those quantities combined.
 *
 * @param x1 first number
 * @param x2 second number
 * @return {Array}
 */
function neuron1(x1, x2)
{
math.config({number: 'BigNumber', precision: 64}); return [math.eval(Number(x1) + '+'+Number(x2)).toString()];
}

/**
 * x + 1: 
 * 
 * @param x1 x
 * @return {Array}
 */
function neuron596(x1)
{
  var outputs = [];
  outputs[0] = x1;

  arr = neuron501();
  outputs[1] = arr[0];

  arr = neuron1(outputs[1], outputs[0]);
  outputs[2] = arr[0];

  return[outputs[2]];
}


/**
 * x to the a  (xª): value of the number x to be the power of a
 *
 * @param x1 x - The base
 * @param x2 a - The exponent
 * @return {Array}
 */
function neuron18(x1, x2)
{
return[Math.pow(Number(x1), Number(x2))];
}

/**
 * 1: 
 *
 * @return {Array}
 */
function neuron501()
{
return [1];
}

/**
 * 0: 
 *
 * @return {Array}
 */
function neuron500()
{
return [0];
}

/**
 * Connect - two inputs: 
 *
 * @param x1 Variable A
 * @param x2 Variable B
 * @return {Array}
 */
function neuron520(x1, x2)
{
return [x1.toString()+x2.toString()];
}

/**
 * 100: 
 * 
 * @return {Array}
 */
function neuron537()
{
  var outputs = [];

  arr = neuron501();
  outputs[0] = arr[0];

  arr = neuron500();
  outputs[1] = arr[0];

  arr = neuron520(outputs[1], outputs[1]);
  outputs[2] = arr[0];

  arr = neuron520(outputs[0], outputs[2]);
  outputs[3] = arr[0];

  return[outputs[3]];
}


/**
 * Multiple (x × y): 
 *
 * @param x1 Number X
 * @param x2 Number Y
 * @return {Array}
 */
function neuron3(x1, x2)
{
math.config({number: 'BigNumber', precision: 64}); return [math.eval(Number(x1) + '*'+Number(x2)).toString()];
}

/**
 * Round to an integer: round(x)
 *
 * @param x1 Value
 * @return {Array}
 */
function neuron620(x1)
{
return[Math.round(Number(x1))]
}

/**
 * Division (x ÷ y): X / Y
 *
 * @param x1 first number
 * @param x2 second number
 * @return {Array}
 */
function neuron17(x1, x2)
{
math.config({number: 'BigNumber', precision: 64}); return [math.eval(Number(x1) + '/'+Number(x2)).toString()];
}

/**
 * Rounding to whole hundredths of something: round(x, 2)
 * 
 * @param x1 Value
 * @return {Array}
 */
function neuron623(x1)
{
  var outputs = [];
  outputs[0] = x1;

  arr = neuron537();
  outputs[1] = arr[0];

  arr = neuron3(outputs[1], outputs[0]);
  outputs[2] = arr[0];

  arr = neuron620(outputs[2]);
  outputs[3] = arr[0];

  arr = neuron17(outputs[3], outputs[1]);
  outputs[4] = arr[0];

  return[outputs[4]];
}


/**
 * Multiple (x × y): 
 *
 * @param x1 Number X
 * @param x2 Number Y
 * @return {Array}
 */
function neuron3(x1, x2)
{
math.config({number: 'BigNumber', precision: 64}); return [math.eval(Number(x1) + '*'+Number(x2)).toString()];
}

/**
 * Compound interest: annual compounding: 
 * 
 * @param x1 principal amount
 * @param x2 rate of interest (annual)
 * @param x3 number of years
 * @return {Array}
 */
function neuron538(x1, x2, x3)
{
  var outputs = [];
  outputs[0] = x1;
  outputs[1] = x2;
  outputs[2] = x3;

  arr = neuron536(outputs[1]);
  outputs[3] = arr[0];

  arr = neuron596(outputs[3]);
  outputs[4] = arr[0];

  arr = neuron18(outputs[4], outputs[2]);
  outputs[5] = arr[0];

  arr = neuron623(outputs[0]);
  outputs[6] = arr[0];

  arr = neuron3(outputs[6], outputs[5]);
  outputs[7] = arr[0];

  arr = neuron536(outputs[6]);
  outputs[8] = arr[0];

  arr = neuron623(outputs[7]);
  outputs[9] = arr[0];

  arr = neuron18(outputs[3], outputs[2]);
  outputs[10] = arr[0];

  arr = neuron596(outputs[4]);
  outputs[11] = arr[0];

  return[outputs[9]];
}


Code made by AI:

Create your family tree for free