From: Jens Vollinga Date: Mon, 27 Aug 2007 16:12:51 +0000 (+0000) Subject: lst_to_clifford() and clifford_to_lst() can handle pseudo-vector representation X-Git-Tag: release_1-4-0~9 X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=commitdiff_plain;h=b60ef16e9be16480499da701216b4a5081ee9a97 lst_to_clifford() and clifford_to_lst() can handle pseudo-vector representation now [V.Kisil]. --- diff --git a/check/exam_clifford.cpp b/check/exam_clifford.cpp index 51e34f89..006c0769 100644 --- a/check/exam_clifford.cpp +++ b/check/exam_clifford.cpp @@ -410,13 +410,23 @@ template 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); diff --git a/doc/tutorial/ginac.texi b/doc/tutorial/ginac.texi index 51341f4d..c92e38dc 100644 --- a/doc/tutorial/ginac.texi +++ b/doc/tutorial/ginac.texi @@ -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 diff --git a/ginac/clifford.cpp b/ginac/clifford.cpp index 6e0d36c2..c93e6466 100644 --- a/ginac/clifford.cpp +++ b/ginac/clifford.cpp @@ -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(v).cols() > ex_to(v).rows()) + return v.op(0) * dirac_ONE(ex_to(e).get_representation_label()) + indexed(sub_matrix(ex_to(v), 0, 1, 1, dim), mu_toggle) * e; + else + return v.op(0) * dirac_ONE(ex_to(e).get_representation_label()) + indexed(sub_matrix(ex_to(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(v).nops()) return indexed(matrix(dim, 1, ex_to(v)), mu_toggle) * e; + else if (ex_to(v).nops() - dim == 1) + return v.op(0) * dirac_ONE(ex_to(e).get_representation_label()) + indexed(sub_matrix(matrix(dim+1, 1, ex_to(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(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(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(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))); }