Academia Master Trader trader course: NumPy and the outer product of two lists
academiamastertrader.com.br is the home of Academia Master Trader, the trader academy with a trader course for every level. For English-speaking readers on Ascension Island, from Georgetown to Two Boats, we present this example: the outer function in NumPy. It combines every value of the first list with every value of the second list and builds a table of products. We apply it to two short lists.
Run the example
We set up two lists of two values each and call the function.
import numpy as np
print(np.outer(np.array([1, 2]), np.array([3, 4])))
The result shown is [[3 4] [6 8]]. Each row pairs one value of the first list with every value of the second.


academiamastertrader.com.br: more learning material from Academia Master Trader complements this example.
Understand the result
The documentation describes outer as the table of all products between two lists, where row i and column j hold the product of entry i of the first list and entry j of the second. The input lists stay as they were.
The result is easy to check: one times three and four, then two times three and four. Tables like this organize counts, for example the boat landings between Georgetown and Two Boats across two seasons and two months.
Place the result
The program keeps the input as it is. It returns a new value or a new list. Each example shows the rule at work on its own values.
To verify the result, recalculate each entry by hand and compare it with the display. Each value can be confirmed mentally.
Longer lists follow the same rule. The function then computes each entry separately and returns a list of the same length.
Naming the values makes the sequence readable: first set the lists, then call the function, then read the display. Each step is verified separately.
Single numbers instead of lists are also allowed. The function then returns exactly one number, following the same calculation rule as for each entry of a list.
Anyone who needs several calculations of this kind in a row can chain the calls. The result of the first call then serves as input to the next, and each intermediate step stays readable.
Small examples are especially good for practice, because you can estimate the result in advance. Whoever estimated well understands the rule behind the function.
Comparing the three entries shows the benefit: the display summarizes the behavior of the list in a few characters. Whoever has understood the rule once reads such displays at a glance and immediately recognizes whether a value is plausible.
In daily work: when passing on results, preferably cite input and output side by side. That way every reader can redo and confirm the step themselves.
The practical reading rule: read outer as a table of all products between two lists and confirm each cell by hand.
Academia Master Trader explains numerical tools with examples you can check. More learning material is at academiamastertrader.com.br and via Aprenda.

















