Neural Network for a Basic Truth Table

This Demonstration shows a very basic artificial neural network (ANN) capable of simulating different logical operators. Exclusive OR (XOR) cannot be simulated.


  • [Snapshot]
  • [Snapshot]
  • [Snapshot]


This is a single-layer neural network with three input neurons and the Sign activation function. The set of inputs includes bias, which always fires one and two input variables. The learning starts from random weights on the inputs. Then the row (pattern) from the truth table is chosen at random. If the output of the network is correct then the weights are not adjusted.
In case the output does not match the true value, the weights are corrected according to the following rule: , where is the learning rate, is the input, is the input's weight, the output is given by the network, and is the true output of the logical operator given the supplied input set.
The cycles start again and another pattern is chosen. There is no convergence criterion and a stopping rule of two hundred iterations is used.
The process of convergence of the weights on the inputs is shown at the top. The bottom-right graph illustrates a hyperplane where red and black dots are used to mark false and true statements, respectively. The line separates red and black dots, thus showing that the weights are estimated correctly (except in case of XOR).
Also, the truth table is shown, adding the first column, which is a bias term, while the last column is an output of the logical operator applied to two inputs.
The bottom-left graph provides the structure of the network with the estimates of the weights.
For more information, see Colin Fyfe, Artificial Neural Networks and Information Theory, The University of Paisley: Department of Computing and Information Systems, 2000.
    • Share:

Embed Interactive Demonstration New!

Just copy and paste this snippet of JavaScript code into your website or blog to put the live Demonstration on your site. More details »

Files require Wolfram CDF Player or Mathematica.

Mathematica »
The #1 tool for creating Demonstrations
and anything technical.
Wolfram|Alpha »
Explore anything with the first
computational knowledge engine.
MathWorld »
The web's most extensive
mathematics resource.
Course Assistant Apps »
An app for every course—
right in the palm of your hand.
Wolfram Blog »
Read our views on math,
science, and technology.
Computable Document Format »
The format that makes Demonstrations
(and any information) easy to share and
interact with.
STEM Initiative »
Programs & resources for
educators, schools & students.
Computerbasedmath.org »
Join the initiative for modernizing
math education.
Step-by-Step Solutions »
Walk through homework problems one step at a time, with hints to help along the way.
Wolfram Problem Generator »
Unlimited random practice problems and answers with built-in step-by-step solutions. Practice online or make a printable study sheet.
Wolfram Language »
Knowledge-based programming for everyone.
Powered by Wolfram Mathematica © 2018 Wolfram Demonstrations Project & Contributors  |  Terms of Use  |  Privacy Policy  |  RSS Give us your feedback
Note: To run this Demonstration you need Mathematica 7+ or the free Mathematica Player 7EX
Download or upgrade to Mathematica Player 7EX
I already have Mathematica Player or Mathematica 7+