# Program to input six components of two vectors and to determine
# i) the angle between them in degrees
# ii) the norm of the difference vector
# iii) if these vectors are OA and OB, find the area of the triangle AOB.
# Co-ordinate of O is (0,0,0)
# iv) find the another co-ordinate of the vertex of parallelogram whose three vertices are O, A, B.
x1,y1,z1=input("Enter the components of vector A:").split(",")
x2,y2,z2=input("Enter the components of vector B:").split(",")
x1=float(x1)
y1=float(y1)
z1=float(z1)
x2=float(x2)
y2=float(y2)
z2=float(z2)
from math import*
norm1=sqrt(x1**2+y1**2+z1**2)
norm2=sqrt(x2**2+y2**2+z2**2)
angle=degrees(acos((x1*x2+y1*y2+z1*z2)/(norm1*norm2)))
print("The angle between these two vectors are:",angle)
a=x1-x2
b=y1-y2
c=z1-z2
n=sqrt(a**2+b**2+c**2)
print("The norm of the difference vector is:",n)
s=sin(radians(angle))
area=(norm1*norm2)*s/2
print("The area of triangle AOB is:",area)
x=x1+x2
y=y1+y2
z=z1+z2
print("The another co-ordinate of the vertex of parallelogram having vertices O, A, B is:(",x,y,z,")")
# i) the angle between them in degrees
# ii) the norm of the difference vector
# iii) if these vectors are OA and OB, find the area of the triangle AOB.
# Co-ordinate of O is (0,0,0)
# iv) find the another co-ordinate of the vertex of parallelogram whose three vertices are O, A, B.
x1,y1,z1=input("Enter the components of vector A:").split(",")
x2,y2,z2=input("Enter the components of vector B:").split(",")
x1=float(x1)
y1=float(y1)
z1=float(z1)
x2=float(x2)
y2=float(y2)
z2=float(z2)
from math import*
norm1=sqrt(x1**2+y1**2+z1**2)
norm2=sqrt(x2**2+y2**2+z2**2)
angle=degrees(acos((x1*x2+y1*y2+z1*z2)/(norm1*norm2)))
print("The angle between these two vectors are:",angle)
a=x1-x2
b=y1-y2
c=z1-z2
n=sqrt(a**2+b**2+c**2)
print("The norm of the difference vector is:",n)
s=sin(radians(angle))
area=(norm1*norm2)*s/2
print("The area of triangle AOB is:",area)
x=x1+x2
y=y1+y2
z=z1+z2
print("The another co-ordinate of the vertex of parallelogram having vertices O, A, B is:(",x,y,z,")")
Comments
Post a Comment