sympy / sympy

A computer algebra system written in pure Python

Home Page:https://sympy.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Does solve(...) respects symbol(..., real=True) assumption?

wli75 opened this issue · comments

commented

Does solve know about symbol assumptions?
I'm surprised sympy suggested the first solution in the following example.

L, a, b, x = symbols("L a b x", negative=False, real=True)

L_eq = Eq(L ** 2, (a + x) ** 2 + (b + (a * b / x)) ** 2)

solve(L_eq, L)
# [
#    (-a - x)*sqrt(b**2 + x**2)/x,     # I'm surprised sympy suggested this
#    (a + x)*sqrt(b**2 + x**2)/x
# ]