Theory of Vector Fields
Theory of Vector Fields Exercise 1 : Basic Operations on Vector Fields Given the vector fields: $\mathbf{F}_1 = x^2 \hat{\mathbf{z}}$ $\mathbf{F}_2 = x \hat{\mathbf{x}} + y \hat{\mathbf{y}} + z \hat{\mathbf{z}}$ $\mathbf{F}_3 = yz\hat{x} + zx\hat{y} + xy\hat{z}$ Calculate $\nabla \cdot \mathbf{F}_i$ and $\nabla \times \mathbf{F}_i$ for $i=1,2,3$. Which fields are conservative? Find scalar potentials where possible. Which fields are solenoidal? Find vector potentials where possible. Show that $\mathbf{F}_3$ can be expressed both as a gradient and a curl. Exercise 2 : Helmholtz Theorem Implications For a vector field $\mathbf{F}$ in 3D, prove the following implications: ...
Vector Algebra
Vector Algebra Exercise 1 : Distributivity of Dot and Cross Prove that the dot and cross products are distributive, using definitions and diagrams: for three coplanar vectors in the general case Exercise 2 : Cross Product Associativity? Is the cross product associative? That is, does the following hold? $$ (A \times B) \times C = A \times (B \times C) $$ Prove or provide a counterexample. Exercise 3 : BAC-CAB Identity Prove the vector identity: $A \times (B \times C) = B,(A \cdot C) - C,(A \cdot B)$ (the BAC-CAB rule) by writing both sides in component form. ...
Integral Calculus
Integral Calculus Exercise 1 : Basic Line Integral For $\mathbf{v} = x^2,\hat{\mathbf{x}} + 2yz,\hat{\mathbf{y}} + y^2,\hat{\mathbf{z}}$, compute $\int_C \mathbf{v} \cdot d\mathbf{l}$ from $(0,0,0)$ to $(1,1,1)$ along: $(0,0,0) \to (1,0,0) \to (1,1,0) \to (1,1,1)$ $(0,0,0) \to (0,0,1) \to (0,1,1) \to (1,1,1)$ The straight line $x = y = z$ Evaluate $\oint \mathbf{v} \cdot d\mathbf{l}$ around the closed loop: out via 1., back via 2.. Exercise 2 : Gradient Field Verification Given $\phi = e^{xyz}$, compute $\nabla \phi$ and verify the gradient theorem: $\int_{\mathbf{a}}^{\mathbf{b}} \nabla \phi \cdot d\mathbf{l} = \phi(\mathbf{b}) - \phi(\mathbf{a})$ for $\mathbf{a} = (0,0,0)$ and $\mathbf{b} = (1,1,1)$ along two different paths. ...
Dirac Delta Function
Dirac Delta Function Exercise 1 : Basic Delta Integrals Evaluate the following integrals: $\displaystyle \int_{2}^{6} (3x^2 - 2x - 1) , \delta(x - 3) , dx$ $\displaystyle \int_{0}^{5} \cos x ; \delta(x - \pi) , dx$ $\displaystyle \int_{-1}^{3} x^3 , \delta(x + 1) , dx$ $\displaystyle \int_{-\infty}^{\infty} \ln(x + 3) , \delta(x + 2) , dx$ $\displaystyle \int_{0}^{\infty} e^{-x} , \delta(x - 2) , dx$ Exercise 2 : Delta with Scaled & Shifted Arguments Use $\delta(ax) = \frac{1}{|a|}\delta(x)$ and similar properties to evaluate: ...
Differential Calculus
Differential Calculus Exercise 1 Calculate the directional derivative of $f(x,y,z) = x^2y + y^2z$ in the direction of $\hat{\mathbf{n}} = (\hat{\mathbf{x}} + \hat{\mathbf{y}} + \hat{\mathbf{z}})\sqrt{3}$ at point $(1,2,3)$. Exercise 2 Compute the gradient of the following scalar fields: $f(x,y,z) = x^2 + 2xy + 3z + 4$ $g(x,y,z) = \sin x \sin y \sin z$ $h(x,y,z) = e^{-5x}\sin 4y\cos 3z$ Exercise 3 For the vector field $\mathbf{F} = x^2\hat{\mathbf{x}} + 3xz^2\hat{\mathbf{y}} - 2xz\hat{\mathbf{z}}$: ...
Curvilinear Coordinates
Curvilinear Coordinates Exercise 1 : Inverting Spherical Coordinates Invert the transformation $x = r\sin\theta\cos\phi$, $y = r\sin\theta\sin\phi$, $z = r\cos\theta$ to express $(r, \theta, \phi)$ in terms of $(x, y, z)$. Exercise 2 : Coordinate Examples (Conversions) Invert the transformation $x = r\sin\theta\cos\phi$, $y = r\sin\theta\sin\phi$, $z = r\cos\theta$ to express $(r, \theta, \phi)$ in terms of $(x, y, z)$. Express the point $(x, y, z) = (2, -2, 1)$ in spherical and cylindrical coordinates. Express $(r, \theta, \phi) = (3, \pi/3, \pi/4)$ in Cartesian coordinates. Express $(s, \phi, z) = (4, 5\pi/6, -2)$ in Cartesian coordinates. Exercise 3 : Spherical Unit Vectors Express the spherical unit vectors $\hat{\mathbf{r}}$, $\hat{\boldsymbol{\theta}}$, $\hat{\boldsymbol{\phi}}$ in terms of the Cartesian unit vectors $\hat{\mathbf{x}}$, $\hat{\mathbf{y}}$, $\hat{\mathbf{z}}$, i.e., derive: ...
Vectors and Matrices in Python Solutions
Vectors and Matrices in Python Solutions Exercise 1 : Vectors in $\mathbb{R}^7$ Consider the following vectors: $$ u = (0.5, 0.4, 0.4, 0.5, 0.1, 0.4, 0.1), \quad v = (-1, -2, 1, -2, 3, 1, -5) $$Using Python and NumPy: Check whether $u$ and $v$ are unit vectors. Compute the dot product of $u$ and $v$. Determine if $u$ and $v$ are orthogonal. import numpy as np u = np.array([0.5, 0.4, 0.4, 0.5, 0.1, 0.4, 0.1]) v = np.array([-1, -2, 1, -2, 3, 1, -5]) # 1. Check if u and v are unit vectors norm_u = np.linalg.norm(u) norm_v = np.linalg.norm(v) print(norm_u, norm_v) # 2. Dot product dot_uv = np.dot(u, v) print(dot_uv) # 3. Orthogonality print(np.isclose(dot_uv, 0)) Exercise 2 : Norms and Orthogonality Consider the following vectors in $\mathbb{R}^9$: ...
Vectors and Matrices in Python
Vectors and Matrices in Python In this worksheet, you will use Python (NumPy) to perform vector and matrix operations. For each exercise, write Python code to compute the required results and verify them numerically. Exercise 1 : Vectors in $\mathbb{R}^7$ Consider the following vectors: $$ u = (0.5, 0.4, 0.4, 0.5, 0.1, 0.4, 0.1), \quad v = (-1, -2, 1, -2, 3, 1, -5) $$Using Python and NumPy: Check whether $u$ and $v$ are unit vectors. Compute the dot product of $u$ and $v$. Determine if $u$ and $v$ are orthogonal. Exercise 2 : Norms and Orthogonality Consider the following vectors in $\mathbb{R}^9$: ...
Vectors and Matrices
Vectors and Matrices Exercise 1 Consider the following vectors in $ \mathbb{R}^7 $: $$ u = (0.5, 0.4, 0.4, 0.5, 0.1, 0.4, 0.1), \quad v = (-1, -2, 1, -2, 3, 1, -5) $$ Check if $ u $ and $ v $ are unit vectors. Calculate the dot product of the vectors $ u $ and $ v $. Are $ u $ and $ v $ orthogonal? Exercise 2 Consider the following vectors in $ \mathbb{R}^9 $: ...
Mathematics for Machine Learning
Mathematics for Machine Learning Exercise 1 : Basic vector operations Let $$ \mathbf{u} = (1,2,-1)^\top, \quad \mathbf{v} = (0,1,3)^\top. $$ Compute: ⟨u, v⟩ \( \| \mathbf{u} \|_2 \) and \( \| \mathbf{v} \|_2 \) Projection of u onto v. Exercise 2 : Linear system Solve: $$ A = \begin{pmatrix} 2 & -1 & 0 \\ 1 & 1 & 1 \\ 0 & 2 & -1 \end{pmatrix}, \quad \mathbf{b} = \begin{pmatrix} 1 \\ 3 \\ -1 \end{pmatrix}, \quad A\mathbf{x} = \mathbf{b}. $$Exercise 3 : Data interpretation Given points (1,2), (2,3), (3,5), form the design matrix X for ...