How To Find Center Of A Circle From Equation
Equation of circle from center and radius
Given the center of circumvolve (x1, y1) and its radius r, detect the equation of the circle having center (x1, y1) and having radius r.
Examples:
Input : x1 = 2, y1 = -three, r = viii
Output : x^2 + y^two – 4*x + half dozen*y = 51.
Input : x1 = 0, y1 = 0, r = 2
Output : x^2 + y^two – 0*x + 0*y = 4.
Approach:
Given the center of circle (x1, y1) and its radius r, we take to find the equation of the circle having center (x1, y1) and having radius r.
the equation of circle having middle (x1, y1) and having radius r is given by :-
on expanding above equation
on arranging to a higher place we become
Below is the implementation of above approach:
C++
#include <iostream>
using
namespace
std;
void
circle_equation(
double
x1,
double
y1,
double
r)
{
double
a = -two * x1;
double
b = -2 * y1;
double
c = (r * r) - (x1 * x1) - (y1 * y1);
cout <<
"x^2 + ("
<< a <<
" x) + "
;
cout <<
"y^ii + ("
<< b <<
" y) = "
;
cout << c <<
"."
<< endl;
}
int
main()
{
double
x1 = two, y1 = -3, r = 8;
circle_equation(x1, y1, r);
return
0;
}
Coffee
import
java.util.*;
form
solution
{
static
void
circle_equation(
double
x1,
double
y1,
double
r)
{
double
a = -
2
* x1;
double
b = -
ii
* y1;
double
c = (r * r) - (x1 * x1) - (y1 * y1);
System.out.print(
"x^2 + ("
+a+
" 10) + "
);
System.out.print(
"y^2 + ("
+b +
" y) = "
);
System.out.println(c +
"."
);
}
public
static
void
primary(String arr[])
{
double
x1 =
two
, y1 = -
3
, r =
8
;
circle_equation(x1, y1, r);
}
}
Python3
def
circle_equation(x1, y1, r):
a
=
-
2
*
x1;
b
=
-
two
*
y1;
c
=
(r
*
r)
-
(x1
*
x1)
-
(y1
*
y1);
impress
(
"x^2 + ("
, a,
"ten) + "
, terminate
=
"");
print
(
"y^two + ("
, b,
"y) = "
, terminate
=
"");
impress
(c,
"."
);
x1
=
2
;
y1
=
-
three
;
r
=
viii
;
circle_equation(x1, y1, r);
C#
using
Organization;
class
GFG
{
public
static
void
circle_equation(
double
x1,
double
y1,
double
r)
{
double
a = -2 * x1;
double
b = -ii * y1;
double
c = (r * r) - (x1 * x1) - (y1 * y1);
Console.Write(
"x^2 + ("
+ a +
" x) + "
);
Panel.Write(
"y^2 + ("
+ b +
" y) = "
);
Console.WriteLine(c +
"."
);
}
public
static
void
Master(
string
[]arr)
{
double
x1 = ii, y1 = -3, r = eight;
circle_equation(x1, y1, r);
}
}
PHP
<?php
function
circle_equation(
$x1
,
$y1
,
$r
)
{
$a
= -2 *
$x1
;
$b
= -2 *
$y1
;
$c
= (
$r
*
$r
) - (
$x1
*
$x1
) -
(
$y1
*
$y1
);
repeat
"x^2 + ("
.
$a
.
" x) + "
;
echo
"y^2 + ("
.
$b
.
" y) = "
;
echo
$c
.
"."
.
"\due north"
;
}
$x1
= 2;
$y1
= -iii;
$r
= viii;
circle_equation(
$x1
,
$y1
,
$r
);
?>
Javascript
<script>
function
circle_equation(x1, y1, r)
{
let a = -two * x1;
allow b = -2 * y1;
permit c = (r * r) - (x1 * x1) -
(y1 * y1);
document.write(
"x^ii + ("
+a +
" 10) + "
);
document.write(
"y^two + ("
+b+
" y) = "
);
document.write( c+
"<br>"
);
}
let x1 = 2;
allow y1 = -3;
let r = 8;
circle_equation(x1, y1, r);
</script>
Output:
x^two + (-4 x) + y^2 + (six y) = 51.
Source: https://www.geeksforgeeks.org/equation-of-circle-from-centre-and-radius/
Posted by: keenanmaked1947.blogspot.com
0 Response to "How To Find Center Of A Circle From Equation"
Post a Comment