logo back up home forward   further reading more topics »

Maths - EuclideanSpace Program

Warning: This program is not yet in a working state, I am building it from fragements of code that I have used to generate things on this site.

The program allows users to define their own mathematical objects and then to use them in equations, draw graphs, and so on.

The examples of the mathematical types may be:

These are just examples and there are many variations on each type, Examples of the things that we could change are:

These user defined types can also be concatenated. For example we could have a matrix whose elements are complex numbers.

We can also combine types in other ways like Kronecker and Cayley-Dickson products.

So the program user can first create the types that they intend to use, ether by combining more basic types and/or defining options such as those above, or by defining all results of the multiplication table.

Functions and Binary Operations are not part of the type itself but are managed in separate arrays, this is because these operations may convert between different types, an example would be the 'dot' product. This takes two vectors as input and produces a scalar as output. So, when a binary operation is encountered in an equation we do a match to determine which object to use to do the operation.

euclideanspace program top level

Types

The type defines the type of mathematical object, this will be represented by the instance of a class when the program is running and by an XML node when the program is saved. We only need one instance per type, but if we change the number of dimensions or the names of the bases or any other parameters then this will constitute a different type and we will need another instance.

euclideanspace types

As already explained function definitions and binary operation definitions are not part of the type itself but are managed in separate arrays, this is because these operations may convert between different types, an example would be the 'dot' product. This takes two vectors as input and produces a scalar as output. So, when a binary operation is encountered in an equation we do a match to determine which object to use to do the operation.

Multiply

euclideanspace multipy

An instance of Multiply is required for each type of multiplication, for example 'dot' products and 'cross' products require different instances, as do 2D and 3D dot products.

In many ways the types of multipication defined on a given type give it its characteristics. The multipication classes tend to be of 3 types:

The multivector (which includes objects like complex numbers and quaternions) multipications are based on a table.

Functions

euclideanspace functions

An instance of Function is required for each type of function, for example the exponent of a complex variable requires a different instance from the exponent of a matrix.

Evaluate Program

I am working on this program to produce graphs and tables for this site, also to analyse and compare different algebras, it is not yet in a state where it would be useful for others so I have not yet made any code available.

The program will evaluate, simplify, plot and do other operations on mathematical expressions. The program is mostly intended to operate with multivectors and matrices but it can operate with scalars (real numbers) and integers.

As an example of where I have used this program to plot graphs see this page.

As an example of where I have used this program to compare the algebraic properties of different algebras see this page.

The program is driven by an XML configuration file which is like a source code language. I have designed this 'language' to be structured, as far as possible, similar to the Java language. So this program can be thought of as a specialist mathematical compiler. Since the configuration file is based on XML it is tree structured consisting of different types of node which I have listed below. If you would prefer to work in terms of a text based source code there is a semantic analyser available which will convert from a text representation to the XML tree structured representation(see the XES program here.).

Some of the main differences between this language and Java are:

program design choice Java Evaluate
built-in types

int,long,byte,float,double,boolean,String

other types can be built by writing classes

int,scalar,multivector,matrix.
operations on numerical types + - * / and bitwise (&,| and ^ ) +,geometric, inner and outer products.
maths functions Math class library inverse,conjugate,reversal

output functions

extensive built-in class library (mostly low level). outputTable, outputFormula, outputSvg and outputXml.
variable definition

numeric variable types have name, type and visibility only. These cannot be changed when the program is running(static typing).

variable types have lots of parameters like dimension, which dimensions square to -ve. attributes of elements, sub-algebras, etc. These cannot be changed when the program is running(static typing).
variables store numeric values (int or float) can store numeric values or symbolic formula (such as: a*2+b).
     

The program is written in java although perhaps on day it could be written in its own language.

Configuration File (Source Code) Definition

The program holds the mathematical expressions and all its data in a tree structure which it can read and write to an xml file structure.

Nodes

First we define the types of mathematical objects that the program can work with. We only need one of these classes for each type, for instance, if a given 3 dimensional multivector occurs 3 times in an equation we only need one class.

The data structure consists of a tree with the following nodes:

nodes

class

Groups together related variables and procedures.

multiOp

This represents operations like +,*,-,/,and,or

can contain 2 or more operands

uniOp

This represents operations like not,-,invert,conj

variable

Holds an instance of a variable. Just before runtime this is linked to varDef node

constant

holds scalar number or array of numbers to represent the value of an integer, scalar, multivector or matrix.

varDef

This holds the name, visibility and mathType of the variable being defined. Before runtime variables are linked to this and it is linked to the appropriate mathType.

mathType

Defines;

array

Defines array of a given variable

call

calls a given procedure. Before runtime it is linked to procedure definition.

procedure

Defines a procedure. Before runtime calls that us this are linked.

return

Element of procedure which can optionally be used to return a value if required.

assignment

Assigns a value to a variable. contains;

simultaneous

Contains multiple condition nodes, solved mathematically not procedurally.

condition

Has two expression nodes and a relation value.

if

contains a condition node and a group or any other node which is executed if condition is true.

group

groups together other nodes so that a sequence can be represented as one node.

loop

Represents functionality of 'for', 'do' or 'while'.

comment

Text to help readability

Program Operation

The following links are setup just before runtime:

Library Items

library

scalar elements are represented by vaiable-element pair.

outputTable

child nodes;

This can allow the program to compare the multiplication tables (the essence of an algebra - for more information about these "Cayley" tables see this page) of different algebras.

The program generates the multiplication (Caley) table for a given algebra and can then do things like checking for commutivity and associativity, it does this by a sort of brute force method of trying all the possible combinations, if you know a more elegant mathematical method please let me know.

I have not properly validated this program so all these results should be treated as tentative. It is very difficult, take the associativity test, the progam tests (a* b)*c and a*(b * c) where we test every combination of a,b and c each of which, in the case of a clifford algebra based on 4D vectors, can have a value between 0 and 7 giving 8*8*8=512 combinations. If any of these are not associative then this is reported and its easy to check manually, but if the program goes through all combinations and finds the table associative, but how do I confirm that one of these combinations is not wrong?

Also the program only checks the commutivity and associativity of the basis values on their own, if does not check the commutivity and associativity of linear sums of these which make up a complete multivector.

I would like to extend this program to directly compare two multiplication tables. This is quite difficult because we not only need to compare the tables as they stand but also all combinations of swapping and inverting terms.

outputFormula

child nodes;



outputSvc

child nodes:

parameters:

svg parameters

Relationship between x value and pixel horizontal offset

i = pixel horizontal offset

i = C + x*(xAxisPos1 -xAxisPos1)

x = (i-xAxisPos1)/(xAxisPos1 -xAxisPos1)

LeftLimit -> i=0 x = (-xAxisPos1)/(xAxisPos1 -xAxisPos1)

RightLimit -> i=gridWidth x = (gridWidth-xAxisPos1)/(xAxisPos1 -xAxisPos1)

outputXml

child nodes;

Comparison with other programs

There may be other programs in this field, for example Macaulay2, but I have not evaluated it, so I can't really comment about alternatives.


metadata block
see also:

Correspondence about this page

Book Shop - Further reading.

Where I can, I have put links to Amazon for books that are relevant to the subject, click on the appropriate country flag to get more details of the book or to buy it from them.

 

Commercial Software Shop

Where I can, I have put links to Amazon for commercial software, not directly related to this site, but related to the subject being discussed, click on the appropriate country flag to get more details of the software or to buy it from them.

 

Can you help?

Please send me any improvements to here. I would appreciate ideas to make the pages more useful including error correction, ideas for new pages, improvements to wording. It helps if you quote the full URL of the page.

 

progam

I am working on a project which uses these principles, if you would like to help me with this you are welcome to join in, here:

http://sourceforge.net/projects/mjbworld/

This site may have errors. Don't use for critical systems.

Copyright (c) 1998-2010 Martin John Baker - All rights reserved - privacy policy.