Mathematica Asked by Victoria on December 12, 2020
I want Mathematica to put the circle given by $x^2+y^2+a x+b y+c=0$ into the standard form $(x-A)^2+(y-B)^2+C=0$, but I haven’t been able to.
I tried:
Solve[
CoefficientList[x^2 + y^2 + a x + b y + c = 0, x] ==
CoefficientList[(x - A)^2 + (y - B)^2 + C = 0,
{x, y}]]
but it’s wrong and I don’t understand why.
Updated
sol = Solve[
Thread[CoefficientList[x^2 + y^2 + a x + b y + c, {x, y}] ==
CoefficientList[(x - A)^2 + (y - B)^2 + C, {x, y}]], {A, B, C}]
(* {{A -> -(a/2), B -> -(b/2), C -> 1/4 (-a^2 - b^2 + 4 c)}} *)
HoldForm[(x - A)^2 + (y - B)^2 + C==0] /. First@sol
% // ReleaseHold
Original
Solve[Thread[
CoefficientList[x^2 + y^2 + a x + b y + c, {x, y}] ==
CoefficientList[(x - A)^2 + (y - B)^2 + C, {x, y}]], {a, b, c}]
{{a -> -2 A, b -> -2 B, c -> A^2 + B^2 + C}}
Answered by cvgmt on December 12, 2020
You have the right idea, but go wrong on the details.
rules =
Solve[
CoefficientList[x^2 + y^2 + a x + b y + c, {x, y}] ==
CoefficientList[(x - A)^2 + (y - B)^2 + C, {x, y}],
{A, B, C}]
{{A -> -(a/2), B -> -(b/2), C -> 1/4 (-a^2 - b^2 + 4 c)}}
To show that this is correct transformation:
((x - A)^2 + (y - B)^2 + C == 0 /. rules)[[1]]// Simplify
c + a x + x^2 + b y + y^2 == 0
which is the original equation except that the terms are reordered in the way Mathematica prefers them.
Answered by m_goldberg on December 12, 2020
This is a job for SolveAlways
, but it does not choose from the desired parameters and the extra parameters just the ones desired. So we use the equivalent Solve[!Eliminate[!eqns,vars]]
form, but with the Solve
variables specified.
std = r2 + (x - x1)^2 + (y - y1)^2;
Solve[! Eliminate[! (c + a x + x^2 + b y + y^2 == std), {x, y}], {x1, y1, r2}]
std == 0 /. First[%]
(*
{{x1 -> -(a/2), y1 -> -(b/2), r2 -> 1/4 (-a^2 - b^2 + 4 c)}}
1/4 (-a^2 - b^2 + 4 c) + (a/2 + x)^2 + (b/2 + y)^2 == 0
*)
Answered by Michael E2 on December 12, 2020
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP