Re: express a quadratic, in the form (x+a)^2 + b
- To: mathgroup at smc.vnet.net
- Subject: [mg84359] Re: express a quadratic, in the form (x+a)^2 + b
- From: Camille JORDAN <ynceraj at gmail.com>
- Date: Thu, 20 Dec 2007 00:07:19 -0500 (EST)
- References: <fkan3b$d6k$1@smc.vnet.net>
On Dec 19, 4:08 am, "Joseph Fagan" <noemailple... at nowhere.ru> wrote:
> I'm a Mathematica beginner.
> I wish to express a quadratic, in the form (x+a)^2 + b
> eg to express x^2 + 4x + 7 as (x+2)^2 + 3
> Is there an easy way?
> Thanks
> Joe
Another solution is
the answer is only for quadratics
then
Expand[(x + a)^2 + b]
gives
a^2+b+2ax+x^2
then making equal degrees coefficients equal we get the system
Solve[{a^2 + b == 7, 2 a == 4}, {a, b}]
and that gets you
{{b -> 3, a -> 2}}
applying that to
(x + a)^2 + b /. {b -> 3, a -> 2}
gets you
3 + (2 + x)^2
building the system of equations can be done programaticaly too I just
do not have the time to do it.