Mathematica Assignment No. 3
Mathematica Assignment No. 3
(a)
(b)
(c)
(d)
-1
-2
It appears that there are three solutions near -0.6, 0.8 & 1.6. So, the roots of the equation are,
Out[ ]= {x 0.797323}
Out[ ]= {x 1.61805}
Mathematica Assignment No. 3 B200302063.nb 3
(e)
1
In[ ]:= SolveSin[x] , x
2
π 5π
Out[ ]= x + 2 π 1 if 1 ∈ , x + 2 π 1 if 1 ∈
6 6
1
In[ ]:= SolveSin[x] , x
2
π 3π
Out[ ]= x + 2 π 1 if 1 ∈ , x + 2 π 1 if 1 ∈
4 4
Question 2
(a)
The partial fraction expansion is,
(x - 1)4
In[ ]:= Apart
x2 + 1 (x + 1)2 (x - 4)
81 8 32 2 (- 1 + 4 x)
Out[ ]= - + -
425 (- 4 + x) 5 (1 + x)2 25 (1 + x) 17 1 + x2
(x - 1)4
In[ ]:= ExpandNumeratorExpandDenominator
x2 + 1 (x + 1)2 (x - 4)
1 - 4 x + 6 x 2 - 4 x 3 + x4
Out[ ]=
- 4 - 7 x - 6 x 2 - 6 x 3 - 2 x 4 + x5
(b)
Coefficients of a,
Out[ ]= b5 , 5 b4 , 10 b3 , 10 b2 , 5 b, 1
Coefficients of b,
Out[ ]= a5 , 5 a4 , 10 a3 , 10 a2 , 5 a, 1
4 Mathematica Assignment No. 3 B200302063.nb
(c)
Now,
In[ ]:= Expand[a * b] Expand[p * q]
Out[ ]= True
Thus, ab = pq
(d)
In[ ]:= trigtable = TableTrigReduceSin[x]n , TrigReduceCos[x]n , {n, 3, 8};
TableFormtrigtable, TableAlignments Left,
TableHeadings None, " sinn (x)", " cosn (x)"
Out[ ]//TableForm=
Question 3
(a)
In[ ]:= f[x1_, x2_, y1_, y2_] := (x1 - x2)2 + (y1 - y2)2
(b)
(y1 - y2)
In[ ]:= p[x1_, x2_, y1_, y2_] := y1 + (x - x1)
x1 - x2
In[ ]:= line = y Expand[p[- 1, 4, 3, 2]]
14 x
Out[ ]= y -
5 5
Thus, equation of the line is x+5y-14 = 0. Let the equation of straight line perpendicular to this line
In[ ]:= l[x_, y_] := 5 x - y + k 0
3 5
In[ ]:= l ,
2 2
Out[ ]= 5+k 0
Out[ ]=
2
-4 -2 2 4 6 8 10
-2
-4
Question 4
(a)
Let equation of the circle
If the circle passes through (1, 4), (2, 7), (4, 11) we get three equations to solve for g, f and c.
In[ ]:= p[1, 4]
p[2, 7]
p[4, 11]
Out[ ]= 17 + c + 8 f + 2 g 0
Out[ ]= 53 + c + 14 f + 4 g 0
Out[ ]= 137 + c + 22 f + 8 g 0
x2 - 54 x + y2 + 6 y + 13 0
Out[ ]= 5 29
So the radius is 5 29
Equation of tangent of the given circle is,
In[ ]:= x1 = 1; y1 = 4;
q[x_, y_] = x x1 + y y1 + g (x + x1) + f (y + y1) + c 0 // Simplify
Out[ ]= 2 + 26 x 7 y
20
10
Out[ ]= -10 10 20 30 40 50 60
-10
-20
-30
(b)
The given circles are
x2 + y2 = 4
x2 + y2 - 2 x - 4 y + 4 = 0
Let, The equation of the circle going through the intersection point of the two above circles;
Out[ ]= - 4 + 4 k - 2 k x + x 2 + k x2 - 4 k y + y 2 + k y2 0
k 2 2k 2
Center of the circle is k+k1 , 2k
k +1
) and radius is -
k +1
+ -
k +1
-
4 k -4
k +1
If the circle touches the line x+2y=0, then the distance between the line and the center of the circle will
be equal to the radius of the circle. Hence,
8 Mathematica Assignment No. 3 B200302063.nb
k 2k
1 +2 k 2
2k 2
4k-4
k+1 k+1
In[ ]:= valueofk = - + - - ;
1 2 + 22 k+1 k+1 k+1
Solve[valueofk, k]
Out[ ]= {{k 1}}
x2 - x + y2 - 2 y 0
This is the equation of the circle passing through the intersection points of the two given circles.
2.0
1.5
1.0
Out[ ]=
0.5
-0.5
-1.0
Question 5
The general equation of 2nd degree is
ax2 + 2 hxy + by2 +2gx+2fy+c = 0
The given equation is
x 2 - 5 xy + 4 y 2 + x + 2 y - 2 = 0
Comparing the two equations we get
Mathematica Assignment No. 3 B200302063.nb 9
In[ ]:= a = 1;
-5
h= ;
2
b = 4;
1
g= ;
2
f = 1;
c = - 2;
a h g
If the equation represents a pair of straight lines then, Det h b f =0
g f c
ahg
In[ ]:= Det h b f
gfc
Out[ ]= 0
Out[ ]= 2 - 5 x1 + 8 y1 0
2 h2 - a b
In[ ]:= anglebetweenlines = ArcTan
a+b
3
Out[ ]= ArcTan
5
Thus, the equation of the two straight lines are x-y-1 = 0 & x-4y+2 = 0
10 Mathematica Assignment No. 3 B200302063.nb
on the y-axis, x = 0; y = -1 & 12 . Thus, the vertices of the triangle are (2, 1), (0, -1), 0, 1
2
).
2 1 1
1
In[ ]:= trianglearea = Abs Det 0 - 1 1
2 0
1
1
2
3
Out[ ]=
2
We have to transform the given equation into one where the terms with x, y and xy is absent. We got the
intersection point of the two lines which is (2,1).
So, Transferring the origin to the point (2, 1). Then putting x = x1+2 and y = y1+1 in
x 2 - 5 xy + 4 y 2 + x + 2 y - 2 = 0 we get;
Thus, The equation reduces to 34 - 5 x 2 - 34 + 5 y 2 =0 in which there is no term involving x,y and
xy.
Sketching the equation we get;
Mathematica Assignment No. 3 B200302063.nb 11
Out[ ]=
-5 5 10
-2
-4
Question 6
General equation of second degree is ax^2 + 2 hxy + by2 +2gx+2fy+c=0
Δ = abc + 2 fgh - af2 - bg2 - ch2
General equation of second degree will represent
(i) two straight line if Δ=0;
(ii)a circle if a=b and h=0;
(iii) a parabola if ab = h2 and Δ≠0;
(iv)an ellipse if ab - h2 <0 and Δ≠0;
(v)a hyperbola if ab - h2 >0 and Δ≠0;
Given the Equation,
In[ ]:= a = 4; b = 9; h = 6; g = 3 / 2; f = 1 / 2; c = 2;
In[ ]:= Δ = a b c + 2 f g h - a f 2 - b g2 - c h2
49
Out[ ]= -
4
So, Δ ≠ 0
In[ ]:= a b - h2
Out[ ]= 0
i . e . ab = h2
12 Mathematica Assignment No. 3 B200302063.nb
Question 7
(a)
Equation of the plane through the given points;
x y z 1
2 3 1 1
In[ ]:= Det 0 // Simplify
1 1 3 1
2 2 3 1
Out[ ]= 3+2x 2y+z
Out[ ]=
(b)
Given,
Equation of the planes are
Mathematica Assignment No. 3 B200302063.nb 13
6x-8y+10z = 0
3x-4y+5z-7 = 0
Let,
In[ ]:= a1 = 6 ; b1 = - 8 ; c1 = 10;
a2 = 3 ; b2 = - 4; c2 = 5;
As the angle between the planes is 0, the planes are parallel to each other.
Given,
Equation of the planes are,
6x-8y+10z = 0 which transform into
3x-4y+5z= 0
3x-4y+5z-7 = 0
D1 - D2
In[ ]:= planedistance = Abs
A 2 + B2 + c2
7
Out[ ]=
5 2
(c)
Given,
Equation of the planes are
3x-4y+5z = 0
2x-y-2z = 0
Let,
In[ ]:= a1 = 3; b1 = - 4; c1 = 5;
a2 = 2 ; b2 = - 1; c2 = - 2;
a1 a2 + b1 b2 + c1 c2
In[ ]:= planeangle1 = ArcCos
a12 + b12 + c12 a22 + b22 + c22
π
Out[ ]=
2
Out[ ]=
(d)
In[ ]:= Given the equation
line1 = x + 2 y + 3 z - 3 = 0---- - (1)
line2 = 2 x + y - z + 5 = 0------ (2)
line3 = 5 x + 3 y + 6 z + 5 = 0---- - (3)
find the intersection point of (1) and (2)
In[ ]:= p = Solve[x + 2 y + 3 z - 3 2 x + y - z + 5, {x, z}]
Solve: Equations may not give solutions for all "solve" variables.
x 8-y
Out[ ]= z +
4 4
x 8-y
In[ ]:= line1 /. z +
4 4
Out[ ]= - 1 + 0 -- --
Mathematica Assignment No. 3 B200302063.nb 15
Question 8
The given lines are
x -3 y -8 z -3
3
=
-1
=
1
-----------1
x +3 y +7 z -6
-3
=
2
=
4
-----------2
dr’s of line 1 (3, -1, 1)
dr’s of line 2 (-3, 2, 4)
let the dr’s of S.D is (a, b, c)
let,
In[ ]:= a1 = 3 ; b1 = - 1 ; c1 = 1;
a2 = - 3 ; b2 = 2; c2 = 4;
Out[ ]= -3 a + 2 b + 4 c 0
a
In[ ]:= l=
a 2 + b2 + c2
b
m=
a 2 + b2 + c2
c
n=
a 2 + b2 + c2
2
Out[ ]= -
15
5
Out[ ]= -
6
1
Out[ ]=
30
3 6 15
Out[ ]= +2 +5
10 5 2
12 x - 15 y - 51 z + 237 0 66 x - 15 y + 57 z - 249
We know,
Equation of the Plane containing line 1 and Shortest Distance is,
12 x-15 y-51 z+237 0
Equation of the Plane containing line 2 and Shortest Distance is,
66 x-15 y+57 z-249 = 0
Let, z=0; the two equation becomes;
12 x - 15 y + 237 0
66 x - 15 y - 249 0
Mathematica Assignment No. 3 B200302063.nb 17
1
In[31]:= Solve (6 - 6 r) - 15 + 15 r, r
3
Out[31]= {{r 1}}
1 1
In[34]:= Solve (- 12 + 6 r) (30 - 15 r), r
3 2
Out[34]= {{r 2}}
Question 9
(a)
Let the equation of the sphere,
If the sphere goes through the given points, then the equation of the sphere become,
In[ ]:= equations = sphere /.
{{x 4, y - 1, z 2}, {x 0, y - 2, z 3}, {x 1, y - 5, z - 1}, {x 2, y 0, z 1}}
Out[ ]= {21 + d + 8 u - 2 v + 4 w 0, 13 + d - 4 v + 6 w 0, 27 + d + 2 u - 10 v - 2 w 0, 5 + d + 4 u + 2 w 0}
x2 - 4 x + y2 + 6 y + z 2 - 2 z + 5 0
Out[ ]=
(b)
Let the equation of the sphere having its centre on (d,e,f) and radius r,
If the sphere passes through (4, 1, 0), (2, -3, 4) & (1, 0, 0) and if the sphere touches the plane 2x+3y-z = 11
then the equation becomes
In[ ]:= c[4, 1, 0]
c[2, - 3, 4]
c[1, 0, 0]
(2 d + 3 e - f - 11)
r
22 + 32 + (- 1)2
Out[ ]= (1 - d)2 + e2 + f2 r2
- 11 + 2 d + 3 e - f
Out[ ]= r
14
3 d
In[ ]:= f + + e /. {e 8 - 3 d}
2 2
7 d 3e
f - + /. {e 8 - 3 d}
2 4 4
19 5 d
Out[ ]= f -
2 2
7 3 d
Out[ ]= f + (8 - 3 d) -
2 4 4
19 5d 7 3 d
In[ ]:= Solve - + (8 - 3 d) - , d
2 2 2 4 4
Out[ ]= {{}}