# subs into inequality involving RootOf raises GeneratorsNeeded #10092

Closed
opened this Issue Nov 1, 2015 · 2 comments

Projects
None yet
2 participants
Member

### smichr commented Nov 1, 2015

 If x is real then the following generates and error ```>>> from sympy import * >>> var('x', real=True) x >>> eq=RootOf(x**3 - 17*x**2 + 81*x - 118, 0) >>> (x", line 1, in File "sympy\core\basic.py", line 895, in subs rv = rv._subs(old, new, **kwargs) File "sympy\core\cache.py", line 93, in wrapper retval = cfunc(*args, **kwargs) File "sympy\core\compatibility.py", line 880, in wrapper result = user_function(*args, **kwds) File "sympy\core\basic.py", line 1009, in _subs rv = fallback(self, old, new) File "sympy\core\basic.py", line 981, in fallback arg = arg._subs(old, new, **hints) File "sympy\core\cache.py", line 93, in wrapper retval = cfunc(*args, **kwargs) File "sympy\core\compatibility.py", line 880, in wrapper result = user_function(*args, **kwds) File "sympy\core\basic.py", line 1009, in _subs rv = fallback(self, old, new) File "sympy\core\basic.py", line 986, in fallback rv = self.func(*args) File "sympy\polys\rootoftools.py", line 68, in __new__ poly = PurePoly(f, x, greedy=False, expand=expand) File "sympy\polys\polytools.py", line 89, in __new__ return cls._from_expr(rep, opt) File "sympy\polys\polytools.py", line 199, in _from_expr rep, opt = _dict_from_expr(rep, opt) File "sympy\polys\polyutils.py", line 366, in _dict_from_expr rep, gens = _dict_from_expr_no_gens(expr, opt) File "sympy\polys\polyutils.py", line 311, in _dict_from_expr_no_gens (poly,), gens = _parallel_dict_from_expr_no_gens((expr,), opt) File "sympy\polys\polyutils.py", line 272, in _parallel_dict_from_expr_no_gens raise GeneratorsNeeded("specify generators to give %s a meaning" % arg) sympy.polys.polyerrors.GeneratorsNeeded: specify generators to give -17*RootOf(x **3 - 17*x**2 + 81*x - 118, 0)**2 - 118 + RootOf(x**3 - 17*x**2 + 81*x - 118, 0) **3 + 81*RootOf(x**3 - 17*x**2 + 81*x - 118, 0) a meaning``` But a vanilla x does not raise: ``````>>> var('x') x >>> eq=RootOf(x**3 - 17*x**2 + 81*x - 118, 0) >>> (x

Closed

Merged

Contributor

### tyagi-prashant commented Nov 3, 2015

 @smichr it should return a error,right??

Closed

Member

### smichr commented Nov 4, 2015

 PR #10097 just makes subs pass over RootOf -- RootOf is kind of like an atom as I think I discussed in the commit message there. In general, if a subs shouldn't target something it just passes over that object; the behavior is governed by `_eval_subs`. Please feel free to make comments on the PR.

Closed

### skirpichev added a commit to skirpichev/diofant that referenced this issue Jul 16, 2016

``` sympy/sympy#10092: do not allow subs to target args of RootOf ```
```// edited by skirpichev

Signed-off-by: Sergey B Kirpichev <skirpichev@gmail.com>```
``` 7387828 ```

### skirpichev added a commit to skirpichev/diofant that referenced this issue Jul 17, 2016

``` Do not allow subs to target args of RootOf ```
```Closes sympy/sympy#10092

// edited by skirpichev

Signed-off-by: Sergey B Kirpichev <skirpichev@gmail.com>```
``` fedd96e ```

### skirpichev added a commit to skirpichev/diofant that referenced this issue Jul 17, 2016

``` Do not allow subs to target args of RootOf ```
```Closes sympy/sympy#10092

// edited by skirpichev

Signed-off-by: Sergey B Kirpichev <skirpichev@gmail.com>```
``` 60e16f0 ```