# Twists

This section is about twists of newforms by Dirichlet characters. A newform is specified by giving a space of modular symbols that contains a single Galois-orbit (over ${\mathbb{Q}}$ or some extension of ${\mathbb{Q}}$) of newforms. Spaces of this kind are obtained using `NewformDecomposition`.

To prove that $f_2 = f_1^\chi$ holds for two newforms, the program compares their Hecke eigenvalues up to an appropriate Sturm bound. (For instance, a bound of this kind is given in Lemma 1.4 of [[Buzzard and Stein, 2002](../../references.md#cite-buzzardsteinicosahedral)]).

## `IsTwist(M1, M2, p): ModSym, ModSym, RngIntElt -> BoolElt, GrpDrchElt`

Given two spaces `M1` and `M2` of modular symbols that specify newforms $f_1$ and $f_2$ as above, and a prime $p$, this determines whether some Galois conjugate (over ${\mathbb{Q}}$) of $f_2$ is the twist of $f_1$ by a nontrivial Dirichlet character of $p$-power conductor. If so, a character $\chi$ such that $f_2 = f_1^\chi$ is also returned.

## `IsMinimalTwist(M, p): ModSym, RngIntElt -> BoolElt, ModSym, GrpDrchElt`

Given a space `M` of modular symbols that specifies a newform $f$ as above, and a prime $p$, this determines whether some Galois conjugate (over ${\mathbb{Q}}$) of $f$ is a twist of some newform of lower level by some Dirichlet character of $p$-power conductor. If so, it returns `false`, together with the newform of lower level (specified by a space of modular symbols), and the Dirichlet character.

## `Example Twists (ex-1f6206)`

We exhibit a newform that is a twist of itself, namely the only newform of level $9$ and weight $4$. The newform is specified by the space of modular symbols on $\Gamma_0(9)$ of weight $4$ (with sign $1$).

```magma
> M9 := CuspidalSubspace(ModularSymbols(9, 4, 1));
> newforms := NewformDecomposition(NewSubspace(M9));
> newforms;
[
    Modular symbols space for Gamma_0(9) of weight 4 and dimension 1
    over Rational Field
]
> f := newforms[1];
> Eigenform(f, 20);
q - 8*q^4 + 20*q^7 - 70*q^13 + 64*q^16 + 56*q^19 + O(q^20)

```

Note that here the coefficients for primes congruent to $2$ mod $3$ are all zero.

```magma
> bool, chi := IsTwist(f, f, 3);
> bool;
true
> Parent(chi);
Group of Dirichlet characters of modulus 3 over Rational Field
> Conductor(chi), Order(chi);
3 2

```

However, $f$ is not a twist of any newform with lower level:

```magma
> bool := IsMinimalTwist(f, 3);
> bool;
true

```
