I've reported this on the issue tracker
https://github.com/sympy/sympy/issues/10161.

Aaron Meurer

On Sat, Apr 11, 2015 at 6:39 AM, Arnaud Usciati <[email protected]> wrote:
> Hello,
>
> I found two issues with factor().
>
> If x = symbols('x', real=True)
> f =  Lambda(x, (-2*x + Abs(x))*Abs(x**2 - 1))
> g = Lambda(x, diff(f(x), x))
>
> Input : g(x)
> Ouput : 2*x*(-2*x + Abs(x))*sign(x**2 - 1) + (sign(x) - 2)*Abs(x**2 - 1)
> Input : factor(g(x))
> Ouput : -4*x**2*sign(x**2 - 1) + 2*x*Abs(x)*sign(x**2 - 1) + Abs(x**2 -
> 1)*sign(x) - 2*Abs(x**2 - 1)
> 1st issue : it's expanded, but factor(g(x)) is always equal to g(x)
>
> Then, I replace 'sign' function by sign(u(x)) = u(x)/abs(u(x))
>
> h = Lambda(x, g(x).subs(sign(x), x/abs(x)).subs(sign(x**2-1),
> (x**2-1)/abs(x**2-1)))
> Input : h(x)
> Ouput : 2*x*(-2*x + Abs(x))*(x**2 - 1)/Abs(x**2 - 1) + (x/Abs(x) -
> 2)*Abs(x**2 - 1)
> That's correct.
>
> But :
>
> hFactor = Lambda(x, factor(h(x)))
> Input : hFactor(x)
> Output : (x - 1)*(x**4 - 6*x**3*Abs(x) + x**3 - 6*x**2*Abs(x) + x**2 +
> 2*x*Abs(x) - x + 2*Abs(x))/(Abs(x)*Abs(x**2 - 1))
> 2nd issue : hFactor(x) is not equal to h(x) !!
>
> For examples :
> h(2) = -11 and hFactor(2) = -53/3
> h(S.Half) = -1/4 and hFactor(S.Half) = -5/12
>
> --
> 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 http://groups.google.com/group/sympy.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sympy/3c465ab0-7787-4ad2-ac3f-f8fd4cfb7cb8%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 http://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CAKgW%3D6%2BAzQ0vrYEu010Gff5Qr%3D1k6LjPB_90T5Couf8LaKnpkw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to