Posts

Triple Integration

Triple Integration 1. Introduction Let $f(x,y,z)$ be a continuous function defined on a closed and bounded region $V \subset \mathbb{R}^3$. The triple integral of $f$ over $V$ is defined as $$ \iiint_V f(x,y,z)\, dV $$ It represents the limit of Riemann sums: $$ \iiint_V f(x,y,z)\, dV = \lim_{\max \Delta V_i \to 0} \sum f(x_i,y_i,z_i)\,\Delta V_i $$ provided the limit exists. If $f(x,y,z)=1$, then the triple integral reduces to: $$ \iiint_V 1\, dV = \text{Volume of } V $$ In practical computation, triple integrals are evaluated as iterated integrals: $$ \iiint_V f(x,y,z)\, dV = \int_a^b \int_{g_1(x)}^{g_2(x)} \int_{h_1(x,y)}^{h_2(x,y)} f(x,y,z)\, dz\, dy\, dx $$ The order of integration may be changed whenever convenient. # 2. Explanation Think of a double integral as adding up tiny rectangles to find the area of a region. A triple integral does the same thing in three dimensions — it adds up tiny boxes (small volumes) to find: Volume...

Double Integration

Image
Double Integration Examples with Graphs Double Integration: Solved Examples with Graphs Understanding Double Integration Double integration extends the concept of a single integral to functions of two variables, $$f(x, y)$$. Geometrically, it represents the volume under a surface within a given region $$D$$. Example 1: Rectangular Bounds Evaluate $$\iint_R (x + 2y) \, dA$$ over $$R = [0, 1] \times [0, 2]$$. x y Step 1: Setup Iterated Integral $$\int_{0}^{1} \int_{0}^{2} (x + 2y) \, dy \, dx$$ Step 2: Integrate w.r.t $y$ $$\int_{0}^{1} [xy + y^2]_{0}^{2} \, dx = \int_{0}^{1} (2x + 4) \, dx$$ Step 3: Integrate w.r.t $x$ $$[x^2 + 4x]_{0}^{1} = 1 + 4 = 5$$ Final Answer: 5 Example 2: Polar Transformation Find the area of a circle with radius $$a$$. $$\iint_D dA = \int_{0}^{2\pi} \int_{...

Weighted Sampling

What is Weighted Sampling? Weighted sampling is a sampling technique where each item is assigned a weight , and the probability of selecting that item is proportional to its weight. Higher weight $\Rightarrow$ higher chance of being selected Lower weight $\Rightarrow$ lower chance (but usually not zero) Mathematical Definition Given $n$ items with weights: $ w_1, w_2, \dots, w_n $ The probability of selecting item $i$ is: $ P(i) = \frac{w_i}{\sum_{j=1}^{n} w_j} $ Example: weights $[1,3,6] \Rightarrow [0.1,0.3,0.6]$ Visual Intuition Weighted bar representation: A | █ B | ███ C | ██████ Flattened view: | A | B B B | C C C C C C | Sampling is equivalent to picking a random point on this bar. Larger segments correspond to higher probability. Four Examples of Weighted Sampling Lottery: More tickets $\Rightarrow$ higher winning chance Online advertising: Higher bids shown more often Survey sampling: Oversampling rare groups G...

Randomized Algorithms

 Randomized Algorithms:   An algorithm that uses random numbers to decide what to do next anywhere in its logic is called a Randomized Algorithm .  For example , in Randomized Quick Sort, we use a random number to pick the next pivot (or we randomly shuffle the array)   Type of Randomized Algorithms 1.   Las Vegas:  A Las Vegas algorithm is an algorithm which uses randomness, but gives guarantees that the solution obtained for given problem is correct. Advantage:    Always produce a correct answer. Randomness affects the running time, not correctness. Expected running time is finite and analyzed probabilistically.    A randomized quick-sort algorithm where we randomly choose pivot is an example of Las-Vegas algorithm. The algorithm always sorts the array. The advantage we get with randomization is, there is no pattern for which the quick sort causes worst case (unlike choosing fixed pivot like a corner element causes wor...

Total Derivatives part 1

Geometric Interpretation of Total Derivative Consider a function of two variables $$ z = f(x, y) $$ This function represents a surface in three-dimensional space. Each point on the surface corresponds to a particular value of $x$ and $y$. x z y (x, y, z) The red point represents a point on the surface corresponding to the values $(x, y)$. Small Changes in Variables Suppose the independent variables $x$ and $y$ change by small amounts $dx$ and $dy$. These small changes cause a change in $z$, denoted by $dz$. dx dy The movement along the $x$-direction by $dx$ and along the $y$-direction by $dy$ together produce a total change in the value of $z$. ============================= Total Change in z The total change in $z$ is the combined effect of the change due to $x$ and the change due to $y$. Mathematically, it is given by: $$ dz = \frac{\partial z}{\partial x}\,dx + \frac{\partial z}{\partial ...

Partial Differentiation : An Introduction.

============================================================================================= Introduction to Partial Differentiation In many practical situations, a quantity depends on more than one independent variable. For example, the volume of a gas may depend on both pressure and temperature, or the area of a surface may depend on two spatial coordinates. Such functions are called functions of several variables . If a function depends on two independent variables $x$ and $y$, it is written as $$ z = f(x, y) $$ Partial differentiation is the process of finding the rate of change of a function with respect to one variable while keeping the other variable(s) constant. The partial derivative of $z$ with respect to $x$ is denoted by $$ \frac{\partial z}{\partial x} $$ and is obtained by differentiating $z$ with respect to $x$, treating $y$ as a constant. Similarly, the partial derivative of $z$ with respect to $y$ is denoted by $$ \frac{\partial z}{\partial y} $$ a...

Approximate Matrix Multiplication: Random Sampling of Columns/Rows (Sketching

Approximate Matrix Multiplication using Random Sampling Background: Approximate Matrix Multiplication (AMM) Matrix multiplication is a fundamental operation in scientific computing, machine learning, data mining, and numerical linear algebra. Given two matrices \( A \in \mathbb{R}^{n \times d} \) and \( B \in \mathbb{R}^{d \times m} \), the exact computation of \( AB \) requires \( O(ndm) \) arithmetic operations, which becomes computationally expensive when the inner dimension \( d \) is large. Approximate Matrix Multiplication (AMM) addresses this challenge by computing an approximation \( \widetilde{C} \approx AB \) that is significantly faster to obtain while maintaining provable accuracy guarantees. The key idea is to reduce the dimensionality of the problem using randomized techniques, thereby lowering computational cost and memory usage. Random Sampling of Columns and Rows (Sketching) One of the simplest and most intuitive approaches to AMM is ra...