All-Solutions 250422 141738
All-Solutions 250422 141738
sum = 0;
1
Dosum = sum + , {i, 1, 100}, {j, 1, i};
j
N[sum]
O u t [ ] =
423.925
1
I n [ ] : = For sum = 0; i = 1, i ≤ 100, i = i + 1, Forj = 1, j ≤ i, j = j + 1, sum = sum +
j
sum;
sum // N
O u t [ ] =
423.925
I n [ ] : = sum = 0;
i = 1;
1
Whilei ≤ 100, j = 1; Whilej ≤ i, sum = sum + ; j ++;
j
i ++
sum;
sum // N
O u t [ ] =
423.925
Clear[p, k, f, i, c];
2 All solutions.nb
I n [ ] : = p = {};
k = 1;
While[Prime[k] < 1500, p = Append[p, Prime[k]]; k ++]
f = {};
i = 1;
While[Fibonacci[i] < 1500, f = Append[f, Fibonacci[i]]; i ++]
Length[p]
Length[f]
Intersection[p, f]
O u t [ ] =
239
O u t [ ] =
16
O u t [ ] =
{2, 3, 5, 13, 89, 233}
(*2(A)*)
All solutions.nb 3
15
10
0 Overs
1 2 3 4 5 6 7 8 9 10
(*2(b)*)
I n [ ] : = eqn = x ^ 2 - 5 x y + 4 y ^ 2 + x + 2 y - 3 0;
a = 1; h = -5 / 2; b = 4; g = 1 / 2; f = 1; c = -3;
del = a * b * c + 2 * f * g * h - a * f ^ 2 - b * g ^ 2 - c * h ^ 2;
del 0
O u t [ ] =
False
(*3(a)*)
4 All solutions.nb
I n [ ] : = f[x_] := x3 + 5 * x + 3
Plot[{f[x], f '[x], f ''[x]}, {x, -10, 10},
PlotStyle {RGBColor[1, 0, 0], RGBColor[0, 1, 0], RGBColor[0, 0, 1]},
PlotLegends {"f[x]", "f'[x]", "f''[x]"}]
SetDelayed: Tag Integer in 1[x_] is Protected.
O u t [ ] =
$Failed
O u t [ ] =
1.0
0.5
f[x]
f'[x]
-10 -5 5 10
f''[x]
-0.5
-1.0
(*3(b)*)
All solutions.nb 5
I n [ ] : = f = x2 + y2 1;
g = y2 1 - x;
ContourPlot[{f, g}, {x, -2, 2}, {y, -2, 2}]
Solve[{f, g}, {x, y}]
Solve[f, y]
Solve[g, y]
O u t [ ] =
2
-1
-2
-2 -1 0 1 2
O u t [ ] =
{{x 0, y -1}, {x 1, y 0}, {x 0, y 1}}
O u t [ ] =
y - 1 - x2 , y 1 - x2
O u t [ ] =
y - 1 - x , y 1 - x
1
I n [ ] : = 2 1 - x2 - 1 - x x
0
O u t [ ] =
2 π
2 - +
3 4
2 π
I n [ ] : = π-2 - + // Simplify
3 4
O u t [ ] =
1
(8 + 3 π)
6
(*4(a)*)
I n [ ] : = f[x_] = 3 x3 + 4 x2 - x + 2;
f1[x_] = f[x] / 3
O u t [ ] =
1
2 - x + 4 x2 + 3 x3
3
I n [ ] : = f1[x] /. x (y - 4 / 9) // Simplify
O u t [ ] =
722 25 y
- + y3
729 27
(*4(b)*)
I n [ ] : = u = {2, 3, 4};
v = {1, 0, 0};
w = {0, 1, 0};
p = {0, 0, 1};
u.v
angle1 = ArcCos // N
u.u v.v
O u t [ ] =
1.19029
u.w
I n [ ] : = angle2 = ArcCos // N
u.u w.w
O u t [ ] =
0.979924
u.p
I n [ ] : = angle3 = ArcCos // N
u.u * p.p
O u t [ ] =
0.733581
(*5(a)*)
All solutions.nb 7
4 1 -1
I n [ ] : = A= 2 5 -2 ;
11 1
Eigenvalues[A]
O u t [ ] =
1 1
7 + 13 , 3, 7 - 13
2 2
I n [ ] : = Eigenvectors[A]
O u t [ ] =
-3 - 13 2 3 + 13 3- 13 2 -3 + 13
- , , 1, {-1, 1, 0}, - , , 1
1+ 13 1+ 13 -1 + 13 -1 + 13
I n [ ] : = CharacteristicPolynomial[A, x]
O u t [ ] =
27 - 30 x + 10 x2 - x3
(*5(b(i))*)
eqn =
NDSolve[{y ''[x] + (y '[x] + 1) ^ 2 * y '[x] + y[x] 0, y[0] 1, y '[0] 0}, y[x], {x, 0, 1}]
O u t [ ] =
I n [ ] : = sol[x_] = eqn〚1, 1, 2〛
O u t [ ] =
I n [ ] : = sol[0.4]
sol[0.6]
sol[0.11]
O u t [ ] =
0.927686
O u t [ ] =
0.843017
O u t [ ] =
0.99415
8 All solutions.nb
1.0
0.9
0.8
0.7
(*5(b(ii))*)
All solutions.nb 9
O u t [ ] =
O u t [ ] =
Solution to dy/dx = 1 + 1/2 y^2
y(x)
x
0.2 0.4 0.6 0.8 1.0
(*6(b)*)
In[14]:= f[x_] = x;
LHL = Limitx2 + 1, x 0, Direction 1;
RHL = Limit[x, x 0, Direction -1];
Fvalue = f[0];
LHL RHL Fvalue
Out[18]=
False
(*6(a)*)
In[25]:= eq1 = x -y ^ 2;
eq2 = y x + 2;
Solve[{eq1, eq2}, {x, y}]
Out[27]=
{{x -4, y -2}, {x -1, y 1}}
10 All solutions.nb
(*7(a)*)
In[28]:= x1 = 1;
y1 = 2;
z1 = 4;
x2 = 2;
y2 = 4;
z2 = 5;
l1 = 2;
m1 = 3;
n1 = 3;
l2 = 2;
m2 = 4;
n2 = 5;
√
θ = ArcSin (m1 * n2 - m2 * n1)2 + (n1 * l2 - n2 * l1)2 + (l1 * m2 - l2 * m1)2
l = (m1 * n2 - m2 * n1) / Sin[θ];
m = (n1 * l2 - n2 * l1) / Sin[θ];
n = (l1 * m2 - l2 * m1) / Sin[θ];
SD = l * (x2 - x1) + m * (y2 - y1) + n * (z2 - z1) // Simplify
ArcSin[23]
Out[33]=
3
-
23
x - x1 y - y1 z - z1
In[35]:= A1 = l1 m1 n1
l m n
sd1 = Det[A1] // Simplify;
sd1 0
Out[35]=
3 4 2
{-1 + x, -2 + y, -4 + z}, {2, 3, 3}, ,- ,
23 23 23
Out[37]=
1
(40 + 18 x + 5 y - 17 z) 0
23
All solutions.nb 11
x - x1 y - y1 z - z1
In[38]:= A2 = l2 m2 n2
l m n
sd2 = Det[A2] // Simplify;
sd2 0
Out[38]=
3 4 2
{-1 + x, -2 + y, -4 + z}, {2, 4, 5}, ,- ,
23 23 23
Out[40]=
1
(30 + 28 x + 11 y - 20 z) 0
23
(*7(b)*)
In[41]:= x1 = 1; y1 = 4; x2 = 2; y2 = 7; x3 = 4; y3 = 11;
f[x_, y_] := x ^ 2 + y ^ 2 + 2 g * x + 2 f * y + c 0;
P := f[x, y] /. {x x1, y y1};
Q := f[x, y] /. {x x2, y y2};
R := f[x, y] /. {x x3, y y3};
Solve[{P, Q, R}, {f, g, c}]
In[47]:= x ^ 2 + y ^ 2 + 2 g * x + 2 f * y + c 0 /. %
Out[47]=
13 - 54 x + x2 + 6 y + y2 0
(*8(a)*)
12 All solutions.nb
In[55]:= fx [3, 4]
fy [3, 4]
fxx [3, 4]
fyy [3, 4]
fxy [3, 4]
fyx [3, 4]
Out[55]=
6 635 520
Out[56]=
6 967 296
Out[57]=
8 847 360
Out[58]=
10 450 944
Out[59]=
11 612 160
Out[60]=
Indeterminate
(*8(b)*)
All solutions.nb 13
In[68]:= p = 2 x * y - x2 ;
q = x2 + y2 ;
1 1
Int1 = p /. y x2 x + q /. y x2 2 x x;
0 0
0 0
Int2 = p /. x y 2 y x + q /. x y2 y;
2
1 1
lhs = Int1 + Int2
1 x
rhs = (∂x q - ∂y p) y x
0 x2
lhs rhs
Out[72]=
7
- 2 y 2 y3 - y4
15
Out[73]=
0
Out[74]=
7
- 2 y 2 y3 - y4 0
15
(*9(a+b)*)
In[86]:= Tr[A]
Out[86]=
38
(*10(a)*)
14 All solutions.nb
In[111]:=
u = {3, 4};
v = {1, 2};
w = {2, 0};
pt1 = {u, v, w};
pt2 = {u, v, w, u};
p1 = ListPlot[pt1, PlotStyle {Hue[0.56], PointSize[0.04]}]
P2 = ListPlot[pt2, PlotStyle {Hue[0.56], PointSize[0.04]}, Joined True]
Show[p1, P2]
Out[116]=
Out[117]=
Out[118]=
(*10(b)*)
In[121]:=
-1 2 3
A= 1 -2 4 ;
5 -3 -4
B = MatrixPower[A, 5] + 2 MatrixPower[A, 4] -
3 MatrixPower[A, 3] + 4 MatrixPower[A, 2] - 5 A + 6 IdentityMatrix[3];
B // MatrixForm
456 31 -930
-1528 2425 -505
-521 -393 1764
In[123]:=
3 - Length[NullSpace[B]] × MatrixRank[B]
Out[123]=
3