# Arithmetic

## `f + g: ModFrmElt, ModFrmElt -> ModFrmElt`

The sum of the modular forms $f$ and $g$.

## `f + g: ModFrmElt, RngSerPowElt -> RngSerPowElt`

The sum of the modular form $f$ and the power series $g$. The $q$-expansion of $f$ must be coercible into the parent of $g$. The sum $g+f$ is also defined, as are the differences $f-g$ and $g-f$.

## `f - g: ModFrmElt, ModFrmElt -> ModFrmElt`

The difference of the modular forms $f$ and $g$.

## `a * f: RngElt, ModFrmElt -> ModFrmElt`

The product of the scalar $a$ and the modular form $f$.

## `f / a: ModFrmElt, RngElt -> ModFrmElt`

The product of the scalar $1/a$ and the modular form $f$.

## `f ^ n: ModFrmElt, RngIntElt -> ModFrmElt`

The power $f^n$ of the modular form $f$, where $n\geq 1$ is an integer.

## `f * g: ModFrmElt, ModFrmElt -> ModFrmElt`

The product of the modular forms $f$ and $g$. The only condition is that the base fields of $f$ and $g$ be the same. The weight of `f*g` is the sum of the weights of $f$ and $g$.

## `Example: Arithmetic (ex-061f7d)`

```magma
> M2 := ModularForms(Gamma0(11), 2);
> f := M2.1;
> g := M2.2;
> f;
1 + 12*q^2 + 12*q^3 + 12*q^4 + 12*q^5 + 24*q^6 + 24*q^7 + O(q^8)
> g;
q - 2*q^2 - q^3 + 2*q^4 + q^5 + 2*q^6 - 2*q^7 + O(q^8)
> f+g;
1 + q + 10*q^2 + 11*q^3 + 14*q^4 + 13*q^5 + 26*q^6 + 22*q^7 + O(q^8)
> 2*f;
2 + 24*q^2 + 24*q^3 + 24*q^4 + 24*q^5 + 48*q^6 + 48*q^7 + O(q^8)
> MQ,phi := BaseExtend(M2, RationalField());
> phi(2*f)/2;
1 + 12*q^2 + 12*q^3 + 12*q^4 + 12*q^5 + 24*q^6 + 24*q^7 + O(q^8)
> f^2;
1 + 24*q^2 + 24*q^3 + 168*q^4 + 312*q^5 + 480*q^6 + 624*q^7 + O(q^8)
> Parent($1);
Space of modular forms on Gamma_0(11) of weight 4 and dimension 4 over
Integer Ring.
> M3 := ModularForms([DirichletGroup(11).1], 3); M3;
Space of modular forms on Gamma_1(11) with character all conjugates of
[$.1], weight 3, and dimension 3 over Integer Ring.
> M3.1*f;
1 + 12*q^2 + 2*q^3 + 6*q^4 - 126*q^5 - 168*q^6 - 384*q^7 + O(q^8)
> Parent($1);
Space of modular forms on Gamma_1(11) of weight 5 and dimension 25
over Integer Ring.

```
