Add2 Function

Add2 adds all the values of a list to each value of the other list


Function

The function Add2 is used to add two lists. Each element of the first list is added to each element of the second list. The result is a table. The size of the table corresponds to the lengths of the list a * list b .

For a simple calculation, the expression x = Add2 (a, b) is identical to x [] = a + b .

For more complex expressions with more than two lists in the arguments, use of the Add2 function can be required. The differences are shown in the examples below.

Available from version 7.12


Syntax

Add2 (a, b)

Examples



In the following example, each line of the result of Add2 (a, b) is added to an element of c.
The result is a table with 3 lines.



In the following example, each element of a, b and c is added together. The result is a three-dimensional data field. The index display shows three consecutive tables.

Practical example

In the following example, the resonance frequency is calculated from three different capacitances C and inductances L. The result is a table containing the results of all possible combinations.