Ask Your Question

emc2fred83's profile - activity

2024-01-06 16:17:14 +0200 received badge  Notable Question (source)
2024-01-06 16:17:14 +0200 received badge  Popular Question (source)
2017-01-18 03:47:24 +0200 commented answer Solve Dictionary bug ?

That's right, i've done this workaround. But I think that the function should handle both a variable lis [x0] or a single variable x0 in the same way. That's why i wrote "Bug ?" in the title

2017-01-17 20:02:43 +0200 asked a question Solve Dictionary bug ?

I try to solve a simple equation, with dictionary option active. But the following example give me a traceback:

> var('x0')
> print solve([2*x0^2], [x0])
> print solve([2*x0^2], [x0], solution_dict=True)

first I got the right answer:

[
x0 == 0
]

and then the traceback is:

--------------------------------------------------------------------------- TypeError
Traceback (most recent call last) <ipython-input-1-3ee9be5134a3> in <module>() 67 var('x0') 68 print solve([Integer(2)x0Integer(2)], [x0]) ---> 69 print solve([Integer(2)x0Integer(2)], [x0], solution_dict=True)

/home/sc_serv/sage/local/lib/python2.7/site-packages/sage/symbolic/relation.pyc in solve(f, args, kwds) 809 if is_Expression(f[0]): 810 # if its a symbolic expression call solve method of this expression --> 811 return f[0].solve(args,kwds) 812 # otherwise complain 813 raise TypeError("The first argument to solve() should be a symbolic "

/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:59166)() 10893 if solution_dict:
10894 if isinstance(x, (list, tuple)):

10895 X = [{sol.left():sol.right() for sol in b} for b in X] 10896 else: 10897 X = [dict([[sol.left(),sol.right()]]) for sol in X]

TypeError: 'sage.symbolic.expression.Expression' object is not iterable