Equation of a line in a plane (automated)
What follows is a Python.3.7 program. It must be installed to get results
#Equation of any line in a plane in the form Ax + By + C =0
#given two points, (a,b), (c,d)
print('type, one at a time, a, b, c, d')
a=float(input())
b=float(input())
c=float(input())
d=float(input())
print('the equation is')
print((b-d),'x+',(c-a),'y+',(a*d-b*c),'=0')
Example(1): for (3, 4), (5, -2)
3
4
5
-2
the equation is 6.0 x+ 2.0 y+ -26.0 = 0
That is, 6x + 2y -26 = 0
Example (2): for (4, 5), (4, -2)
4
5
4
-2
the equation is 7.0 x+ 0.0 y+ -28.0 =0
That is, 7x - 28 = 0
Example (3): for (6, 7), (-4, 7)
6
7
-4
7
the equation is 0.0 x+ -10.0 y+ 70.0 =0
That is, -10y + 70 = 0
No hay comentarios:
Publicar un comentario