I'm not really sure why simplify() simplifies asin(sin(x)) to x. I
agree that's more problematic. By default, it remains unevaluated. We
should look into it, and perhaps consider removing that behavior.

It's definitely a different thing. When you convert (x**2 + x)/x to x
+ 1, you expand the domain (by a single point, x=0). But when you
convert asin(sin(x)) to x, that restricts the domain (to [-pi/2,
pi/2], at least for real x).

Typically in SymPy forcibly restricting the domain of a variable
requires some kind of force=True flag. For instance, logcombine(log(x)
+ log(y)) requires force=True for the default assumptions on x and y
to give log(x*y), since it's only valid for certain x and y (e.g., if
they are both positive).

Aaron Meurer

On Mon, Oct 23, 2017 at 2:17 AM, EKW <[email protected]> wrote:
> And I guess there's a similar rational for simplifying asin(sin(x)) to x?
> This one seems harder to justify since, for example, asin(sin(10)) is
> -0.575222039230620 which is obviously not equal to 10.
>
> On Tuesday, October 17, 2017 at 5:08:32 PM UTC-7, EKW wrote:
>>
>> >>> from sympy import *
>> >>> x = Symbol('x')
>>
>> >>> p = (x**2 + x) / ((x - 1)*(x + 1))
>> >>> print(p)
>> (x**2 + x)/((x - 1)*(x + 1))
>> >>> p = simplify(p)
>> >>> print(p)
>> x/(x - 1)
>>
>>
>> This simplification is only valid for x != -1, and I haven't specified any
>> restrictions on the range of x. Was this done on purpose, and if so why?
>
> --
> 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/52a88afc-3429-428a-ad33-2130b0fc1025%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%3D6LagHacQBQCDzHFpbn_ZRNNuBJaEK0vXD-ONXo79PX5MA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to