/*

// ************************* December 15, 2015 **************************************** //

Load the file of your choice. For example:

> load "./dims-201-400.m";

This creates a list "dimensions_list" whose entries are lists [eps_data,K,dim_old,dim_new] with

eps_data:   a list of length two whose first entry is the modulus N of an odd character "eps"
            and whose second entry defines the character uniquely in terms of the image of generators
            for (Z/NZ)^* under the character.

K:          the codomain of the character eps. (This may be larger than the smallest field over which
            eps may be defined. Precisely, in the case in which S_1(N,eps) is non-zero, the field K is
            the smallest one over which *all* the cuspidal eigenforms in S_1(N,eps) are defined.)

dim_old:    the dimension of the old space in S_1(N,eps)

dim_new:    the dimension of the new space in S_1(N,eps)

For example:

> dimensions_list[19];
[* [* 203,
        [ [* 59, -1 *], [* 176,
            a^2
        *] ]
    *],
    Number Field with defining polynomial x^6 - x^5 + x^4 - x^3 + x^2 - x + 1 
    over the Rational Field,
    0, 1
*]


    // ********************************************************************************** //

The function below does the following:

make_character(eps_data,K): returns the Dirichlet character "eps" in DirichletGroup(N,K) associated to eps_data and K.
                            (Here K is a cyclotomic field, but magma views it just as a number field defined by a cyclotomic 
                            polynomial; that is, Type(K) is NumFld and not FldCyc.)


For example:

> eps_data:=dimensions_list[19][1];
> K:=dimensions_list[19][2];
> eps:=make_character(eps_data,K);
> Parent(eps);
Group of Dirichlet characters of modulus 203 over Number Field with defining 
polynomial x^6 - x^5 + x^4 - x^3 + x^2 - x + 1 over the Rational Field
> eps;
$.1*$.2^12
> Order(eps);
14

*/


function make_character(eps_data,K) // returns the character eps attached to f

    N:=eps_data[1];
    gens:=eps_data[2];
    G:=DirichletGroup(N,K);
    // In some levels > 1000 the construction of this group can take an infinity of time!
    
    for eps in Elements(G) do // just look for the character with correct values on the generators
        if [eps(gens[i][1]) eq gens[i][2]: i in [1 .. #gens]] eq [true: i in [1 .. #gens]] then
            return eps;
        end if;
    end for;
    
end function;

