Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Factor and/or Rules replacements

  • To: mathgroup at smc.vnet.net
  • Subject: [mg104496] Re: [mg104443] Factor and/or Rules replacements
  • From: Adriano Pascoletti <adriano.pascoletti at dimi.uniud.it>
  • Date: Sun, 1 Nov 2009 17:56:49 -0500 (EST)
  • References: <200911010856.DAA19674@smc.vnet.net>

A possible solution rewrites {x -> rhs} as x-rhs and  apply Times
Adriano Pascoletti


In[1]:= sol = Solve[x^2 + b*x + c == 0, {x}];
Times @@ (sol /. {{x_ -> y_} :> x - y})
Out[2]= ((1/2)*(b - Sqrt[b^2 - 4*c]) + x)*((1/2)*(b + Sqrt[b^2 - 4*c]) + x)
In[3]:= Expand[%]
Out[3]= c + b*x + x^2

2009/11/1 yves <yves.dauphin at solvay.com>

> Hello everybody,
>
> Here is the model problem:
> I tried to obtain the factorisation of x^2+b x +c and expected to get
> something like (x-1/2(-b+Sqrt[b^2-4 c))((x-1/2(-b-Sqrt[b^2-4 c)).
>
> So I tried
> in:Factor[x^2+b x + c] and get
> out: c + b x + x^2
> So my first question what should I have done?
>
> I tried another way
> in:sol=Solve[x^2+b x + c == 0,{x}]; and get the couple of replacement
> rules.
> Next I defined
> in: f=(x-x1)(x-x2)
> and finally I replaced x1 and x2 in succession by
> in:f /. {(sol[[1]] /. x -> x1), (sol[[2]] /. x -> x2)}
> which gave the expected factorisation but enclosed in {}.
> My second question is :
> Is there a simpler way or more compact to replace x1 and x2?
>
> With anticipated thanks.
> Yves
>
>



  • Prev by Date: Re: Factor and/or Rules replacements
  • Next by Date: Re: Factor and/or Rules replacements
  • Previous by thread: Re: Factor and/or Rules replacements
  • Next by thread: Re: Factor and/or Rules replacements