I would consider -1/2 to be valid in the real domain. -1/2 is a real
number and plugging it into the equation produces 0, so it's a
solution.

I think the domain keyword should only be concerned with filtering
solutions. If we also use it to change the meaning of functions in the
expression things start getting more difficult.

You can get the same problem with square roots. Consider
solveset(sqrt(x + 1)/sqrt(x - 1), domain=Reals). The solution ({-1})
when plugged in, gives 0/(2*I), which involves complex numbers. So
should solveset(domain=Reals) change the definition of sqrt to only be
valid for positive numbers?

One of the reasons we default to complex numbers in SymPy is that it
simplifies things everywhere. We don't have to worry about an
algorithm doing something that isn't valid for a restricted "reals
only" function because it somehow goes through the complex plane.

Aaron Meurer

On Sun, Jul 15, 2018 at 11:19 AM, Yathartha Joshi <[email protected]> wrote:
> Consider the following logarithmic equation:
>
> log(3*x) - log(1  - x) - log(4*x + 1)
>
> Wolfram alpha gives the result as `-1/2` and `1/2`, but mentions `-1/2` is
> only valid when considering complex valued logarithm.
>
> So to solve this equation in the `Real` domain, should `-1/2` be considered
> as a solution because substituting it in the equation will give log with
> negative argument and I suppose (I am not sure though) it should not be
> considered in the real domain
>
> When these solutions are checked using checksol() the result is `True` for
> both the cases because the `I*pi` terms get canceled out.
>
> A brief background of this situation:
>
> I was implementing log solver for `_transolve` in #14792 and the idea is to
> convert the equation into a single instance of `log` (using `logcombine`)
> which can further be solved by passing it to `_solveset`, but result
> returned from `solveset` can have unwanted solutions (see this test). To
> remove such solutions `checksol()` can be used but it possesses a problem as
> mentioned above, so I tried a different approach to remove these solutions
> (see here)
>
> The problem is what should be done here, should such solutions be
> considered? If not is the approach used efficient enough to remove
> logarithmic singularities?
>
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/sympy.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sympy/c3915e4d-bb5d-443c-b38c-5f8aa2696478%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CAKgW%3D6LVbuWF_8dFWkjP5Z2BVbhiUgxRyY%3DSeYipuD8ayB0UOA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to