1 | initial version |

This kind of coercion is documented:

On the other hand, Sage has the notion of a coercion, which is a canonical morphism (occasionally up to a conventional choice made by developers) between parents. A coercion from one parent to another must be defined on the whole domain, and always succeeds. As it may be invoked implicitly, it should be obvious and natural (in both the mathematically rigorous and colloquial sense of the word).

Symbolic expressions can be coerced to symbolic matrices of a fixed size:

```
sage: B.parent().has_coerce_map_from(SR)
True
sage: cm = sage.structure.element.get_coercion_model()
sage: cm.explain(B, x, operator.add)
Coercion on right operand via
Coercion map:
From: Symbolic Ring
To: Full MatrixSpace of 3 by 3 dense matrices over Symbolic Ring
Arithmetic performed after coercions.
Result lives in Full MatrixSpace of 3 by 3 dense matrices over Symbolic Ring
Full MatrixSpace of 3 by 3 dense matrices over Symbolic Ring
```

It is because there is a canonical map, mapping $1$ to the identity matrix, which is a morphism of algebras with basis.

Symbolic expressions cannot be coerced to vectors of a fixed size:

```
sage: b.parent().has_coerce_map_from(SR)
False
```

It is because there is no *canonical* map which is a morphism of modules with basis. Of course there exist morphisms, like the $1 \mapsto (1,1,1)$ you suggest, but that is no better than $1 \mapsto (1,0,0)$ or $1 \mapsto (0,0,1)$. There is no obvious natural choice, so there is no coercion.

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.