0% found this document useful (0 votes)
6 views4 pages

Math 3

The document contains a series of mathematical problems involving points, distances, reflections, transformations, and line equations using the sympy library in Python. It provides specific outputs for calculations such as distances between points, reflections through lines, and transformations including scaling and shearing. The document concludes with finding the slope of a transformed line segment using a transformation matrix.

Uploaded by

mansishirke08
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views4 pages

Math 3

The document contains a series of mathematical problems involving points, distances, reflections, transformations, and line equations using the sympy library in Python. It provides specific outputs for calculations such as distances between points, reflections through lines, and transformations including scaling and shearing. The document concludes with finding the slope of a transformed line segment using a transformation matrix.

Uploaded by

mansishirke08
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Que -1.

find the distance between points x,y;y,w and x,z if


x=[0,0],y=[2,2],
z=[-1,-1],w=[3,4].
Ans :-
from sympy import *
x = Point (0,0)
y = Point (2,2)
z = Point (-1,-1)
w = Point (3,4)
x.distance(y)
Output :-
2√2
y.distance(w)
Output :-
√5
x.distance(z)
Output :-
√2.
Que -2.reflect given points through respective lines.
a. (3,6),x+y=0
Ans :-
from sympy import *
x,y=symbols('x y')
P=Point(3,6)
P.reflect(Line(x+y))
Output :-
Point2D(−6,−3)
b. (2,6),2x+y=-1
Ans :-
from sympy import *
x,y=symbols('x y')
P=Point(2,6)
P.reflect(Line(2*x+y+1))
Output :-
Point2D(−34/5,8/5
c. (0,-2),x+y=5
Ans :-
from sympy import *
x,y=symbols('x y')
P=Point(0,-2)
P.reflect(Line(x+y-5))
Output :-
Point2D(7,5)
d. (1.5,3.6),x-2y=1
Ans :-
from sympy import *
x,y=symbols('x y')
P=Point(1.5,3.6)
P.reflect(Line(x-2*y-1))
Output :-
Point2D(209/50,−44/25)
e. (-5,-6),-4x+3y=11
Ans :-
from sympy import *
x,y=symbols('x y')
P=Point(-5,-6)
P.reflect(Line(-4*x+3*y-11))
Output :-
Point2D(−197/25,−96/25)
Que - 3. Apply following transformations on point P[4,3].
a. reflectiion through y axis
Ans :-
from sympy import *
P=Point(4,3)
P.transform(Matrix([[-1,0,0],[0,1,0],[0,0,1]]))
Output :-
Point2D(−4,3)
b. scaling in x co-ordinates by factor 3
Ans :-
from sympy import *
P.scale(3,0)
Output :-
Point2D(12,0
c. scaling in y co-ordinates by factor 3.2
Ans :-
from sympy import *
P.scale(0,3.2)
Output :-
Point2D(0,485)
d. reflection through line y=-x
Ans :-
from sympy import *
x,y=symbols('x y')
P=Point(4,3)
P.reflect(Line(x+y+0))
Output :-
Point2D(−3,−4)
e. shearing in y direction by 3 units
Ans :-
from sympy import *
P=Point(4,3)
P.transform(Matrix([[1,0,0],[3,1,0],[0,0,1]]))
Output :-
Point2D(13,3)
f. scaling in x & y direction by 3/2 and 2 units resp.
Ans :-
P.scale(3/2,2)
Output :-
Point2D(6,6)
g. shearing in both x & y direction by -3 and 1 units resp.
Ans :-
from sympy import *
P=Point(4,3)
P.transform(Matrix([[1,-3,0],[1,1,0],[0,0,1]]))
Output :-
Point2D(7,−9)
Que - 4. If the line with points A[2,1],B[4,-1] is transformed by the
transformation matrix [T]=[[1,2],[2,1]],then find the equation of
the transformed lines. Matrix of reflection in Python will be 3x3
matrix.Here matrix for reflection will be [[1,2,0],[2,1,0],[0,0,1]].
Ans :-
from sympy import *
A=Point(2,1)
B=Point(4,-1)
A1=A.transform(Matrix([[1,2,0],[2,1,0],[0,0,1]]))
B1=B.transform(Matrix([[1,2,0],[2,1,0],[0,0,1]]))
L=Line(A1,B1)
L.equation()
Output :-
−2𝑥−2𝑦+18
Que - 5. If the line segment joining the points A[2,5],B[4.-13] is
transformed to te line segment A*B by the transformation matrix ,
[T]=[[2,3],[4,1]],then find the midpoint of A*B. Matrix of reflection in
Python will be 3x3 matrix.Here matrix for reflection will be [[2,3,0],
[4,1,0],[0,0,1]].
Ans :-
from sympy import *
A=Point(2,5)
B=Point(4,-13)
A1=A.transform(Matrix([[2,3,0],[4,1,0],[0,0,1]]))
B1=B.transform(Matrix([[2,3,0],[4,1,0],[0,0,1]]))
L=Segment(A1,B1)
L.midpoint
Output :-
Point2D(−10,5)
Que - 6. Suppose that the line segment between the points A[1,4]
and [3,6] is transformed to the line segment A*B* using the
transformation matrix [T]=[[2,-1],[1,3]].Find slope of the
transformed line segment A*B*.
Ans :-
from sympy import *
A=Point(1,4)
B=Point(3,6)
A1=A.transform(Matrix([[2,-1,0],[1,3,0],[0,0,1]]))
B1=B.transform(Matrix([[2,-1,0],[1,3,0],[0,0,1]]))
L=Segment(A1,B1)
L.slope
Output :-
2/3.

You might also like