5. A-level-further#
Notes go downwards in cells; cells go upwards in sections.
Cells with formulas are at top of each section.
Used Languages : MMA, Sage, Python(for number calculations)
5.1. test coding#
(*Functions in MMA*)
g=9.8;
invsin[x_]:=InverseFunction[Sin][x]
N[InverseFunction[Sin][1]]
InverseFunction[Sin][1]//N (*Wolfram 后线// *)
(*Vectors in MMA*)
xv=Subscript[x,#] & /@ Range[5]
yv=Subscript[y,#] & /@ Range[5]
xv+yv
xv yv
xv*yv
xv.yv
Norm[xv]
# Physics: Gravitation and Satellites
G = 6.77 * 10^(-11)
Me = 5.972 * 10^(24)
radius_earth = 6378100
force( Mass_sate, rs ) = (G * Me * Mass_sate)/(rs^2)
force1(Mass_sate, alt) = force( Mass_sate, rs = alt + radius_earth ) #Partial application, 相关但不是currying
force1(1, 0)
5.2. ★Further Y13-2#
5.2.1. Assessment 1#
x(t)=2.5*e^(-t/2)*sin(2*t)
v(t)=diff(x(t),t)
s(n(v(2)))
5.2.2. Module 3 - Work, Energy & Power#
Notes
Energy : There are 2 common types in physics - kinetic energy and potential energy.
Kinetic Energy : Energy stored in the object as motion. Formula : \(KE=\frac{1}{2}mv^2\)
Potential Energy : Energy stored in the object. Formula : \(PE=mgh\)
Elastic Potential Energy : \(PE=\frac{x^2\lambda}{2l}\)
Frictional Energy Lost : This is used in some problems where friction is not neglected. Formula : \(E=F_fs\)
Work : Work is the force times the displacement (\(Fs\)).
Power : Power is the rate of change of work.
g=9.8
PE=5*g*4*sin(5/36*pi);n(PE)
FE=5*g*cos(5/36*pi)*0.6*4;n(FE)
106.581795755510
5.2.3. Module 2 - Momentum & Impulse#
Notes
s(n(2.4/8.2,16))
s(n(4/7,16))
5.2.4. Module 1 - ODE Applications#
Notes
Hooke’s Law : When the extensions is \(x\), the natural length of the spring is \(l\) and the tension is \(T\), \(x \propto Tl\) which can also be written as \(T=\frac{\lambda x}{l}\) where \(\lambda\) is the spring constant. (\(F=kx\))
Properties of SHM(Simple Harmonic Motion)
It is periodic.
It oscillates around the equilibrium position.
The extreme points are the same distance from the equilibrium position.
It reaches maximum speed at the equilbrium.
It is stationary for an instant at the extreme points.
For pendulums, the 2nd order non-linear ODE as there is a \(\sin{\theta}\).
Because of this, it is only SHM for small \(\theta\) as when it is like that, \(\sin{\theta}\approx\theta\). After solving it, the general solution is \(\theta=A\cos{\omega t}+B\sin{\omega t}\) where \(\omega=\sqrt{\frac{g}{l}}\)
For angular amplitude, convert from degrees into radians by multiplying by \(\frac{\pi}{180}\).
For approximate period, \(k=\frac{2\pi}{\omega}\).
The max angular speed is \(a\omega\) in radians per second.
var('A B')
x(t)=e^t*(A*cos(2*t)+B*sin(2*t))+4/5
y(t)=e^t*(B*cos(2*t)-A*sin(2*t))+1/10
s(x(0),y(0))
var('A B')
x(t)=e^t*(A*t+B)
y(t)=e^t*(A*t+B-A)
s(x(0),y(0))
y(t)=(3-e^(-2*t))*(sin(5*t)-cos(5*t))/12
plot(y)
var('A B')
y(t)=e^(-2*t)*(A*cos(5*t)+B*sin(5*t))+sin(5*t)/4-5/4*cos(5*t)
v(t)=diff(y(t),t)
s(y(0),v(0))
var('a b')
y(t)=a*sin(5*t)+b*cos(5*t)
v(t)=diff(y(t),t)
a(t)=diff(v(t),t)
s(a(t)+4*v(t)+29*y(t))
var('A B')
w=sqrt(7)/2
x(t)=e^(-t/2)*(A*cos(w*t)+B*sin(w*t))
v(t)=diff(x(t),t)
s(x(0),v(0))
var('A B')
x(t)=e^(-2*t)*(A*cos(t)+B*sin(t))
v(t)=diff(x,t)
s(x(0),v(0))
var('A B')
w=sqrt(171)/2
x(t)=e^(-3*t/2)*-10/w*sin(w*t)
v(t)=diff(x,t)
s(n(x(2)),n(v(2)))
var('A B')
x(t)=e^(-t/2)*(A*cos(5*t)+B*sin(5*t))
s(diff(x,t))
var('A B')
x(t)=e^(-2*t)*(A*cos(t/2)+B*sin(t/2))
s(diff(x,t))
var('A B')
x(t)=e^-t*(A*cos(2*t)+B*sin(2*t))
s(x(t),diff(x(t),t))
x(t)=0.5*cos(sqrt(160)*t)
s(n(x(0.25),16),n(x(5),16))
g=49/5
x=0.6*g/20;print(n(x,16))
x=g/160;print(x)
5.3. ★Further Y13-1#
5.3.1. Assessment 3 - Module 7 and 8#
a=vector([9, 7, 7])
b=vector([4, 7, 2])
show(a.cross_product(b))
a=vector([3, 3, 4])
b=vector([-3, 3, 4])
c=vector([0, 6, 8])
show(a.cross_product(c))
a=vector([3, -1, 0])
b=vector([7, 36, -23])
show(a.cross_product(b))
a=vector([13, -27, -21])
b=vector([1, 1, -3])
show(a.cross_product(b))
show(n(arcsin(sqrt(102^2+18^2+40^2)/(sqrt(13^2+27^2+21^2)*sqrt(1^2+1^2+3^2)))/pi*180))
a=vector([6, -2, -7])
b=vector([5, 1, -5])
show(a.cross_product(b))
a=vector([1, 0, -2])
b=vector([-4, 1, 4])
show(a.cross_product(b))
a=vector([0, -1, 3])
b=vector([5, 0, -4])
c=vector([3, 3, 6])
show(a.cross_product(b))
show(n(c.dot_product(a.cross_product(b)/sqrt(266))))
a=vector([-3, 1, 2])
b=vector([1, -1, 1])
c=vector([-1, 5, 6])
show(a.cross_product(b))
show(n(c.dot_product(a.cross_product(b))/sqrt(38)))
a=vector([3, -4, -8])
b=vector([-2, -4, 1])
c=vector([1, -2, -5])
show(a.dot_product(b.cross_product(c)))
p=var('p')
q=var('q')
x=var('x')
a=matrix([[-50, 12, 138], [-36, 10, 96], [-17, 4, 47]])
b=vector([3, 2, 1])
show(a.det())
show(a.eigenvalues())
show(expand((x-1)*(x-2)*(x-4)))
show(a.inverse()*b)
a=matrix([[3, -4, 2], [-4, -1, 6], [2, 6, -2]])
b=matrix([[1, 2, 2], [2, 1, -2], [-2, 2, -1]])
c=matrix([[9^4, 0, 0], [0, 3^4, 0], [0, 0, 6^4]])
show(a.eigenvalues())
show(a.eigenvectors_right())
show(b*c*b.inverse())
a=matrix([[6, 13], [-2, -9]])
b=matrix([[1, 13], [-1, -2]])
c=matrix([[-7^5, 0], [0, 4^5]])
show(a.eigenvalues())
show(a.eigenvectors_right())
show(b*c*b.inverse())
a=matrix([[-2, -4, 2], [-2, 1, 2], [4, 2, 5]])
b=matrix([[-26, -33, -25], [31, 42, 23], [-11, -15, -4]])
show(a.eigenvalues())
show(b.eigenvalues())
show(a.eigenvectors_right())
show(b.eigenvectors_right())
a=matrix([[1, 2], [2, -2]])
b=matrix([[3, 5], [1, -1]])
c=matrix([[7, 4], [-2, 1]])
d=matrix([[11, -24], [15, -27]])
show(a.eigenvalues())
show(b.eigenvalues())
show(c.eigenvalues())
show(d.eigenvalues())
show(a.eigenvectors_right())
show(b.eigenvectors_right())
show(c.eigenvectors_right())
show(d.eigenvectors_right())
a=vector([24, -16, 32])
b=vector([-15, -12, 9])
show(a.cross_product(b))
a=vector([-1, 4, -2])
b=vector([2, -3, -1])
c=vector([1, 2, -2])
show(b.dot_product(a.cross_product(c)))
show(b.dot_product(c.cross_product(a)))
show(c.dot_product(b.cross_product(a)))
a=vector([4, -1, -2])
b=vector([-3, 2, -5])
c=vector([2, 2, -6])
show(a.cross_product(b))
show(a.cross_product(c))
show(b.cross_product(c))
5.3.2. Module 8 - Eigenvalues and Eigenvectors#
If the corresponding eigenvalue is \(\lambda\) then for a transformation matrix \(\begin{pmatrix}a&b\\c&d\end{pmatrix}\) $\(\begin{pmatrix}a&b\\c&d\end{pmatrix} \begin{pmatrix}x\\mx\end{pmatrix} = \lambda\begin{pmatrix}x\\mx\end{pmatrix}\)$ The calculations below are used to calculate eigenvalues and eigenvectors and it also reveals properties about the eigenvalues of the square, cube or inverse of a matrix.
The methods used are algebra and the characteristic equation.
Some notation for eigenvalues and eigenvectors are below.
The notation is used in diagonalisation.
\(\mathbf{s}_n\) stands for the \(n\) th eigenvector.
\(\mathbf{S}\) stands for \(\begin{pmatrix}\mathbf{s}_1&\cdots&\mathbf{s}_n\end{pmatrix}\) (the matrix of the eigenvectors of \(\mathrm{M}\)).
\(\Lambda\) stands for \(\begin{pmatrix}\lambda_1&0\\0&\lambda_2\end{pmatrix}\) (the diagonal matrix of the eigenvalues of \(\mathrm{M}\) in the order of the eigenvectors used for \(\mathrm{S}\)) where \(\lambda_n\) is the \(nth\) eigenvalue.
\(\mathrm{M}\) is the matrix we want to find the powers of. $\(\mathbf{MS}=\mathbf{S\Lambda}\)\( \)\(\mathbf{S^{-1}MS}=\mathbf{S^{-1}S\Lambda}\)\( \)\(\mathbf{S^{-1}MS}=\mathbf{\Lambda}\)\( When we do this we say the matrix \)\mathrm{M}$ has been reduced to diagonal form or has been diagonalised.
The matrix \(\Lambda\) is the diagonalised form of \(\mathrm{M}\)
If \(\mathbf{D}\) is a diagonal matrix, $\(\mathbf{D}^n=\begin{pmatrix}a^n&0\\0&b^n\end{pmatrix}\)\( The Cayley-Hamilton theorem states that \)\(d_0+d_1\mathbf{M}+d_2\mathrm{M^2}-\mathrm{M^3}=0\)$
a=matrix([[1-x, 4, -1], [-1, 6-x, -1], [2, -2, 4-x]])
show(expand(a.det()))
p=var('p')
q=var('q')
a=matrix([[0, -1, 1], [6, -2, 6], [4, 1, 3]])
b=vector([1, 1, -1])
show(a.eigenvalues())
show(a.inverse()*b)
show(a^2)
k=var('k')
a=matrix([[0, 0, 2], [1, -1, 2], [1, 0, 1]])
show(a.eigenvectors_right())
b=matrix([[1, 0, -1/2], [0, 1, 0], [1, 1, 1]])
show(b.det())
m=matrix([[0, -1, 1], [6, -2, 6], [4, 1, 3]])
s=matrix([[1, 1, 0], [1, 0, 1], [-1, -1, 1]])
l=matrix([[16, 0, 0], [0, 1, 0], [0, 0, 256]])
show(m.eigenvalues())
show(m.eigenvectors_right())
show(s*l*s.inverse())
m=matrix([[9, 2], [-1, 6]])
show(m.eigenvalues())
show(m.eigenvectors_right())
m1=matrix([[1, 2], [-1, -1]])
m2=matrix([[7^5, 0], [0, 8^5]])
show(m1.inverse())
a=7^5
b=8^5
show(2*b-a)
show(2*b+2*a)
show(a-b)
show(-2*b-a)
m1*m2*m1.inverse()
The calculations below are used to calculate eigenvalues and eigenvectors and it also reveals properties about the eigenvalues of the square, cube or inverse of a matrix.
The methods used are algebra and the characteristic equation.
mt=matrix([[-1, 7, 9], [0, 1, 4], [0, 0, 3]])
show(mt.eigenvalues())
show((mt^2).eigenvalues())
show((mt^3).eigenvalues())
show(mt.inverse().eigenvalues())
mt2=matrix([[-2, -4, 2], [-2, 1, 2], [4, 2, 5]])
show(mt2.det())
show(mt2.trace())
show(mt2.eigenvalues())
The eigenvalues of a matrix is equal to the eigenvalues of the transpose of the matrix
show(expand(-((x+2)*(x-2)-1)*(x-1)+7*x+5))
f(x)=x^3-x^2-12*x
show(plot(f(x), (x, -4, 5), figsize=3))
show(f(-3))
show(f(0))
show(f(4))
mt=matrix([[1, -3, -3], [-8, 6, -3], [8, -2, 7]])
show(mt.eigenvalues())
show(mt.eigenvectors_right())
mt2=matrix([[1, -1, 0], [1, 2, 1], [-2, 1, -1]])
show(mt2.eigenvalues())
show(mt2.transpose().eigenvalues())
mt3=matrix([[-7, 4], [-5, 5]])
show(mt3.eigenvalues())
show((mt3^2).eigenvalues())
show((mt3^3).eigenvalues())
show(mt3.inverse().eigenvalues())
# Ex. 15
mt=matrix(2, 2, [[-5, 3], [6, -2]])
show(mt.eigenvalues())
mt2=matrix(3, 3, [[2, 0, 1], [-1, 2, 3], [1, 0, 2]])
show(mt2.eigenvalues())
f(x)=x^3-x^2-11*x+15
show(plot(f(x), (x, -5, 5),figsize=3))
show(n(sqrt(6)-1))
show(n(-sqrt(6)-1))
show(solve(f(x), x))
5.3.3. Module 7 - The Vector Product#
For calculating cross product, $\(\mathbf{i}\times\mathbf{i}=\mathbf{j}\times\mathbf{j}=\mathbf{k}\times\mathbf{k}=0\)\( \)\(i\times j=k\)\( \)\(j\times i=-k\)\( \)\(j\times k=i\)\( \)\(k\times j=-i\)\( \)\(k\times i=j\)\( \)\(i\times k=-j\)$
The below is working out for a formula for the cross product. $\((a_1\mathbf{i}+a_2\mathbf{j}+a_3\mathbf{k}) \times (b_1\mathbf{i}+b_2\mathbf{j}+b_3\mathbf{k})\)\( \)\(=a_1b_2\mathbf{k}-a_1b_3\mathbf{j}-a_2b_1\mathbf{k}+a_2b_3\mathbf{i}+a_3b_1\mathbf{j}-a_3b_2\mathbf{i}\)\( \)\(=(a_2b_3-a_3b_2)\mathbf{i}+(a_3b_1-a_1b_3)\mathbf{j}+(a_1b_2-a_2b_1)\mathbf{k}\)$
Properties 1. $\(\mathbf{a}\times\mathbf{b}=-(\mathbf{b}\times\mathbf{a})\)$ This means that the cross product is anticommutative.
For a parrallelepiped, the formulae for volume is below,
For a tetrahedron(triangular pyramid), formula for volume is below, $\(V=\frac{1}{6}|a\cdot(b\times c)|\)$ Volumes can be calculated by scalar triple product
To find angle between planes, $\(\sin{\theta}=\frac{|n_1\times n_2|}{|n_1|*|n_2|}\)$
a=vector([-3, -3, 4])
b=vector([1, 2, 2])
c=vector([-6, 2, 5])
show(n(a.dot_product(b.cross_product(c))/sqrt(521)))
show(b.cross_product(c))
a=vector([1, -3, 2])
b=vector([1, -1, -2])
c=vector([7, -5, -7])
print('k='+str(a.dot_product(b.cross_product(c))))
d=vector([-4, 0, 5])
show(d.dot_product(b.cross_product(c)))
show(a.dot_product(d.cross_product(c)))
f(x, y)=-5*x+y+8
g(x, y)=-x-3*y-4
show(plot3d(f(x, y), (-4, 4), (-4, 4))+
plot3d(g(x, y), (-4, 4), (-4, 4)))
Calculation for calculating normal vectors and their cross product to find line of intersection
a=vector([2, 3, 2])
b=vector([4, -3, 4])
show(a.cross_product(b))
a=vector([4, -1, 3])
b=vector([3, -1, 2])
show(a.cross_product(b))
show(n(arcsin(sqrt(3)/sqrt(26*14))*180/pi))
c=vector([2, 3, 2])
d=vector([4, -3, 1])
show(c.cross_product(d))
a=vector([2, 4, -1])
b=vector([1, 1, 2])
c=vector([4, 0, 1])
a.dot_product(b.cross_product(c))
# Calc for Ex. 13
a=vector([1, -2, 3])
b=vector([2, -3, 1])
c=vector([-2, 2, -1])
show(a.cross_product(b))
show(a.cross_product(c))
d=vector([3, -4, 5])
f=vector([-5, 12, 13])
show(d.cross_product(f))
5.3.4. Assessment 2 - Module 4, 5 and 6#
show(n(-3*((-3)^2)^(1/3)))
show(n(log(9/10)+1/4))
show(n((5*log(3)-2*log(4)+2*log(2)-3/2*log(5)+arctan(2))/5))
5.3.5. Module 6 - 2nd Order ODE#
Use desolve() in SageMath to do ODE $\(2\dfrac{\mathrm{d}^2y}{\mathrm{d}x^2} = 5\dfrac{\mathrm{d}y}{\mathrm{d}x}− y\)$
x = var('x'); y = function('y')(x)
show(desolve(2*diff(y, x, 2) == 5*diff(y, x) - y, y) )
x = var('x'); y = function('y')(x)
show(desolve(17*diff(y, x) == 10*diff(y, x, 2) + 3*y , y) )
5.3.6. Module 5 - Further Applications of Integration#
To find the area bounded by a parametric curve, convert \(y\) and \(\mathrm{d}x\) into terms of \(t\)
- \[\int^{t_2}_{t_1}y\hspace{1px}\mathrm{d}x\]
For polar equations,
- \[A=\int^{\theta_2}_{\theta_1}\frac{1}{2}r^2\mathrm{d}\theta\]
Arc Length
- \[s=\int^{x_2}_{x_1}\sqrt{1+\begin{pmatrix}\large\frac{\mathrm{d}y}{\mathrm{d}x}\end{pmatrix}^2}\mathrm{d}x\]
Arc Length (parametric curve)
- \[s=\int^{t_2}_{t_1}\sqrt{\large\begin{pmatrix}\frac{\mathrm{d}x}{\mathrm{d}t}\end{pmatrix}^2+\begin{pmatrix}\frac{ \mathrm{d}y}{\mathrm{d}t}\end{pmatrix}^2}\mathrm{d}t\]
Arc Length (polar curve)
- \[s=\int^{\theta_2}_{\theta_1}\sqrt{r^2+\large\begin{pmatrix}\frac{\mathrm{d}r}{\mathrm{d}\theta}\end{pmatrix}^2 }\mathrm{d}\theta\]
For surface of revolution
- \[S=\int_a^b2\pi y\sqrt{1+\begin{pmatrix}\frac{dy}{dx}\end{pmatrix}^2}dx\]
s(diff(2*(x-sin(x)),x))
s(diff(2*(1-cos(x)),x))
print(n(2*pi))
s(n(integral(sqrt(x^2+1)/pi,x,0,2*pi),16))
s(n(integral(sqrt(2+2*cos(x)),x,0,pi),16))
s(n(8*pi/3*(2^(3/2)-1),16))
f(x)=e^(-x/2)*(13*cos(4*x)+12*sin(4*x))
s(n(f(2*pi)))
s(diff(sec(x),x))
s(integral(sec(x),x))
print(n(ln(sqrt(3)),16))
print(n(8/27*((11/2)^(3/2)-1),16))
print(n(2*integral(sqrt(2-2*cos(x)),x,pi/2,pi),16))
print(n(8*integral(sqrt(1+x^2),x,0,2),16))
print(n(integral(sech(x),x,0,1),16))
print(n(integral(sqrt(1+9*x/4),x,0,5),30))
print(n(8/27*((49/4)^(3/2)-1),30))
print(n(integral(sqrt(1+sinh(4*x)^2),x,0,1),30))
print(n(integral(sqrt(2*(1+cos(x))),x,0,2*pi/3),30))
print(n(integral(sqrt(1+x^2),x,2,6),30))
print(integral(sqrt(1+sinh(x)^2),x,-ln(2),ln(2)))
s(expand(diff(ln(abs(sec(x))),x)^2))
s(diff(cosh(x),x))
f(x)=e^(2*x)/2-2*x-e^(-2*x)/2
g(x)=8*f
a=arcsinh(2)
b=arcsinh(1/2)
s(n(integral(4*sinh(x)^2,x,0,a)),n(f(a)-f(0)),n(g(b)-g(0)))
var('t')
a=parametric_plot((2*cosh(t),2*sinh(t)),(t,-2,2),figsize=7)
b=parametric_plot((4*cosh(t),8*sinh(t)),(t,-1.5,1.5),figsize=7)
show(a+b)
f(x)=x^3/6
s(n(f(9*pi)-f(33*pi/4)-f(7*pi)+2*f(25*pi/4)-f(11*pi/2)-f(17*pi/4)+2*f(7*pi/2)-f(11*pi/4)-f(3*pi/2)+2*f(3*pi/4)-f(0)))
var('s')
var('t')
a=parametric_plot((-2*t^2, -4*t), (t, -2, 2), figsize=5)
b=plot(-2*(x+4), (x, -8, 1), figsize=5)
show(a+b)
c=parametric_plot((2*cosh(s), 2*sinh(s)), (s, -2, 2), figsize=4)
d=parametric_plot((4*cosh(t), 8*sinh(t)), (t, -1.5, 1.5), figsize=5)
show(c+d)
t=var('t')
f(x)=x^3/6
show(parametric_plot((2*t^3, t^2), (t, 1, 2))) # Plots
show(parametric_plot((4*cos(t), 3*sin(t)), (t, -pi/2, pi/2), figsize=3))
show(polar_plot(3*(1+cos(x)), (x, 0, 2*pi), figsize=4))
show(parametric_plot((4*cosh(t), 2*sinh(t)), (t, -2, 2), figsize=3))
show(n((e^pi-1)/4)) # Calc
show(n((3*(sqrt(3)-2)-pi)/2))
show(n(27*pi/2))
show(n(f(9*pi)-f(33*pi/4)+f(25*pi/4)-f(11*pi/2)+f(7*pi/2)-f(11*pi/4)+f(3*pi/4)))
5.3.7. Module 4 - Further Integration Methods#
The below is calculations for the definite integrals.
I_02=integral(cos(x)^2,x)
I_22=(I_02-sin(x)*cos(x)^3)/4
I_42(x)=(3*I_22-sin(x)^3*cos(x)^3)/6
s(n(I_42(pi/2)-I_42(0)))
I_13=-cos(x)^4/4
I_33(x)=(2*I_13-sin(x)^2*cos(x)^4)/6
s(I_33(pi/2)-I_33(0))
I_04=integral(cos(x)^4,x)
I_24(x)=(I_04-sin(x)*cos(x)^5)/6
s(n(I_24(pi/2)-I_24(0)))
s(integral(x*cos(x),x))
I_3(x)=x^3*sin(x)+3*x^2*cos(x)-6*x*sin(x)-6*cos(x)
s(n(I_3(pi/2)-I_3(-pi/2))) # x^3*cos(x) is an odd function
I_0(x)=sin(x)
I_2(x)=x^2*sin(x)+2*x*cos(x)-2*I_0(x)
I_4(x)=x^4*sin(x)+4*x^3*cos(x)-12*I_2(x)
I_6(x)=x^6*sin(x)+6*x^5*cos(x)-30*I_4(x)
I_8(x)=x^8*sin(x)+8*x^7*cos(x)-56*I_6(x)
s(I_8(x))
s(n(I_8(pi/2)-I_8(-pi/2)))
s(diff(tan(x),x))
print(bool((diff(tan(x),x))==sec(x)^2))
s(integral(tan(x),x))
f(x)=tan(x)^2/2-ln(abs(sec(x)))
s(n(f(pi/4)-f(0)))
s(integral(tan(x)^2,x))
g(x)=tan(x)^3/3+x-tan(x)
s(n(g(pi/4)-g(0)))
h(x)=tan(x)^5/5-g(x)
s(n(h(pi/4)-h(0)))
s(n(integral(1/((x+1)*sqrt(x^2+1)),x,0,3)))
s(n(integral(1/(2*x^2+x+2),x,0,1)))
s(n(integral(1/sqrt(x^2-x+1/2),x,1/4,1)))
s(diff(1/(x+1),x))
f(x)=ln(abs(x-1/2+sqrt(x^2-x+1/2)))
s(n((f(1)-f(1/4))/sqrt(2)))
f(x)=x^3
s(n(f(15/8)-f(0))/12)
s(n((ln(1/sqrt(2))-ln(3/sqrt(2)))/(2*sqrt(2))))
s(n(integral(1/(x^2-2),x,0,1/sqrt(2))))
f=3/((x+sqrt(3))*(x-sqrt(3))*(x-1))
s(f.partial_fraction())
s(n(3/2*((ln(sqrt(3))-ln(sqrt(3)-1))/(sqrt(3)+3)-(ln(sqrt(3))-ln(1+sqrt(3)))/(sqrt(3)-3)+ln(2))))
s(expand((x^2-x+3)*(x+1)))
s(n(2-integral((2*x+3)/(x^2-x+3),x,-1,1)))
f=4*x/(x-2)^2
s(f.partial_fraction())
g(x)=x^3/3+2*x^2+12*x+32*ln(abs(x-2))-16/(x-2)
s(n(g(1)-g(-4)))
s(expand((x^2+4*x+12)*(x-2)^2))
f=(1-2*x)/((x^2+2*x+5)*(x+2)^2)
s(f.partial_fraction())
s(integral(1/(x^2+2*x+5),x))
s(n(2/3-pi/8))
f=(1-2*x-x^2)/((x+2)^2*(x+3))
s(f.partial_fraction())
print(bool(ln(4)==2*ln(2)))
s(n(ln(3)-2*ln(2)+2/3))
s(integral(f,x,-1,1))
f=(1-2*x-x^2)/((x+2)^2*(x-3))
s(f.partial_fraction())
s(integral(1/(x+2)^2,x))
s(n(-14/25*ln(6)-1/5+11/25*ln(3)+14/25*ln(8)+1/15))
var('a')
s(integral(a/sqrt(x^2-a^2),x))
s(n(3*(ln(6+sqrt(27))-ln(3))))
s(n(5/2*(2^(2/5)-(4)^(2/5))))
s(integral(1/sqrt(a^2-x^2),x))
show(1/6*(sqrt(2)*arctan(sqrt(2)/2*x)+1/2*ln(x**2+2)+5*ln(x-2)))
show(n(integral((x^2+1)/((x^2+2)*(x-2)), (x, 3, 5))))
# Ex. 07 Improper Integrals and Partial Fractions
show(n((ln(6)-ln(2))/4))
show(plot( 1/(x^2)^1/3, (x, -2, 2), figsize=4, ymin=0, ymax=10))
show(n( 6*2^(1/3) ))
show(n(ln(3)-ln(sqrt(5))))
show(n( ( ln(3)-ln(8)+ln(6) )/5 ))
show(n( 3*ln(4)-3*ln(5)+ln(2) ))
show(n( 2*ln(3)-ln(5)/2-2/15 ))
5.3.8. Module 3 - Properties of Curves#
The cartesian and parametric equations, eccentricity, foci and directrices for various curves are below.
Parabola
Cartesian Equation : \(y^2=4ax\)
Parametric Equation : \(x=at^2, y=2at\)
Eccentricity : \(1\)
Foci : \((a, 0)\)
Directrices : \(x=-a\)
Ellipse
Cartesian Equation : \(\large\frac{x^2}{a^2}+\frac{y^2}{b^2}=1, a\gt b\)
Parametric Equation : \(x=a\cos{t}, y=b\sin{t}\)
Eccentricity : \(b^2=a^2(1-e^2)\)
Foci : \((\pm ae, 0)\)
Directrices : \(x=\large\pm\frac{a}{e}\)
Hyperbola
Cartesian Equation : \(\large\frac{x^2}{a^2}-\frac{y^2}{b^2}=1\)
Parametric Equations : \(x=a\sec{t}, y=b\tan{t}\) or \(x=a\cosh{t}, y=b\sinh{t}\)
Eccentricity : \(b^2=a^2(e^2-1)\)
Foci : \((\pm ae, 0)\)
Directrices : \(x=\large\pm\frac{a}{e}\)
show(plot(x/(x^2-4), (x, -5, 5), figsize=4, ymin=-10, ymax=10))
show(plot((1-x^2)/(1+x^2), (x, -7, 7), figsize=4))
show(n(sqrt(4/27)))
Below is plots and calculations for exercise 5.
t=var('t')
show(n(sqrt(1/2)))
show(n(sqrt(4/3)))
show(n(sqrt(9/7)))
show((216+36)/6)
show(84-36)
show(plot(9/x, (x, -10, 10), figsize=3, ymin=-10, ymax=10))
show(parametric_plot((cos(t)^3, sin(t)^3), (t, 0, 2*pi), figsize=3))
show(n(8*sqrt(3)))
show(n(2*sqrt(3)))
show(diff(sin(x)^3))
5.3.9. Module 2 - Further Complex Numbers#
Why complex numbers?
It bridges between 1D and 2D space.
The 1D space is just the real number line.
The 2D space is the cartesian plane which plots the xy co-ordinates or the argand diagram which used for plotting complex numbers.
The sum of a geometric series is $\(\frac{a(r^n-1)}{r-1}\)\( where \)a\( is the first number, \)r\( is the common ratio and \)n$ is the number of terms.
Some properties of roots of unity.
The sum of the roots of unity of the \(n\)th root add up to 0 $\(\frac{1+iz}{1-iz}=\omega^k\)\( for \)k=0, 1, 2, \cdots, n-1$
The \(n\)th roots of \(re^i\theta\) are \(\alpha, \alpha\omega, \cdots, \alpha\omega^{n-1}\),
when \(\large\omega=e^{\frac{2\pi}{n}i}\) and \(\large\alpha=r^\frac{1}{n}e^\frac{i\theta}{n}\)
For a triangle with corners \(A\), \(B\) and \(C\), where \(a\), \(b\) and \(c\) represent their complex number vectors, $\(\frac{c-a}{b-a}=ke^{i\theta}\)\( \)\(k=|\frac{c-a}{b-a}|\)\( \)\(\theta=\arg{\frac{c-a}{b-a}}\)$
show(expand((1+x)*(1+x^2)))
angle=-arctan(1/2)/3+2*pi/3
moduli=5^(1/6)
show(n(cos(angle)*moduli))
show(n(sin(angle)*moduli))
show(144*28)
5.3.10. Module 1 - 1st Order ODE#
Below are calculations using Euler’s method and the improved Euler method
(1.148721271-1.147447)*100/1.148721271
show(n(e^0.5-0.5))
x=1
y=0
h=.1
for i in range(6):
k1=h*(x^2-y/x)
k2=h*((x+h)^2-(y+k1)/(x+h))
y1=y+(k1+k2)/2
show(i+1)
show(n(y1, digits=7))
x+=h
y=y1
x=1
y=0
y1=0
h=.1
y2=0
y=h*(x^2-y/x)
y1=y2
x+=h
y2=y
for i in range(5):
show(y)
y=y1+2*h*(x^2-y/x)
y1=y2
x+=h
y2=y
show(n(y))
x=1
y=0
h=.1
for i in range(6):
a=x^2-y/x
y+=a*h
x+=h
show(n(y))
a=1*sqrt(1)/10
b=1.1*sqrt(a+1)/10+a
c=1.2*sqrt(b+1)/10+b
d=1.3*sqrt(c+1)/10+c
f=1.4*sqrt(d+1)/10+d
g=1.5*sqrt(f+1)/10+f
h=1.6*sqrt(g+1)/10+g
show(n(a))
show(n(b))
show(n(c))
show(n(d))
show(n(f))
show(n(g))
show(n(h))
5.4. ★Further Y12-2#
5.4.1. Assessment 3#
x=var('x')
f(x)=e^(2*x)*(2*tanh(x)+sech(x)^2)
show(f(ln(2)))
g(x)=3*(e^x)^6+(e^x)^4-31*(e^x)^2+3
show(plot(g(x), (x, -2, 0.6), figsize=4))
show(n((126/7+2+1/24+1/896)/4))
show(n((6+1/2+1/160)/4))
f(x)=e^(2*x)*(2*cosh(x)+sinh(x))
show(f(ln(2)))
g(x)=sech(x)^2
show(g(ln(2)))
h(x)=e^x*(tanh(x)-sech(x)^2)/tanh(x)^2
show(h(ln(2)))
# Add circular gridlines
circular_gridlines = Graphics()
for r in [0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4]: # Adjust radii as needed
circular_gridlines += circle((0, 0), r, linestyle="--", color="red", alpha=0.6)
x=var('x')
show(n(sqrt(3+9)))
show(n(pi/3))
show(polar_plot(3+2*cos(4*x), (x, -pi, pi), figsize=4) + circular_gridlines)
show(polar_plot(2+2*sin(6*x), (x, 7*pi/12, 11*pi/12), figsize=4))
show(polar_plot(6*cos(x), (x, -pi, pi), figsize=4))
show(polar_plot(4.5/(1+cos(x)), (x, -pi/2, pi/2), figsize=4))
f(x)=(2*x+1)*(sech(x^2+x)^2+1/(1-(2*x+1)^2))
show(f(0))
5.4.2. Module 8 - Hyperbolic Functions#
for \(x\geqslant1\) $\(\mathrm{arctanh}\hspace{2px}x=\frac{1}{2}\ln{(\frac{x+1}{x-1})}\)\( for \)-1\leqslant x \leqslant1$
# Ex. 16 Working with Hyperbolic Functions
a=sinh(1)
b=cosh(1)
f(x)=3*cosh(2*x)*cosh(3*x)-2*sinh(2*x)*sinh(3*x)
g(x)=cosh(5*x)+5*cosh(x)
show(n(e*(a+b)))
show(n((b-a)/e))
show(n(e*(a-b)/a^2))
show(n( -(a+b)/(e*a^2) ))
show(n(f(ln(2))-f(0)/5))
show(n(g(ln(2))-g(0)/10))
# Ex. 15 Hyperbolic Functions
x=var('x')
f(x)=6*x^4-17*x^3+12*x^2-7*x+6
show(arctanh(0.9))
show(n(log((3+sqrt(30))/7)))
show(n(log(1/sqrt(5))))
show(f(2))
show(f(3))
show(f(5))
show(f(1/2))
show(f(1/3))
show(f(1/5))
show(plot(f(x), (x, -3, 3), figsize=3))
# Hyperbolic plots
x=var('x')
show(plot(sinh(x), (x, -5, 5), figsize=3))
show(plot(cosh(x), (x, -5, 5), figsize=3))
show(plot(tanh(x), (x, -5, 5), figsize=3))
show(plot(csch(x), (x, -1, -0.1), figsize=3))
show(plot(sech(x), (x, -5, 5), figsize=3))
show(plot(coth(x), (x, -1, 1), figsize=3))
5.4.3. Module 7 - An Introduction to Polar Coordinates#
x=var('x')
show(n(pi/2))
show(n(pi/4))
show(n(5*pi/3))
show(n(pi-arctan(4/3)))
show(n(sqrt(3)))
show(polar_plot(2*cos(x), (x, 0, 2*pi), figsize=3))
show(polar_plot(cos(x)+sqrt(cos(x)^2+4), (x, 0, 2*pi), figsize=3))
5.4.4. Assessment 2#
show(n(ln(5)))
f(x)=x+x^3/12+x^5/80
show(n(f(4/3)))
g(x)=-cos(6*x)+6*cos(4*x)-15*cos(2*x)+10
show(n((g(pi/2)-g(pi/4))/32))
show(n(integrate(sin(x)^6, (x, pi/4, pi/2))))
x=var('x')
t=var('t')
y=var('y')
f(x)=x^8/8
f(4)-f(2)
g(x)=-1/x
show(g(7)-g(3))
h(x)=sin(x)
show(n((sin(pi/2)-sin(0))/(pi/2)))
parametric_plot((3*cos(t), 2*sin(t)), (t, 0, 2*pi))
j(t)=2*t^3/3+3*t^2/2
show(j(12)-j(6))
show(diff(x*y*(x-1), x, 2))
5.4.5. Module 6 - Complex Numbers - deMoivre’s Theorem#
deMoivre’s Theorem :
Let \(z=r(\cos{\theta}+i\sin{\theta})\).
For any integer n, $\(z^n=r^n(\cos{n\theta}+i\sin{n\theta})\)\( \)\( \)$
Let \(z=\cos{\theta}+i\sin{\theta}\).
Then using deMoivre’s Theorem : $\(z^n=\cos{n\theta}+i\sin{n\theta}\)\( \)\(z^{-n}=cos{n\theta}-i\sin{n\theta}\)\( So, \)\(z^n+z^{-n}=2\cos{n\theta}\)\( \)\(z^n-z^{-n}=2i\sin{n\theta}\)\( \)\( \)$
# Ex. 12 Complex Exponents
64*4
# Ex. 11 deMoivre's Theorem
show(integrate(sin(x)^5, x))
show(integrate(cos(7*x), x))
4-12/35
show(integrate(cos(7*x)-cos(5*x)-3*cos(3*x)+3*cos(x), x, 0, pi/2))
f(x)=-cos(7*x)/7-cos(5*x)/5+cos(3*x)+3*cos(x)
show(f(pi/2)-f(0))
5.4.6. Module 5 - An Introduction to Maclaurin Series#
Standard Maclaurin Series Expansions
for \(-1\lt x\leqslant1\)
x=var('x')
show(plot(log((1-2*x)/(1+2*x)^2), x, -20, 0.5))
# Ex. 10
x=var('x')
f(x)=2*x+2*x^3/3
show((e^(3*x)-e^(-x))/e^x)
n(f(1/3))
show(diff(ln(1+x)*e^x, x))
show(diff(e^x/(1+x), x))
show(diff(e^x/(1+x)^2, x))
show(diff(arcsin(x), x))
show(diff(arcsin(x), x, 2))
show(diff(arcsin(x), x, 3))
# Ex. 09 con.
x=var('x')
y=var('y')
show(diff(log(x^2+1), x))
show(diff(log(x^2+1), x, 2))
show(diff(log(x^2+1), x, 3))
show(diff(log(x^2+1), x, 4))
show(diff(1-y*x^2, x))
show(diff(1-y*x^2, x, 2))
show(diff(1-y*x^2, x, 3))
# (* Ex. 09 con. *)
x=var('x')
show(diff(cos(x)^2, x))
show(diff(-sin(2*x), x))
show(diff(arctan(x), x))
show(diff(diff(arctan(x), x), x))
show(diff(diff(diff(arctan(x), x), x), x))
Series[Tan[x], {x, 0, 5}]
Series[Cos[x]^2, {x, 0, 4}]
Series[ArcTan[x], {x, 0, 5}]
Series[E^(x^2), {x, 0, 4}]
(* Ex. 09 Maclaurin Series *)
Expand[(1-x+x^2/2-x^3/6)(1+x+x^2/2+x^3/6)]
D[Tan[x], x] (* Tan[x]^2+1 *)af
D[Tan[x]^2, x] (* 2Tan[x]+2Tan[x]^3 *)
D[Tan[x]^3, x] (* 3Tan[x]^2+3Tan[x]^4 *)
D[Tan[x]^4, x] (* 4Tan[x]^3+4Tan[x]^5 *)
D[Tan[x]^5, x] (* 5Tan[x]^4+5Tan[x]^6 *)
5.4.7. Module 4 - Applications of Integration#
Parametric Rewriting for Volume of Revolution
For parametric equations, when t is the unit(\(a \leqslant t \leqslant b\)) :
For rotation about the \(x\) axis,
For rotation about the \(y\) axis,
If not parametric equations, then just use first part of formula.
(* Ex. 08 The mean of a Function *)
4/(3Pi)//N
(Sqrt[Pi]/2)^2
(* Ex. 08 The mean of a Function *)
Expand[(x^2+2)^2]
2/Sqrt[3]//N
(32/5+32/3+8)/2//N (* Find mean values by using definite integral to calculate area *)
(E^5-27/2)/5//N
(Log[4]-Log[6]+Log[3])/2/3//N
Plot[2ArcCos[x], {x, 0, 1}]
f[t_]:=-4Sin[t]^3
Plot[f[t], {t, -3Pi, 3Pi}]
(* Ex 07 Volumes of Revolution *)
Pi(2^5-1^5)*0.6//N
Expand[(x^2+1)^2]
348Pi/5//N
62Pi/5//N
Pi^2/2//N
16Pi/3//N
Integrate[-4Sin[t]^3, {t, Pi, 0}]
Integrate[-4Sin[t]t^2, {t, 0, Pi/2}]//N
Pi*Integrate[4-x^2, {x, 0, 2}]//N
256Pi/105//N
Pi*Integrate[-2x^2/Sqrt[1-x^2], {x, 0, Pi}]//N
Pi*Integrate[(2x-x^3/2), {x, 0, 2}]//N
128Pi/21//N
(* Plot revolution *)
f[x_] := Sqrt[3 x - 2] (*MMA 空格 是乘号 *)
RevolutionPlot3D[f[x], {x, 0, 5}, RevolutionAxis -> "x", AspectRatio -> 1]
5.4.8. Module 3 - Further Differentiation and Integration#
Integration methods :
Trigonometric identities for integration :
\(x^2+25=169(yz+144)/(288+144x+16y-9z+xyz)\)
\(y^2+153=169(xz+16)/(288+144x+16y-9z+xyz)\)
\(z^2+160=169(xy-9)/(288+144x+16y-9z+xyz)\)
(* Ass. 1 Calc (con.) *)
mat1={{1, 2, 4}, {2, 4, 5}, {0, 1, 2}};
mat2={{-3}, {3}, {6}};
Inverse[mat1].mat2//MatrixForm
D[Tan[x],x]
D[Log[u],u]
D[Cos[x]^2,x]
Integrate[Sec[x]^2,x]
Integrate[Sec[x]^2Tan[x],x]
D[Cos[3x]^5,x]
(Log[16]-Log[2])/2//N
Pi/9//N
(ArcTan[2]-ArcTan[2/Sqrt[3]])/(2Sqrt[3])//N
(* Assessment 1 Calculation *)
4-18+6-10
20-12-8+36
72-16-24+40
mat1={{12, 3, -4}, {3, 4, 12}, {4, -12, 3}};
Det[mat1]
MatrixForm[Transpose[mat1].mat1]
MatrixForm[mat1]
FactorInteger[2197]
Inverse[mat1]
N[(Pi-2)/16]
N[12-3Pi]
D[Cos[x]^3,x]
1/(2Sqrt[1-3^2])==1/Sqrt[4-4*(3^2)]
N[Pi/(3Sqrt[3])]
f[x_]:=ArcTan[(3/4)x]/4
N[f[4/3]-f[0]]
Integrate[Cot[x],x]
D[Cot[x],x]
g[x_]:=(-Csc[x/2-1]^2)/2
g[3]
D[Cot[x],x]
D[ArcCos[x],x]
Integrate[Sec[x]^2,x]
D[Sin[x]^4,x]
Integrate[1/Sqrt[4-3x^2],{x,0,1}]
D[ArcSin[Sqrt[3/4]x]/2,x]
D[ArcTan[(3/4)x]/4,x]
D[Sin[1/x],x]
D[Log[2x],x]
D[Csc[x],x]
D[ArcTan[x],x]
D[Sec[x],x]
5.4.9. Module 2 - Mathematical Induction#
For mathematical induction if \(n=k\) then \(n=k+1\) so if for \(n=1\) the claim is true then for \(\Z_+\).
For series use formula to check if \(n=k+1\) will be true.
For divisibility check if \(u_{k+1}-u_k\) is divisible by \(n\).
n=1
n=3n+4
n=3n+4
n=3n+4
f[x_]:=3^x-2
f[1]
f[2]
f[3]
f[4]
5.4.10. Module 1 - Determinant and Inverse of 3 by 3 Matrix#
mat1={{1, 0, 0}, {0, 0, 1}, {0, -1, 0}}//MatrixForm
mat1={{1, 0, 0}, {0, 0, 1}, {0, -1, 0}}//MatrixForm
mat2={{0, -1, 0}, {1, 0, 0}, {0, 0, 1}};
mat3=mat1.mat2;
mat4={{-1, 0, 0}, {0, -1, 0}, {0, 0, 1}};
mat5={{13, 53, 10}, {4, -7, -2}, {2, -8, -1}}/9;
mat6={{3}, {-2}, {4}};
mat7={{1, 1, -1}, {0, 6, 2}, {-3, 1, 1}};
MatrixForm[mat3]
MatrixForm[mat2.mat1]
Det[mat3]-Det[mat1]Det[mat2]
MatrixForm[mat4.mat4]
MatrixForm[mat5.mat6]
Det[mat7]
dist=BinomialDistribution[40,0.2];
ans=1-CDF[dist,11]
dist=NormalDistribution[12,3.5/40];
ans=CDF[dist,10.8]
dist=NormalDistribution[12,3.5];
N[CDF[dist,15]-CDF[dist,10]]
dist=NormalDistribution[];
quan1=Quantile[dist,0.05]
quan2=Quantile[dist,0.75]
mat1={{1, 1, 1}, {x, y, z}, {x^2, y^2, z^2}}//MatrixForm;
mat2={{p, q, r}, {p^2, q^2, r^2}, {qr, pr, pq}};
Det[mat1]
Simplify[Det[mat2]]
12*2-53*4-3*5*10+3*53-2*10+4*12*5
3*4-3*3-2*5*4-2*2
5.5. ★Further Y12-1#
5.5.1. Module 7 - Vectors 1#
ArcCos[0.44141]*180/Pi
44+29
29*4-30
3*29-21
N[Sqrt[(73/29)^2+(86/29)^2+(66/29)^2]]
N[Sqrt[(27/10)^2+(9/10)^2]]
Sqrt[75]
N[7*5Sqrt[3]/14]
N[ArcCos[11/14]*180/Pi]
vec1={{2}, {3}, {2}};
vec2={{6}, {-2}, {1}};
vec1-vec2*3/2
(-2/7)^2+(8/7)^2+(18/7)^2
Angle between 2 vectors
\(\cos{\theta}=\large\frac{a_1b_1+a_2b_2}{|\mathbf{a}||\mathbf{b}|}\)
Scalar Product/Dot Product
\(\mathbf{a}\mathbf{b}=ab\cos{\theta}\)
\(\mathbf{a}\mathbf{b}=a_1b_1+a_2b_2\)
5.5.2. Module 3 and 6 - Further Algebra and Functions 1 and 2#
mat1={{1, -1, 2}, {2, 1, 1}, {2, -2, 1}};
mat2=Inverse[mat1];
mat3={{9}, {0}, {3}};
mat4=mat2.mat3;
f[x_]:=x(x+1)/2
g[x_]:=x(x+1)(2x+1)/6
h[x_]:=2g[x]+3f[x]
j[x_]:=x^2-17x+22
k[x_]:=x(x+1)^2
MatrixForm[mat2]
MatrixForm[mat4]
36*7
f[50]-f[20]
g[100]-g[90]
f[50]-f[15]+5*35
h[50]-h[25]
j[1]
j[3]
j[-2]
k[30]-k[20]
f[x_]:=2x(x+1)
g[x_]:=x(x+1)(2x+1)+2x
h[x_]:=x(x+1)(x+2)(x+3)
i[x_]:=x(x-1)(x+1)(x+2)
f[20]-f[9]
g[10]-g[4]
h[1]
h[2]
h[3]
i[1]
i[2]
i[3]
16*4*9
35*4.2
35*0.42*0.58
dist=BinomialDistribution[35,0.42];
1-CDF[dist,17]
dist=NormalDistribution[34,4.5];
ans=1-CDF[dist,36.2]
dist=NormalDistribution[];
ans=1.5Quantile[dist,0.95]
10-ans
dist=NormalDistribution[1.78,.23];
N[CDF[dist,1.82]-CDF[dist,1.82]]
N[CDF[dist,1.9]-CDF[dist,1.7]]^2
45-17-15-4
70-31-17-15
N[101/240]
240-101-7-9
123/3
N[41/80]
240-101-31-17-7-15-4-9
101+31+7
N[139/195]
69.2/40
Sqrt[2.81/40]
1.78-0.23*2
dist=BinomialDistribution[20,0.3];
N[PDF[dist,1]]
N[CDF[dist,3]]
1-N[CDF[dist,9]]
f[x_]:=x^3+4x^2-x+2
g[x_]:=5x^2-9x+22
h[x_]:=x^2+2x+9
f[2]
g[4]
h[4]
f[x_]:=4x(4x+1)(8x^2-1)
g[x_]:=2(x-1)(2x-1)(8(x-1)^2-1)
Expand[f[x]-g[x]]
n=4;
f[x_]:=x(x+1)/2
g[x_]:=x(x+1)(2x+1)/6
h[x_]:=x^2(x+1)^2/4
n(n+1)(8n-5)/6
Simplify[Expand[2h[4x]-6g[4x]]]
n=20;
n1=15;
n2=4;
a=40;
b=19;
25*51
n(n+1)(2n+1)/6
15*31+60-5*9-18
(n1(n1+1)(2n1+1)-n2(n2+1)(2n2+1))/6
2(25*51-1.5*50+9*1.5-5*9)
(a(a+1)(2a+1)-b(b+1)(2b+1))*5/6-84
Expand[(x+1)(x+2)(x-3)]
4*5*9
n=Pi/6;
f[x_]:=Sin[2x]-x
g[x_]:=f'[x]
g[x]
n=N[n-f[n]/g[n]]
dist=BinomialDistribution[25,0.7];
N[1-CDF[dist,20]]
lower=N[Quantile[NormalDistribution[],0.6]]
upper=N[Quantile[NormalDistribution[],0.8]]
sd=0.2/(upper-lower)
5.9-lower*sd
dist=NormalDistribution[24500,5200];
ans=1-N[CDF[dist, 26730]]
Expand[(2a-1)(2b-1)+(2a-1)(2c-1)+(2b-1)(2c-1)]
Simplify[Divide[f[z],z-3]]
f[z_]:=z^3-z^2+11z-51;
Plot[f[z],{z,1,5}]
Suppose \(ax^2+bx+c=0\) has roots \(x=\alpha\) and \(x=\beta\)
Then \(\alpha+\beta=-\large\frac{b}{a}\) and \(\alpha\beta=\large\frac{c}{a}\)
Suppose \(ax^3+bx^2+cx+d=0\) has roots \(x=\alpha\), \(x=\beta\) and \(x=\gamma\)
Then \(\alpha+\beta+\gamma=\large\frac{-b}{a}\), \(\alpha\beta+\alpha\gamma+\beta\gamma=\large\frac{c}{a}\), \(\alpha\beta\gamma=-\large\frac{d}{a}\), \(\alpha^2+\beta^2+\gamma^2=(\alpha+\beta+\gamma)^2-2(\alpha\beta+\alpha\gamma+\beta\gamma)\) and \(\large\frac{1}{\alpha}+\large\frac{1}{\beta}+\large\frac{1}{\gamma}=\large \frac{\alpha\beta+\alpha\gamma+\beta\gamma}{\alpha\beta\gamma}\)
Suppose \(ax^4+bx^3+cx^2+dx+e\) has roots \(x=\alpha\), \(x=\beta\), \(x=\gamma\) and \(x=\delta\)
Then \(\Sigma\alpha=-\large\frac{b}{a}\), \(\Sigma\alpha\beta=\large\frac{c}{a}\), \(\Sigma\alpha\beta\gamma=-\large\frac{d}{a}\) and \(\alpha\beta\gamma\delta=\large \frac{e}{a}\)
b+c+d
a=3;
b=2a;
c=a-2;
d=1/a;
N[b*c+c*d+b*d]
1+12+18-81
Expand[(3a+1)(3b+1)(3c+1)]
Expand[(3a+1)(3b+1)+(3a+1)(3c+1)+(3b+1)(3c+1)]
-3/4-6+16
1.5^3-3*3*1.5+3*1
Expand[(a+b+c)^3]
1-3/2+6/2-2/2
1-(a+b+c)+(ab+ac+bc)-abc=1+1.5+3+1
Expand[(1-a)(1-b)(1-c)]
5.5.3. Modules 2 and 5 - Matrices 1 and 2#
Matrices for transformations:
Reflection in the x axis:
Reflection in the y axis:
Reflection in the line y=x axis:
Anticlockwise rotation of theta about the origin:
$$\begin{pmatrix}\cos{\theta}&&-\sin{\theta}\ \sin{\theta}&&\cos{\theta}\end{pmatrix}
k=5;
mat1={{3,1,2},{1, -2, 1}, {-1, 4, 1}};
mat2={{k+1, 8, -4}, {-3, k-4, 7}, {3, -11, 2k+3}};
mat3={{3, -2, 2}, {2, 3, -1}, {1, 3, 1}};
mat4={{2, 3, -4}, {1, -1, -2}, {5, 2, 3}};
mat5={{2, 3, -1}, {1, -2, -3}, {1, 5, 2}};
mat6=Inverse[mat4];
mat7={{11},{8},{7}};
mat8=mat6.mat7;
Det[mat1]
Det[mat3]
MatrixForm[mat2]
MatrixForm[mat6]
Det[mat5]
MatrixForm[mat8]
4*27-7*33
3*27+5*33
6*3-7*1+5*1
6*1+7*2-5*4
6*2-7*1-5*1
2*3-5*1-1
6*16-7*13+5*15
2*16-5*13-15
13^2-15*7-16*2
6*3-2*8-4*22
f[x_]:=x^3-2x^2-5x+6;
g[x_]:=x-1
Simplify[f[x]/g[x]]
p={{1,-2},{3,-2}};
q={{-2,1},{1, -2}};
r={{-1, -2}, {-3, 4}};
MatrixForm[p.q]
MatrixForm[r.q]
MatrixForm[p.r]
Det[mat1]
mat1={{3,-8}, {-5, 7}};
MatrixForm[mat1.unitsquare]
mat1={{-7,-2}, {4, -2}};
MatrixForm[mat1.unitsquare]
mat1={{5,-1},{-3,1}};
MatrixForm[mat1.unitsquare]
unitsquare={{0,0,1,1},{0,1,1,0}};
mat1={{2,2},{-1,4}};
MatrixForm[mat1.unitsquare]
mat1={{4,2},{3,6}}
Det[mat1]
Identity matrices have 1’s on the lead diagonal that stretches from the top-left corner to the bottom-right corner.
For example, below is 3 by 3 identity matrix:
(* Ex 05 q 7 *)
mat1={{-3,2},{-8,5}};
mat2={{x},{2x+1}};
MatrixForm[mat1.mat2]
mat1={{3,7},{2,4}};
mat2={{2,3},{-1,2}};
mat5={{3,6,1},{-4,-2,5}};
mat7=IdentityMatrix[3];
mat6=mat1.mat5;
mat3=mat1*mat2;
mat4=mat1.mat2;
MatrixForm[mat3]
MatrixForm[Transpose[mat1]]
MatrixForm[mat6]
MatrixForm[mat7]
mat1={{1,0},{0,1}};
mat2={{-1,0},{-1,0}};
MatrixForm[mat1.mat2]
5.5.4. Module 1 and 4 - Complex Numbers 1 (Introduction) Complex Numbers 2 (Complex Plane)#
ArcTan[0.5]
N[ArcTan[2]]
N[3E^(3I)]
Expand[(a+b*I)^3]
N[2E^I]
0.1415*-2.4034-1.7954*1.995
0.1415*1.7954+1.9950*-2.4034
N[Cos[-1]]
N[Sin[-1]]
N[Cos[-2]]
N[Sin[-2]]
N[Cos[2]]
N[Sin[2]]
2Cos[1.5]
2Sin[1.5]
3Cos[2.5]
3Sin[2.5]
(1.081^2+1.683^2)(-0.909^2-0.416^2)
(3+4I)(3-4I)
f[z_]:=(2z-2I)/(1+I)-3+I
NSolve[f[z],z]
Pi-ArcTan[1.5]