1 | initial version |

I consider this as a bug, `bell_polynomial(n,k)`

should always be an element of a polynomial ring, see the `OUTPUT`

field of the doc. I am writing a patch for that. Thanks for reporting.

2 | No.2 Revision |

The cause of your problem is that `bell_polynomial(0,0)`

does not return `1`

as a polynomial, but as a rational number.

```
sage: bell_polynomial(0,0)
1
sage: bell_polynomial(0,0).parent()
Rational Field
```

I consider this as a ~~bug, ~~bug : `bell_polynomial(n,k)`

should always be an element of a polynomial ring, ~~see ~~the doc claims explicitely that the output should be "a polynomial in ~~OUTPUT~~n-k+1~~field of the doc. I am writing a patch for that. ~~variables over `\QQ`

". Thanks for ~~reporting.~~reporting. This is now trac ticket 18338.

With the patch applied, you get directly:

```
sage: bell_polynomial(0,0)
1
sage: bell_polynomial(0,0).parent()
Univariate Polynomial Ring in x_1 over Rational Field
sage: for n in (0..4):
....: print [bell_polynomial(n,k) for k in (0..n)]
[1]
[0, x_1]
[0, x_2, x_1^2]
[0, x_3, 3*x_1*x_2, x_1^3]
[0, x_4, 3*x_2^2 + 4*x_1*x_3, 6*x_1^2*x_2, x_1^4]
```

3 | No.3 Revision |

The cause of your problem is that `bell_polynomial(0,0)`

does not return `1`

as a polynomial, but as a rational number.

```
sage: bell_polynomial(0,0)
1
sage: bell_polynomial(0,0).parent()
Rational Field
```

I consider this as a bug : `bell_polynomial(n,k)`

should always be an element of a polynomial ring, the doc claims explicitely that the output should be "a polynomial in `n-k+1`

variables over `\QQ`

". Thanks for reporting. This is now trac ticket 18338~~.~~ (needs review).

With the patch applied, you get directly:

```
sage: bell_polynomial(0,0)
1
sage: bell_polynomial(0,0).parent()
Univariate Polynomial Ring in x_1 over Rational Field
sage: for n in (0..4):
....: print [bell_polynomial(n,k) for k in (0..n)]
[1]
[0, x_1]
[0, x_2, x_1^2]
[0, x_3, 3*x_1*x_2, x_1^3]
[0, x_4, 3*x_2^2 + 4*x_1*x_3, 6*x_1^2*x_2, x_1^4]
```

4 | No.4 Revision |

The cause of your problem is that `bell_polynomial(0,0)`

does not return `1`

as a polynomial, but as a rational number.

```
sage: bell_polynomial(0,0)
1
sage: bell_polynomial(0,0).parent()
Rational Field
```

I consider this as a bug : `bell_polynomial(n,k)`

should always be an element of a polynomial ring, the doc claims explicitely that the output should be "a polynomial in `n-k+1`

variables over `\QQ`

". Thanks for reporting. This is now trac ticket 18338 (needs review).

With the patch applied, you get directly:

```
sage: bell_polynomial(0,0)
1
sage: bell_polynomial(0,0).parent()
Univariate Polynomial Ring in x_1 over Rational Field
sage: for n in (0..4):
....: print [bell_polynomial(n,k) for k in (0..n)]
[1]
[0, x_1]
[0, x_2, x_1^2]
[0, x_3, 3*x_1*x_2, x_1^3]
[0, x_4, 3*x_2^2 + 4*x_1*x_3, 6*x_1^2*x_2, x_1^4]
sage: sage: for n in (0..4):
....: print [bell_polynomial(n,k).coefficients() for k in (0..n)]
[[1]]
[[], [1]]
[[], [1], [1]]
[[], [1], [3], [1]]
[[], [1], [3, 4], [6], [1]]
```

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.