Assingment No . 4
Assingment No . 4
Q 1)
>>> P=Point(3,-1)
>>> x,y=symbols('x,y')
>>> P.reflect(Line(y))
Point2D(3, 1)
>>> P.scale(2,0)
Point2D(6, 0)
>>> P.scale(0,1.5)
Point2D(0, -3/2)
>>> P.reflect(Line(y-x))
Point2D(-1, 3)
Q2)
>>> P=Point(4,-2)
>>> x,y=symbols('x,y')
>>> P.reflect(Line(x))
Point2D(-4, -2)
>>> P.scale(3,0)
Point2D(12, 0)
>>> P.scale(0,2.5)
Point2D(0, -5)
>>> P.reflect(Line(y+x))
Point2D(2, -4)
Q3)
>>> P=Point(-2,4)
>>> P.transform(Matrix([[1,7,0],[0,1,0],[0,0,1]]))
Point2D(-2, -10)
>>> P.scale(7/2,7)
Point2D(-7, 28)
>>> P.transform(Matrix([[1,7,0],[4,1,0],[0,0,1]]))
Point2D(14, -10)
>>> P.rotate(pi/6)
Q5)
>>> P=Point(2,-3)
>>> P.reflect(Line(y))
Point2D(2, 3)
>>> P.scale(2,0)
Point2D(4, 0)
>>> P.scale(0,1.5)
Point2D(0, -9/2)
>>> P.reflect(Line(y-x))
Point2D(-3, 2)
Q8)
>>> x,y=symbols('x,y')
>>> P=Point(-2,4)
>>> P.rotate(48*(pi/180))
Point2D(-431084051462729/100000000000000, 929869355063/781250000000)
>>> P.scale(2,0)
Point2D(-4, 0)
>>> P.reflect(Line(y-2*x-3))
Point2D(2, 2)
>>> P.transform(Matrix([[7,0,0],[0,1,0],[0,0,1]]))
Point2D(-14, 4)
Q9)
>>> x,y=symbols('x,y')
>>> P.scale(6,0)
Point2D(-12, 0)
>>> P.scale(0,4)
Point2D(0, 16)
>>> P.reflect(Line(y-2*x+3))
Point2D(34/5, -2/5)
>>> P.reflect(Line(2*x+4*y-5))
Point2D(-17/5, 6/5)
Q4)
>>> P=Point(-2,4)
>>> P.reflect(Line(y))
Point2D(-2, -4)
>>> P.scale(6,0)
Point2D(-12, 0)
>>> P.transform(Matrix([[1,0,0],[4,1,0],[0,0,1]]))
Point2D(14, 4)
>>> P.rotate(30*(pi/180))
Point2D(-46650635094611/12500000000000, 9856406460551/4000000000000)
Q6)
>>> A=Point(5,3)
>>> B=Point(2,-3)
>>> x=array([[0,1],[-1,0]])
>>> y=array([[5,0],[0,1]])
>>> z=array([[0,-1],[-1,0]])
>>> dot(x,y,z)
array([[ 0, 1],
[-5, 0]])
>>> A.transform(Matrix([[0,1,0],[-5,0,0],[0,0,1]]))
Point2D(-15, 5)
>>> B.transform(Matrix([[0,1,0],[-5,0,0],[0,0,1]]))
Point2D(15, 2)
Q7)
>>> A=Point(3,2)
>>> b=Point(2,-3)
>>> x=array([[1,0],[0,1]])
>>> y=array([[1,0],[0,4]])
>>> z=array([[-1,0],[0,-1]])
>>> dot(x,y,z)
array([[1, 0],
[0, 4]])
>>> A.transform(Matrix([[1,0,0],[0,4,0],[0,0,1]]))
Point2D(3, 8)
>>> b.transform(Matrix([[1,0,0],[0,4,0],[0,0,1]]))
Point2D(2, -12)
Assingment No . 2
Q1 )
>>> plt.plot(x,y,c='green')
>>> plt.show()
>>> plt.plot(x,y,c='blue')
>>> plt.show()
3
>>> plt.plot(x,y)
>>> plt.show()
>>> plt.plot(x,y)
>>> plt.show()
Q3)
>>> ax = axes(projection='3d')
>>> ax.scatter(70,-25,15,color='black',marker='d')
>>> plt.show()
>>> ax = axes(projection='3d')
>>> ax.scatter(50,72,-45,c='green',marker='d')
>>> plt.show()
>>> ax = axes(projection='3d')
>>> ax.scatter(58,-82,65,c='green',marker='d')
>>> plt.show()
4
>>> ax = axes(projection='3d')
>>> ax.scatter(20,72,-45,c='red',marker='d')
>>> plt.show()