[GiNaC-list] Question

Javier Ros Ganuza jros at unavarra.es
Thu Jun 16 22:28:11 CEST 2005


Hello!.

I'm evaluating Ginac in order to replace my own symbolic manipulator for
a program, 3D_Mec, for dynamical simulation of multibody systems. I've
been for some days reading at C++ books and Ginac own documentation in
order to see it it fit my needs (Experience in C an OO Pascal but no C+
+).

I think that the answer is yes, but I need to do some simple tests
in order to evaluate it more properly.

I see that using the plain functionality that Ginac provides is pretty
easy
but when dealing with own types of symbolic data the problem surpasses
my knowledge, so I'm asking for help on how to start or in how to focus
my problem.

Well, in fact I have some problems, but I'll will start for the most
important one to me.

Nevertheless I will somehow simplify the problem in order to make it
more understandable and easy to ask/answer.

The problem:

I want to do algebra with cartesian (3x1) "vectors". Cartesian "vector"s
are to be represented by a 3x1 Ginac vector (3-tuple) and a reference to
a basis that tell us in which base the components have physical sense.

for example (in my particular jargon):

vector1.expresion=matrix(3,1,lst(a1,b1,c1));
vector1.basis=basis_k;
vector2.expresion=matrix(3,1,lst(a2,b2,c2));
vector1.basis=basis_l;

result=2*vector1+vector2;

The last sentence will not have sense unless, when the summation is
performed, the vectors are transformed to be expressed in the same
basis. The result will get expressed in that same basis.

Obviously I need more operators but I hope the above example will
suffice.

There is a base structure -with elements basis_k and l and others- that
has a tree structure form. That structure allow us to decide to which
base reduce the operation of the binary operator -base_m for example-,
and to obtain the pertinent change of base matrices, so that the
symbolic result keeps as simple as possible (transform every vector to a
single basis gives usually symbolic complexity).

To which base to transform an the transformation, should be made by the
binary operator.

For example if there is a third "vector" in base_j and left to right
evaluation is assumed

result=2*vector1+vector2+vector3

The summation vector1+vector2, will render as above a result in base_m
and the second summation (vector1+vector2)+vector3, will render the
result in a different base_n, that will be chosen at the time this last
summation is performed (by inquiring base structure).

Thus the question is, can be such a "cartesian vector" type be defined
within Ginac philosophy?, or should I define a new kind of expression
type of my own. (is it very complex?, assumed that the base structure
and associated functions is implemented).

I've read at the tutorial,  through section 6.4 and 6.5. Is any of that
philosophies the way to go?. I'm not sure, and I'm facing a big gap from
what I want to do and what there is explained (or what I do understand).

Can you give me some advice?.

Thanks a lot

Javier Ros















More information about the GiNaC-list mailing list