Here is the essence of it.

sage: QQbar(e^(4/3*I*pi)*e^(2/3*I*pi).conjugate())
-0.500000000000000? + 0.866025403784439?*I

QQbar is not exactly a symbolic ring.  In fact, in its documentation
we have

sage: QQbar.zeta(3)
-0.500000000000000? + 0.866025403784439?*I

I'm not quite sure how to fix this, though.  What happens if you leave
all your elements symbolic (get rid of all QQbar in your code)?  You
might have to do s.simplify_full() at the end, but it could work; it's
hard to tell since you have several things in your code (such as S!)
which we don't have access to.

Good luck!

-kcrisman

On Jun 22, 2:13 pm, cjung <cjun...@gmx.de> 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?
>
> Okay, thanks to all looking this up.
>
> best regards
>
> Christian

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

Reply via email to