Thank you for your response.
I made a mistake, wanted (sqrt(x)+2)(sqrt(x)-1).
But, in general, I've got the idea.

On Sunday, April 5, 2015 at 7:45:51 AM UTC+3, Ondřej Čertík wrote:
>
> On Sat, Apr 4, 2015 at 7:15 AM, Paul Royik <[email protected] 
> <javascript:>> wrote: 
> > Hwow can I make sympy factor x+sqrt(x)-2 into (sqrt(x)+1)(sqrt(x)-2) ? 
>
> These two are not equal, are they? 
>
> In [15]: (sqrt(x)+1)*(sqrt(x)-2) 
> Out[15]: (√x - 2)⋅(√x + 1) 
>
> In [16]: expand(_) 
> Out[16]: -√x + x - 2 
>
> I think you got the minus wrong in the sqrt(x) term in x-sqrt(x)-2. 
>
> Anyway, to factor it, I would do: 
>
> In [1]: x = Symbol("x", positive=True) 
>
> In [2]: e = x-sqrt(x)-2 
>
> In [3]: factor(e.subs(x, x**2)).subs(x, sqrt(x)) 
> Out[3]: (√x - 2)⋅(√x + 1) 
>
> In [4]: e = x+sqrt(x)-2 
>
> In [5]: factor(e.subs(x, x**2)).subs(x, sqrt(x)) 
> Out[5]: (√x - 1)⋅(√x + 2) 
>
>
> Ondrej 
>
>
> > 
> > -- 
> > 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] <javascript:>. 
> > To post to this group, send email to [email protected] 
> <javascript:>. 
> > 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/3ca41d24-8764-4f03-9a0a-d327893e15c7%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/fa9ee665-eac0-4be7-8b00-51faef0c8214%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to