# Sum of complex numbers

## Inputs

• 1. complex issue - the real number (a from "a+bi")
• 1. complex number - imaginary unit (b from "a+bi")
• 2. complex issue - the real number (a from "a+bi")
• 2. complex number - imaginary unit (b from "a+bi")

## Outputs

• real number (a from "a+bi")
• imaginary unit (b from "a+bi")

## Neuron type

Best algorithm has been found - locked

## Patterns

Pattern Input Output
1
 1. complex issue - the real number (a from "a+bi"): 5 1. complex number - imaginary unit (b from "a+bi"): 8 2. complex issue - the real number (a from "a+bi"): 7 2. complex number - imaginary unit (b from "a+bi"): 2
 real number (a from "a+bi"): 12 imaginary unit (b from "a+bi"): 10
2
 1. complex issue - the real number (a from "a+bi"): 1 1. complex number - imaginary unit (b from "a+bi"): 1 2. complex issue - the real number (a from "a+bi"): 1 2. complex number - imaginary unit (b from "a+bi"): 1
 real number (a from "a+bi"): 2 imaginary unit (b from "a+bi"): 2
3.
 1. complex issue - the real number (a from "a+bi"): 1 1. complex number - imaginary unit (b from "a+bi"): 2 2. complex issue - the real number (a from "a+bi"): 3 2. complex number - imaginary unit (b from "a+bi"): 4
 real number (a from "a+bi"): 4 imaginary unit (b from "a+bi"): 6

• Plus (x + y)

## Algorithm

### Test

```/**
* 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()];
}

/**
* Sum of complex numbers:
*
* @param x1 1. complex issue - the real number (a from "a+bi")
* @param x2 1. complex number - imaginary unit (b from "a+bi")
* @param x3 2. complex issue - the real number (a from "a+bi")
* @param x4 2. complex number - imaginary unit (b from "a+bi")
* @return {Array}
*/
function neuron4(x1, x2, x3, x4)
{
var outputs = [];
outputs[0] = x1;
outputs[1] = x2;
outputs[2] = x3;
outputs[3] = x4;

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

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

return[outputs[4], outputs[5]];
}

```