To start we will realize the logical OR function with a perceptron. The perceptron will have three inputs, the first \(x_{0}\) for the bias term, the second \(x_{1}\) for the logical expression 1 and the third \(x_{2}\) for the logical expression 2. This task is straightforward, setting weight for the bias term to zero \(w_{0}=0\), and the two other weights to one \(w_{1}=1,w_{2}=1\).
$$output = f_{thres}(w_{1}*x_{1} + w_{2}*x_{2} + w_{0}*x_{0}) $$
the program below computes the truth table for a perceptron with weights \(w_{i} = 0,1,1\), which results in the or-function. With two inputs there are \(2^2=4\) possible combinations of the two inputs, the bias term being constant.