On 2026-02-23 16:43:58, 'Trevor Karn' via sage-devel wrote:
> Hi all,
> 
> I attempted to solve a system of equations today. I am wondering if
> this is a bug. When I run the following code from SageCell I get
> complex solutions despite explicitly assuming x,y,k are real and
> specifying the domain to be 'real':

Sadly, "assumptions don't work" is a long-standing meta bug. The
assume() function makes assumptions primarily through maxima, but not
even maxima uses them consistently. Sympy has its own assumptions,
but sage's assume() does not use them.

The solve() function is not doing anything special to handle them...

  if algorithm == 'sympy':
      from sympy import solve as ssolve
      sympy_f = [s._sympy_() for s in f]
      sympy_vars = tuple([v._sympy_() for v in x])
      ret = ssolve(sympy_f, sympy_vars, dict=True)

so they are not taken into consideration. The "domain" parameter to
solve is also ignored because you have more than one equation. (That
much is vaguely documented, but sucks as a UI.)

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/sage-devel/aZ0ChPN55KfceMC_%40mertle.

Reply via email to