| 1 | initial version |
If you expand the traceback you see that it is trying to construct an AbelianGroupElement from the input a (of type FiniteField_givaroElement), which does not work because the constructor expects exponents (of type tuple) as the first argument (over which it tries to iterate).
I don't think phi = G.convert_map_from(F) should be expected to work in this case, because to calculate phi(x) for arbitrary x in F it would have to solve for $k$ in the equation $x = a^k$ (discrete logarithm problem).
However, you can still define the desired map yourself, e.g. as follows:
Name the generator of G, either by g = G.gen() or naming it in the definition:
G.<g> = AbelianGroupWithValues([a], [48])
Define the map conversion_map = lambda x: g^x.log(a).
For example, conversion_map(a^50) yields g^2 in G, and conversion_map(a^50).value() == a^50 is True.
Remark: The documentation warns that x.log(a) is currently implemented inefficiently.
| 2 | No.2 Revision |
If you expand the traceback you see that it is trying to construct an AbelianGroupElement from the input a (of type FiniteField_givaroElement), which does not work because the constructor expects exponents (of type tuple) as the first second argument (over which it tries to iterate).
I don't think ) instead.
I'm not sure phi = G.convert_map_from(F) should be expected to work in this case, because to calculate phi(x) for arbitrary x in F it would have to solve for $k$ in the equation $x = a^k$ (discrete logarithm problem).
However, you can still define the desired map yourself, e.g. as follows:
Name the generator of G, either by g = G.gen() or naming it in the definition:
G.<g> = AbelianGroupWithValues([a], [48])
Define the map conversion_map = lambda x: g^x.log(a).
For example, conversion_map(a^50) yields g^2 in G, and conversion_map(a^50).value() == a^50 is True.
Remark: The documentation warns that x.log(a) is currently implemented inefficiently.
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.