VasCalc Documentation - vectorSpace: Difference between revisions

From Drorbn
Jump to navigationJump to search
m (Documentation - vectorSpace moved to VasCalc Documentation - vectorSpace)
No edit summary
Line 1: Line 1:
The vectorSpace package is a small package used to set up quotients of finite dimensional vector spaces. The source files for this package are
The vectorSpace package is a small package used to set up quotients of finite dimensional vector spaces, with an interface through Mathematica. By default, vectorSpace works over arbitrarily-sized rationals, using the BigRational implementation written by Eric Laroche (see [[VasCalc - Bibliography]]). See below for instructions on using other fields.


==Installation==
*[http://katlas.math.toronto.edu/svn/VasCalc/trunk/vectorSpace/Coefficient.java Coefficient.java],
If you wish to use this package on its own, follow the directions below.
*[http://katlas.math.toronto.edu/svn/VasCalc/trunk/vectorSpace/QuotientSpace.java QuotientSpace.java],

*[http://katlas.math.toronto.edu/svn/VasCalc/trunk/vectorSpace/AlgebraVector.java AlgebraVector.java].
Create a directory on your file system named <i>vectorSpace</i>, and download the following four files from the repository into it:

*[http://katlas.math.toronto.edu/svn/VasCalc/trunk/vectorSpace/Coefficient.class Coefficient.class],
*[http://katlas.math.toronto.edu/svn/VasCalc/trunk/vectorSpace/QuotientSpace.class QuotientSpace.class],
*[http://katlas.math.toronto.edu/svn/VasCalc/trunk/vectorSpace/AlgebraVector.class AlgebraVector.class],
*[http://katlas.math.toronto.edu/svn/VasCalc/trunk/vectorSpace/BigRational.class BigRational.class].

Also, download [http://katlas.math.toronto.edu/svn/VasCalc/trunk/vectorSpace.m vectorSpace.m] (the Mathematica interface) to any location.

Now open vectorSpace.m in a text editor. Near the top, there is a line that reads
:<code>AddToClassPath["some_path"]</code>

Change <i>some_path</i> to the location in which the directory <i>vectorSpace</i> resides (ie. the parent directory of <i>vectorSpace</i>). Make sure you keep the quotes around the path name.


The class contained in [http://katlas.math.toronto.edu/svn/VasCalc/trunk/vectorSpace/BigRational.java BigRational.java] contains Eric Laroche's implementation of arithemetic involving arbitrarily large rationals (see [[VasCalc - Bibliography]]), which is used as the default base field in vectorSpace. Additionally, there are two small test programs:[http://katlas.math.toronto.edu/svn/VasCalc/trunk/vectorSpace/testQuotSp.java testQuotSp.java] and [http://katlas.math.toronto.edu/svn/VasCalc/trunk/vectorSpace/testAlgVect.java testAlgVect.java].
==Usage==
==Usage==
In Mathematica, type
: <code> In[ ]:= << /path_to_/vectorSpace.m </code>
to load the definitions.

We need to start by setting up a finite-dim vector space to work with. The command NewVS[n] returns a reference to a Java instance of the class QuotientSpace. This class represents a v.s. of dimension n, along with any relations between the basis vectors (described below). Here we create a vector space of dimension 5:

:<code> In[ ] := qs = NewVS[5]; </code>

In the vector space package, vectors are stored as lists of ordered pairs {index, coeff}, where the index refers to a fixed implicit original basis. For convenience, the Mathematica interface allows one to label the basis elements with Mathematica symbols by passing a Basis[..] object to the operations described below, and hence you can use all of Mathematica's symbolic manipulations on these expressions. Note, however, that this labelling does not change the internal representation of the vectors; if you change the basis you use, it's unlikely you'll get meaningful results.

To set up an initial basis, say of elements e0, ... , e4:

:<code> In[] := b= Basis[e0,e1,e2,e3,e4]; </code>

Here are the operations one can perform:
*The command ResolveVector[v, basis] converts a vector as a formal sum into {index, coeff} pairs:
:<code>In[ ]:= ResolveVector[3e1 +2/3 e0 - 2 e2] </code>
:<code>Out[ ] = { {0,2/3}, {1,3}, {2,-2} } </code>

Revision as of 17:13, 29 May 2006

The vectorSpace package is a small package used to set up quotients of finite dimensional vector spaces, with an interface through Mathematica. By default, vectorSpace works over arbitrarily-sized rationals, using the BigRational implementation written by Eric Laroche (see VasCalc - Bibliography). See below for instructions on using other fields.

Installation

If you wish to use this package on its own, follow the directions below.

Create a directory on your file system named vectorSpace, and download the following four files from the repository into it:

Also, download vectorSpace.m (the Mathematica interface) to any location.

Now open vectorSpace.m in a text editor. Near the top, there is a line that reads

AddToClassPath["some_path"]

Change some_path to the location in which the directory vectorSpace resides (ie. the parent directory of vectorSpace). Make sure you keep the quotes around the path name.

Usage

In Mathematica, type

In[ ]:= << /path_to_/vectorSpace.m

to load the definitions.

We need to start by setting up a finite-dim vector space to work with. The command NewVS[n] returns a reference to a Java instance of the class QuotientSpace. This class represents a v.s. of dimension n, along with any relations between the basis vectors (described below). Here we create a vector space of dimension 5:

In[ ] := qs = NewVS[5];

In the vector space package, vectors are stored as lists of ordered pairs {index, coeff}, where the index refers to a fixed implicit original basis. For convenience, the Mathematica interface allows one to label the basis elements with Mathematica symbols by passing a Basis[..] object to the operations described below, and hence you can use all of Mathematica's symbolic manipulations on these expressions. Note, however, that this labelling does not change the internal representation of the vectors; if you change the basis you use, it's unlikely you'll get meaningful results.

To set up an initial basis, say of elements e0, ... , e4:

In[] := b= Basis[e0,e1,e2,e3,e4];

Here are the operations one can perform:

  • The command ResolveVector[v, basis] converts a vector as a formal sum into {index, coeff} pairs:
In[ ]:= ResolveVector[3e1 +2/3 e0 - 2 e2]
Out[ ] = { {0,2/3}, {1,3}, {2,-2} }