# Revision history [back]

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:

1. Name the generator of G, either by g = G.gen() or naming it in the definition:

G.<g> = AbelianGroupWithValues([a], )

2. 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.

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'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:

1. Name the generator of G, either by g = G.gen() or naming it in the definition:

G.<g> = AbelianGroupWithValues([a], )

2. 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.