On Jun 22, 2:13 pm, cjung <[email protected]> wrote:
Dear all,

Here's my problem: I've written a function (the scource code below),
which should compute the scalarproduct of two classfunction of a group
G. But there is a little problem with that, the values of the
classfunction are just given as a list of values (one entry for every
conjugacy-class of G). As normal some of these values are roots of
unity, given in the form e^(2*pi*I m/n); if I try to compute the valus
of that function for irreducible characters of the group, then for
some distinct characters the values are not zero. They are near zero
but not at all zero.

Here the code:
def sage_ScalarProd(self,X,Y):
        card=self.card_conjugacyClasses()
        # gives us the cardinality of the conjugacy classes of G
        n=len(card);
        if len(X) != n :
            print "X is not a Classfunction on G."
            return 0
        if len(Y) != n:
            print "Y is not a Classfunction on G."
            return 0
        s=0
        s=QQbar(s)
        for i in range(0,n):
            s=s+QQbar(card[i]) * QQbar(X[i] *Y[i].conjugate());
        s=s/self.order()
        #self.order() gives us the order of that group
        return s

Now an example
C=S.irreducibleCharacters()
#a list of values of the irreducible characters; and indeed these
characters are irreducible
for i in range(0,len(C)):
    print S.sage_ScalarProd(C[1],C[i])
#this gives us:
0.?e-18 + 0.?e-19*I # <- should be zero
1
0.?e-18 + 0.?e-19*I # <- should be zero
0.?e-18 + 0.?e-19*I # <- should be zero
0.?e-18 + 0.?e-19*I # <- should be zero
0
0

#we also hav
C
[[1, 1, 1, 1, 1, 1, 1], [1, e^(4/3*I*pi), e^(2/3*I*pi), 1,
e^(2/3*I*pi),
e^(4/3*I*pi), 1], [1, e^(2/3*I*pi), e^(4/3*I*pi), 1, e^(4/3*I*pi),
e^(2/3*I*pi), 1], [2, 1, 1, -2, -1, -1, 0], [2, e^(2/3*I*pi),
e^(4/3*I*pi), -2, -e^(4/3*I*pi), -e^(2/3*I*pi), 0], [2, e^(4/3*I*pi),
e^(2/3*I*pi), -2, -e^(2/3*I*pi), -e^(4/3*I*pi), 0], [3, 0, 0, 3, 0, 0,
-1]]

My question is now, if this is a bug or just a mistake in my code?

Note that 0.?e-18 does *not* mean that the result is not zero, it just means that it's something numerically close to zero. In generally QQbar avoids doing algebraic resolution until it needs to. (This is a feature, not a bug.)

sage: a = QQbar(sqrt(2)) * QQbar(sqrt(3)) - QQbar(sqrt(6)); a
 0.?e-18
sage: a == 0
 True

sage: a = QQbar(sqrt(-2)) * QQbar(sqrt(3)) - QQbar(sqrt(-6)); a
 0.?e-18*I
sage: a.exactify(); a
 0

--
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to