|
From: Dimiter P. <dim...@gm...> - 2023-05-06 21:07:18
|
Here is what I wrote for the clifford packages
permsign(arr):=block([k:0, len, ret:0 ] ,
mode_declare([k, len], fixnum),
if not listp(arr) then return (false),
len:length(arr),
for i:1 thru len do (
if not mapatom(arr[i]) then ret:nil,
for j:i+1 thru len do
if ordergreatp(arr[i], arr[j]) then k:k+1
),
if ret#nil then
if evenp(k) then 1 else -1
else 0
);
best regards,
Dimiter
On Sat, May 6, 2023 at 10:00 AM Daniel Volinski via Maxima-discuss <
max...@li...> wrote:
> Hi Jaime,
>
> Thank you for the input.
> However, this is not what I need.
>
> My original intention was to symmetrize or anti-symmetrize tensors with
> abstract indices.
> For the symmetrization there is no problem because you sum all the
> permutations.
> But for the anti-symmetrization you need to sum all the permutations but
> each one
> should be multiplied by the sign (or parity) of the permutation.
>
> perm_parity([λ,σ,μ]) issues an error: "argument should be a permutation".
>
> Thanks,
>
> Daniel Volinski
>
>
> En viernes, 5 de mayo de 2023, 21:23:23 GMT+3, Jaime Villate <
> vi...@fe...> escribió:
>
>
> On 05/05/23 18:24, Daniel Volinski via Maxima-discuss wrote:
> > Is there a command in Maxima the calculates the sign of a permutation?
> >
> > Given a base permutation (a list) and a test permutation (a list) of
> > the same elements,
> > I would l like a command to calculate the number of switches needed to
> > go from one
> > to the other or (alternatively) whether this number is odd or even.
> >
> Hello Daniel,
>
> Function perm_parity, from additional package combinatorics, will give 0
> if the permutation is even or 1 if it is odd.
>
> Regards,
>
> Jaime
>
> _______________________________________________
> Maxima-discuss mailing list
> Max...@li...
> https://lists.sourceforge.net/lists/listinfo/maxima-discuss
>
|