Opened 5 years ago

Closed 5 years ago

# to_poly_solve can return erroneous error

Reported by: Owned by: kcrisman major sage-duplicate/invalid/wontfix symbolics rws, bruno N/A

### Description

```var('beta,N_0,V')
V = 1/2
N = 50
solve(exp(-beta*N_0)*(1/beta*N_0) + 1 - 1/(beta*N_0) - V, beta, to_poly_solve='force')
```

returns the empty solution set, but

```var('beta,N_0,V')
V = 1/2
N = 50
solve(exp(-beta*N_0)*(1/beta*N_0) + 1 - 1/(beta*N_0) - V, beta, to_poly_solve=True)
```

gives a traceback

```----> 4 solve(exp(-beta*N_0)*(Integer(1)/beta*N_0) + Integer(1) - Integer(1)/(beta*N_0) - V, beta, to_poly_solve=True)

/home/sc_serv/sage/local/lib/python2.7/site-packages/sage/symbolic/relation.pyc in solve(f, *args, **kwds)
812     from sage.symbolic.expression import is_Expression
813     if is_Expression(f): # f is a single expression
--> 814         ans = f.solve(*args,**kwds)
815         return ans
816

/home/sc_serv/sage/src/sage/symbolic/expression.pyx in sage.symbolic.expression.Expression.solve (/home/sc_serv/sage/src/build/cythonized/sage/symbolic/expression.cpp:59288)()
10983                             X.append(eq) # we keep this implicit solution
10984                     else:
> 10985                         raise
10986
10987         # make sure all the assumptions are satisfied

/home/sc_serv/sage/src/sage/symbolic/expression.pyx in sage.symbolic.expression.Expression.solve (/home/sc_serv/sage/src/build/cythonized/sage/symbolic/expression.cpp:59055)()
10973                     s = m.to_poly_solve(x, options='algexact:true')
10974                     T = string_to_list_of_solutions(repr(s))
> 10975                     X.extend([t[0] for t in T])
10976                 except TypeError as mess:
10977                     if ignore_exceptions:

TypeError: 'sage.symbolic.expression.Expression' object does not support indexing
```

My guess is that somehow whatever list of solutions is gotten isn't subdivided in the way expected here. We should at the very least catch this, if not fix it completely.

### comment:1 Changed 5 years ago by kcrisman

• Cc rws bruno added
• Milestone changed from sage-8.0 to sage-duplicate/invalid/wontfix
• Status changed from new to needs_review

I suspect this is the same as #20436. If you agree, please set to positive review.

### comment:2 Changed 5 years ago by bruno

• Status changed from needs_review to positive_review

I agree.

### comment:3 Changed 5 years ago by embray

• Resolution set to wontfix
• Status changed from positive_review to closed

Closing tickets in the sage-duplicate/invalid/wontfix module with positive_review (i.e. someone has confirmed they should be closed).

Note: See TracTickets for help on using tickets.