This project has moved and is read-only. For the latest updates, please go here.

Implementation of the arithmetic operations


Document concerned

This document deals with arithmetic operations. I am writing this short document to clarify the necessary programming work.


07/12/2016: initial version


Invisible Media


Framework of the project
This project is a digital and algebraic calculation software. This project is a way to train very long and tedious equations and to factor them according to a common approach. Goal: solve equations, find all the solutions algebraically and get an equation based on parameters and fixed digital data.

All the features

The set of features is detailed in this document: All features (unbundled) .xlsx

Name of the feature covered here

Arithmetic operations x 4 positions

Relative need

Neurons are elements of graph also called node. In each node in the graph, there may be 0 to N branches or arc where the other end is the next node.
Arithmetic is a together recurring that perfectly fits the notion of graph. In particular, a complete equation is a tree set of operations. We're talking about graph when a node has multiple parents. An equation where some words are repeated will form a graph where a repeated word is associated with a single node, and each parent node will go on this node.

Relationship with other features


Neurons are objects that can communicate with each other. From the programming point of view, neurons form a directed graph. Then, each neuron with an application that is unique, the application traverses the graph through the neurons that react differently depending on the settings.


There are several arithmetic operations that we consider as exhaustive.
  1. addition
  2. subtraction
  3. multiplication
  4. division
  5. power
  6. power

Mathematical functions such as logarithms and trigonometry will be added later.

The processed equations, for now, are the polynomials of order .

For each of these operations, I distinguished several cases
  1. surgery with two integers
  2. an operation with a free variable and an integer
  3. surgery with two free variables
  4. an operation with a free variable and an unknown variable
  5. surgery with a stranger and an integer
  6. surgery with two unknown variables

These situations are those polynomial equations. I draw attention to the fact that the equations can contain integers. Decimal numbers are handled by the Euclidean division formed by a whole number plus a fraction of a whole number divided by a second largest whole number (also known as rest of the Euclidean division).

Irrational numbers are not taken into account because they are always approximate value; It is not possible to present irrational numbers in an equation as an irrational number is always expressed in the form of a symbol.


An arithmetic neuron therefore contains the following:
  1. surgery
  2. two neurons in greater depth
  3. one or more neurons parent

The presence of a parent neuron is required to perform the numerical calculation of an equation. It is necessary to add limit neurons such as:
  1. a digital neuron : Contains an integer
  2. a neuron containing a free variable: Includes either a variable name, or a reference to the variable or both
  3. a neuron containing an unknown variable: Includes either a variable name, or a reference to the variable or both

Graphic view

Here's the graphic view of a neuron where how it graphically represents a neuron.

add-2-val.png add-2-var.png add-val-var.png add-var-val.png

The two branches on the right are the operands of the operation (here the addition). For each operation, there are 6 configurations.

Manufacture of neurons

I note that here are prefabricated neurons. A given equation, to break down the equation in terms of operations and build the graph of this equation using the templates available to neurons.

So there is an initial background where each neuron has its own function and its own form. I also note that there is only a single main command for an equation: calculate the result of the equation giving a numerical value to each variable. Related variables, to always express the values by using the equation of this variable. For free variables, any numeric value is correct. Finally, for the unknown variables it comes to seek his equation based on the knowledge of the equations on the variables and the values of the free variables.

To calculate the unknown variables, it must be remembered that the mathematical reasoning and algebra accept 2/3 variables to numeric values and one unknown. And usually, for a real function to a real variable, there is that two unknown variables; It is necessary and sufficient to create an intermediate unknown variable to get actually 2/3 variables to numeric values and one unknown.

Other operators are necessary to allow a set of mathematical sequences. Some instructions are needed:
  1. declaring a free variable
  2. declaration of a bound variable
  3. declaration of an unknown variable
  4. equality operator to check
  5. 5 own equality operator
  6. 6 comparison operators
  7. 7 conditional operator: a comparison test, a new sequence if the test result is checked, a new sequence (optional) if the test result is denied.

These instructions are defined by templates of neurons. Construction of neurons is done during syntactic analysis of these instructions by specializing each template.

The constructive form is just the composition of the operator according to a human-readable representation. Also, the first neuron is called the whole equation.

Finally, a heuristic decides the best form to give an equation considering the different models of algebraic operations:
  1. commutativity.
  2. neutral elements,
  3. absorbing elements,
  4. distribution.
  5. factorization.

Last edited Dec 11, 2016 at 10:34 PM by skercrow, version 3