]> www.ginac.de Git - ginac.git/commitdiff
lst_to_clifford() and clifford_to_lst() can handle pseudo-vector representation
authorJens Vollinga <vollinga@thep.physik.uni-mainz.de>
Mon, 27 Aug 2007 16:12:51 +0000 (16:12 +0000)
committerJens Vollinga <vollinga@thep.physik.uni-mainz.de>
Mon, 27 Aug 2007 16:12:51 +0000 (16:12 +0000)
now [V.Kisil].

check/exam_clifford.cpp
doc/tutorial/ginac.texi
ginac/clifford.cpp

index 51e34f899878bbf0e7ee077c1746697561195609..006c07694a6595dcc634faddaaee7f9210833d14 100644 (file)
@@ -410,13 +410,23 @@ template <typename IDX> unsigned clifford_check6(const matrix &A)
        result += check_equal(canonicalize_clifford(e), 0);
 
 /* lst_to_clifford() and clifford_inverse()  check*/
-       realsymbol x("x"), y("y"), t("t"), z("z");
+       realsymbol s("s"), t("t"), x("x"), y("y"), z("z");
 
        ex c = clifford_unit(nu, A, 1);
        e = lst_to_clifford(lst(t, x, y, z), mu, A, 1) * lst_to_clifford(lst(1, 2, 3, 4), c);
        e1 = clifford_inverse(e);
        result += check_equal_simplify_term2((e*e1).simplify_indexed(), dirac_ONE(1));
 
+/* lst_to_clifford() and clifford_to_lst()  check for vectors*/
+       e = lst(t, x, y, z);
+       result += check_equal_lst(clifford_to_lst(lst_to_clifford(e, c), c, false), e);
+       result += check_equal_lst(clifford_to_lst(lst_to_clifford(e, c), c, true), e);
+
+/* lst_to_clifford() and clifford_to_lst()  check for pseudovectors*/
+       e = lst(s, t, x, y, z);
+       result += check_equal_lst(clifford_to_lst(lst_to_clifford(e, c), c, false), e);
+       result += check_equal_lst(clifford_to_lst(lst_to_clifford(e, c), c, true), e);
+
 /* Moebius map (both forms) checks for symmetric metrics only */
        matrix M1(2, 2),  M2(2, 2);
        c = clifford_unit(nu, A);
index 51341f4dd2f2f16075b676378d9f091ebec35cfd..c92e38dcf9b8e6112b9919d9cbab8433d4b52964 100644 (file)
@@ -3401,8 +3401,20 @@ $v^0 e_0 + v^1 e_1 + ... + v^n e_n$
 with @samp{e.k}
 directly supplied in the second form of the procedure. In the first form
 the Clifford unit @samp{e.k} is generated by the call of
-@code{clifford_unit(mu, metr, rl)}. The previous code may be rewritten
-with the help of @code{lst_to_clifford()} as follows
+@code{clifford_unit(mu, metr, rl)}. 
+@cindex pseudo-vector
+If the number of components supplied
+by @code{v} exceeds the dimensionality of the Clifford unit @code{e} by
+1 then function @code{lst_to_clifford()} uses the following
+pseudo-vector representation: 
+@tex
+$v^0 {\bf 1} + v^1 e_0 + v^2 e_1 + ... + v^{n+1} e_n$
+@end tex
+@ifnottex
+@samp{v~0 ONE + v~1 e.0 + v~2 e.1 + ... + v~[n+1] e.n}
+@end ifnottex
+
+The previous code may be rewritten with the help of @code{lst_to_clifford()} as follows
 
 @example
 @{
@@ -3432,17 +3444,25 @@ $v = (v^0, v^1, ..., v^n)$
 @ifnottex
 @samp{v = (v~0, v~1, ..., v~n)} 
 @end ifnottex
-such that 
+such that the expression is either vector 
 @tex
 $e = v^0 c_0 + v^1 c_1 + ... + v^n c_n$
 @end tex
 @ifnottex
 @samp{e = v~0 c.0 + v~1 c.1 + ... + v~n c.n}
 @end ifnottex
-with respect to the given Clifford units @code{c} and with none of the
-@samp{v~k} containing Clifford units @code{c} (of course, this
+or pseudo-vector 
+@tex
+$v^0 {\bf 1} + v^1 e_0 + v^2 e_1 + ... + v^{n+1} e_n$
+@end tex
+@ifnottex
+@samp{v~0 ONE + v~1 e.0 + v~2 e.1 + ... + v~[n+1] e.n}
+@end ifnottex
+with respect to the given Clifford units @code{c}. Here none of the
+@samp{v~k} should contain Clifford units @code{c} (of course, this
 may be impossible). This function can use an @code{algebraic} method
-(default) or a symbolic one. With the @code{algebraic} method the @samp{v~k} are calculated as
+(default) or a symbolic one. With the @code{algebraic} method the
+@samp{v~k} are calculated as 
 @tex
 $(e c_k + c_k e)/c_k^2$. If $c_k^2$
 @end tex
index 6e0d36c25fa5c0206a76d2041e3e707557f2959f..c93e6466d092b06a9cd3aeb7aeb95b70c9bc0fc7 100644 (file)
@@ -1183,13 +1183,20 @@ ex lst_to_clifford(const ex & v, const ex & e) {
                        if (min == 1) {
                                if (dim == max)
                                        return indexed(v, mu_toggle) * e;
-                               else
+                               else if (max - dim == 1) {
+                                       if (ex_to<matrix>(v).cols() > ex_to<matrix>(v).rows())
+                                               return v.op(0) * dirac_ONE(ex_to<clifford>(e).get_representation_label()) + indexed(sub_matrix(ex_to<matrix>(v), 0, 1, 1, dim), mu_toggle) * e;
+                                       else 
+                                               return v.op(0) * dirac_ONE(ex_to<clifford>(e).get_representation_label()) + indexed(sub_matrix(ex_to<matrix>(v), 1, dim, 0, 1), mu_toggle) * e;
+                               } else
                                        throw(std::invalid_argument("lst_to_clifford(): dimensions of vector and clifford unit mismatch"));
                        } else
                                throw(std::invalid_argument("lst_to_clifford(): first argument should be a vector (nx1 or 1xn matrix)"));
                } else if (v.info(info_flags::list)) {
                        if (dim == ex_to<lst>(v).nops())
                                return indexed(matrix(dim, 1, ex_to<lst>(v)), mu_toggle) * e;
+                       else if (ex_to<lst>(v).nops() - dim == 1)
+                               return v.op(0) * dirac_ONE(ex_to<clifford>(e).get_representation_label()) + indexed(sub_matrix(matrix(dim+1, 1, ex_to<lst>(v)), 1, dim, 0, 1), mu_toggle) * e;
                        else
                                throw(std::invalid_argument("lst_to_clifford(): list length and dimension of clifford unit mismatch"));
                } else
@@ -1274,19 +1281,28 @@ lst clifford_to_lst(const ex & e, const ex & c, bool algebraic)
                                or (not is_a<numeric>(pow(c.subs(mu == i, subs_options::no_pattern), 2))))
                                algebraic = false;
        lst V; 
+       ex v0 = remove_dirac_ONE(canonicalize_clifford(e+clifford_prime(e)).normal())/2;
+       if (not v0.is_zero())
+               V.append(v0);
+       ex e1 = canonicalize_clifford(e - v0 * dirac_ONE(ex_to<clifford>(c).get_representation_label())); 
        if (algebraic) {
                for (unsigned int i = 0; i < D; i++) 
                        V.append(remove_dirac_ONE(
-                                               simplify_indexed(canonicalize_clifford(e * c.subs(mu == i, subs_options::no_pattern) +  c.subs(mu == i, subs_options::no_pattern) * e))
+                                               simplify_indexed(canonicalize_clifford(e1 * c.subs(mu == i, subs_options::no_pattern) +  c.subs(mu == i, subs_options::no_pattern) * e1))
                                                / (2*pow(c.subs(mu == i, subs_options::no_pattern), 2))));
        } else {
-               ex e1 = canonicalize_clifford(e);
                try {
                        for (unsigned int i = 0; i < D; i++) 
                                V.append(get_clifford_comp(e1, c.subs(c.op(1) == i, subs_options::no_pattern)));
                } catch  (std::exception &p) {
                        /* Try to expand dummy summations to simplify the expression*/
-                       e1 = canonicalize_clifford(expand_dummy_sum(e1, true));
+                       e1 = canonicalize_clifford(expand_dummy_sum(e, true));
+                       V.remove_all();
+                       v0 = remove_dirac_ONE(canonicalize_clifford(e1+clifford_prime(e1)).normal())/2;
+                       if (not v0.is_zero()) {
+                               V.append(v0);
+                               e1 = canonicalize_clifford(e1 - v0 * dirac_ONE(ex_to<clifford>(c).get_representation_label())); 
+                       }
                        for (unsigned int i = 0; i < D; i++) 
                                V.append(get_clifford_comp(e1, c.subs(c.op(1) == i, subs_options::no_pattern)));
                }