1 | initial version |

A lambda function is a kind of anonymous map. For example:

```
sage: f = lambda x : 2*x
```

Says "f is the map that sends x to 2*x", and you can check:

```
sage: f(4)
8
```

It is anonymous because you can do:

```
sage: (lambda x : 3*x)(3)
9
```

Then, you can get the documentation of `xmrange_iter`

by typing:

```
sage: xmrange_iter?
```

This makes your residues the image of a product by a map.

Indeed, the first part of res is the list of lists (to be understood as a product):

```
sage: res.iter_list
[[-1, 0, 1, 2], [-1, 0, 1, 2]]
```

and its second part is the map that has to be mapped to any element of the product:

```
sage: res.typ
<function sage.rings.number_field.number_field_ideal.<lambda>>
```

This second argument is the lambda function you want to understand. Let us play with it:

```
sage: res.typ((-1,-1))
-a - 1
sage: res.typ((-1,0))
-1
sage: res.typ((0,1))
a
sage: res.typ((0,2))
2*a
sage: res.typ((3,2))
2*a + 3
```

I am sure you understand what does this lambda function!

Now, the list of residues is just the image of each element of the product $\{-1, 0, 1, 2\} \times \{-1, 0, 1, 2\}$ by the map $(u,v) \mapsto a*u + v*1$, that is:

```
sage: list(res)
[-a - 1,
-1,
a - 1,
2*a - 1,
-a,
0,
a,
2*a,
-a + 1,
1,
a + 1,
2*a + 1,
-a + 2,
2,
a + 2,
2*a + 2]
sage: res.cardinality()
16
```

2 | No.2 Revision |

A lambda function is a kind of anonymous map. For example:

```
sage: f = lambda x : 2*x
```

Says "f is the map that sends x to 2*x", and you can check:

```
sage: f(4)
8
```

It is anonymous because you can do:

```
sage: (lambda x : 3*x)(3)
9
```

Then, you can get the documentation of `xmrange_iter`

by typing:

```
sage: xmrange_iter?
```

This makes your residues the image of a product by a map.

Indeed, the first part of res is the list of lists (to be understood as a product):

```
sage: res.iter_list
[[-1, 0, 1, 2], [-1, 0, 1, 2]]
```

and its second part is the map that has to be mapped to any element of the product:

```
sage: res.typ
<function sage.rings.number_field.number_field_ideal.<lambda>>
```

This second argument is the lambda function you want to understand. Let us play with it:

```
sage: res.typ((-1,-1))
-a - 1
sage: res.typ((-1,0))
-1
sage: res.typ((0,1))
a
sage: res.typ((0,2))
2*a
sage: res.typ((3,2))
2*a + 3
```

I am sure you understand what does this lambda function!

Now, the list of residues is just the image of each element of the product ~~$\{-1, ~~$ \{-1, 0, 1, 2\} \times \{-1, 0, 1, ~~2\}$ ~~2\} $ by the map ~~$(u,v) \mapsto a~~*u + v*1$, `(u,v) --> a*u + v*1`

, that is:

```
sage: list(res)
[-a - 1,
-1,
a - 1,
2*a - 1,
-a,
0,
a,
2*a,
-a + 1,
1,
a + 1,
2*a + 1,
-a + 2,
2,
a + 2,
2*a + 2]
sage: res.cardinality()
16
```

3 | No.3 Revision |

A lambda function is a kind of anonymous map. For example:

```
sage: f = lambda x : 2*x
```

Says "f is the map that sends x to 2*x", and you can check:

```
sage: f(4)
8
```

It is anonymous because you can do:

```
sage: (lambda x : 3*x)(3)
9
```

Then, you can get the documentation of `xmrange_iter`

by typing:

```
sage: xmrange_iter?
```

This makes your residues the image of a product by a map.

Indeed, the first part of res is the list of lists (to be understood as a product):

```
sage: res.iter_list
[[-1, 0, 1, 2], [-1, 0, 1, 2]]
```

and its second part is the map that has to be ~~mapped ~~applied to any element of the product:

```
sage: res.typ
<function sage.rings.number_field.number_field_ideal.<lambda>>
```

This second argument is the lambda function you want to understand. Let us play with it:

```
sage: res.typ((-1,-1))
-a - 1
sage: res.typ((-1,0))
-1
sage: res.typ((0,1))
a
sage: res.typ((0,2))
2*a
sage: res.typ((3,2))
2*a + 3
```

I am sure you understand what does this lambda function!

Now, the list of residues is just the image of each element of the product $ \{-1, 0, 1, 2\} \times \{-1, 0, 1, 2\} $ by the map `(u,v) --> a*u + v*1`

, that is:

```
sage: list(res)
[-a - 1,
-1,
a - 1,
2*a - 1,
-a,
0,
a,
2*a,
-a + 1,
1,
a + 1,
2*a + 1,
-a + 2,
2,
a + 2,
2*a + 2]
sage: res.cardinality()
16
```

4 | No.4 Revision |

A lambda function is a kind of anonymous map. For example:

```
sage: f = lambda x : 2*x
```

Says "f is the map that sends x to 2*x", and you can check:

```
sage: f(4)
8
```

It is anonymous because you can do:

```
sage: (lambda x : 3*x)(3)
9
```

Then, you can get the documentation of `xmrange_iter`

by typing:

```
sage: xmrange_iter?
```

This makes your residues the image of a product by a map.

Indeed, the first part of res is the list of lists (to be understood as a product):

```
sage: res.iter_list
[[-1, 0, 1, 2], [-1, 0, 1, 2]]
```

and its second part is the map that has to be applied to any element of the product:

```
sage: res.typ
<function sage.rings.number_field.number_field_ideal.<lambda>>
```

This second argument is the lambda function you want to understand. Let us play with it:

```
sage: res.typ((-1,-1))
-a - 1
sage: res.typ((-1,0))
-1
sage: res.typ((0,1))
a
sage: res.typ((0,2))
2*a
sage: res.typ((3,2))
2*a + 3
```

I am sure you understand what does this lambda function!

Now, the list of residues is just the image of each element of the product $ \{-1, 0, 1, 2\} \times \{-1, 0, 1, 2\} $ by the map `(u,v) --> `

, that is:~~a*u + v*1~~u*1 + v*a

```
sage: list(res)
[-a - 1,
-1,
a - 1,
2*a - 1,
-a,
0,
a,
2*a,
-a + 1,
1,
a + 1,
2*a + 1,
-a + 2,
2,
a + 2,
2*a + 2]
sage: res.cardinality()
16
```

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.