Applied Math

Complete Lecture Notes

Page 1

0. Statistics; Numerical Characteristics; Parameter Estimation, Hypothesis Testing

  1. - Mean = mean(x) - Median = median(X) - Range = range(X) - Correlation Coefficient = corrcoef(x, y); Covariance Matrix = cov(x,y) - Variance = var(X), Standard Deviation = std(X) - Sample Standard Deviation = stdev(x,1)
  1. - [μ₀, σ²] = ... data(param); Random Number = ... rand(param, count) - f(x₀) = ... pdf(X,σ²); F(x₀)=...cdf(Xₐ,param) - X₀ = ... inv(P²(0),param)
  1. Normal Distribution Parameter Estimation - [μ₀, σ²] = normfit(X)
  1. Normal Distribution Hypothesis Testing (h=0: Accept; h≠1: Reject) - Single μ₀ * z = (x̄-μ₀) / σ/√n ~ N(0,1) - Two-tailed: |z| ≤ U₁-α/2 * Single-sided right tail test: - z ≥ uₐ / U₁-α * Single μ₀ (σ² unknown) - t = x̄/s√n ~ t(n-1) * Two-tailed: |t| ≤ t₁₋α/2 - Single-sided right tail test: * t ≥ ta / ti-α **Single σ²** - χ² = (n-1)S² / S̄^2 ~ X²(n) - Two-tailed: χ² ≤ x₁₋α/2 * Single-sided right tail test: - χ² ≥ x₂^1 / X₁-α **Two μ₀ (σ¹, σ² known)** - z = x̄-y / √(σ₁^2/n + σ₂²/ n) ~ N(0,1) - Two-tailed: |z| ≤ U₁-α/2 * Single-sided right tail test: - z ≥ uₐ / U₁-α **Two μ₀ (σ¹, σ² unknown)** - t = x̄-y / √(S₁^2/n + S₂²/ n) ~ t(n-1,n) - Two-tailed: |t| ≤ ti-α/2 * Single-sided right tail test: - t ≥ ta / ti-d **Two σ²** * F = S₁^2/S₂² ~ F(n-1,n) - Two-tailed: s₁ ≤ S₃^2 * Single-sided right tail test: - F ≥ f₁-α/2 **Z-test** * z = (x̄ - p₀) / √(p₀*(1-p₀)/n) * Two-tailed: |z| ≤ U₁-α/2 - Single-sided right tail test: * z ≥ uₐ / U₁-α **χ²-test** - χ² = (n-p) / p(1-p) * Two-tailed: |z| ≤ U₁-α/2 - Single-sided right tail test: * z ≥ uₐ / U₁-α

Page 2

Mathematical Interpolation and Numerical Integration

  1. Lagrange Polynomial Interpolation: $$ y = \text{lagr}(x_0, x) $$
  2. Piecewise Linear Interpolation: $$ y = \text{interp1}(x_0, x) $$
  3. Cubic Spline Interpolation: $$ y = \text{spline}(x_0, x) $$
  4. Trapezoidal Integration: $$ S = \text{trapz}(x, y) $$
  5. Quadrature Integration: $$ S = \text{quad}(f, a, b) $$
  6. Monte Carlo Integration: $$ S = \frac{m}{n} A, $$
  7. Mean Value Integration: $$ S = \frac{1}{n} A, $$
  8. Numerical Differentiation and Ordinary Differential Equations

**1st Order Forward Difference:** $$ y' = \text{diff}(y) $$ **2nd Order Forward Difference:** $$ y' = \text{diff}(y) $$ 1. Euler's Method: - Forward: Local error O(h²) 2. Backward Euler’s Method 3. Central Difference Formula: - Local error O(h³) 4. Improved Euler's Method 5. 3rd Order Runge-Kutta: 6. 4th Order Runge-Kutta:

Linear Systems of Equations and Linear Differential Equations

  1. Direct Method (Small-Scale): $$ x = A \backslash b, $$
  2. Cholesky Decomposition:
  3. Symmetric Positive Definite Matrix:

**Iterative Methods (Large-Scale, Ill-Conditioned)** $$ x^{(k+1)} = Bx^k + f, $$ $$ \|B\| < 1 \Leftrightarrow convergence. $$ $$ [L, U] = lu(A), $$

**Matrix Decomposition:** - Cholesky: $$ L^T = \text{chol}(A). $$

**Eigenvalue Decomposition:** $$ p(B) = \max(\text{abs}(eig(B))). $$


Page 3

Mathematical Methods in Numerical Analysis

1) Direct Iteration: B = D^T(L + U), f=D^{-}b [x, time,B] = J(A,b,x0,tol) Abs: |aij| > ∑i≠j aij 2) Gauss-Seidel Iteration: B = (D-L)^{-1}U, f=(D-Q^{-})b [x,t ime,B] = G(A,b,x0,tol) Abs: |aij| > ∑i≠j aij 3) SOR Iteration: B = B(w), f=f(w) Abs: 0 < w ≤<1, stable

Note: A = D-L-U D=diag(diag(A)), U=-triu(A,1), L = -tril(A,-1)

Norm: norm(x,p) Condition Number: cond(x) ≥ 0 Cond > 1 then ill-conditioned

Sparse Matrix: S = sparse(i,j,val,m,n); SS=full(S)

Nonlinear Equations (System): x^(k+1) = φ(x^k), until |φ^(p)(x*)| < tol [x, time] = newton('f','df',x0,n,tol) Single Root: [x, f] = fsolve(@f,x0,opt,'') Multiple Roots: root=roots(coefficients)

  1. Newton (Iteration) Method: φ(x_k)=x_{k+} - f(x_k)/f'(x_k)
  2. Newton (Quotient) Method: φ(x_k)= x_{k+} - f(x_k)/f'(x_{k-1})
  3. Quasi Newton (Iteration) Method:
  4. Quasi Newton (Quotient) Method:

1D Root Finding: 2. Unconstrained Optimization: 3. Constrained Optimization (using gradient)

[x, f] = fnminbnd(@f,v0,v1,opt,'') [x,fv]=fnunc(@f,xo, opt,'') [x fv] = fnsearch(@f ,x0,opt,'')

Roots: Find the roots of the derivative equation.


Page 4

Mathematics Assignment Paper

  1. Multivariate regression; polynomial linear regression, multivariable quadratic regression and non-linear regression.
  1. Residuals: $\hat{e}_i = e_i = y_i - \widehat{\bar{y}}_i$
  1. Residual sum of squares: $Q = \sum_{i=1}^{n}(y_i -\widehat{\bar{y}}_i)^2 = \sum_{i=1}^{n}(e_i^2)$
  1. Regression sum of squares: $u = \sum_{i=1}^{n}(y_i -\widehat{\bar{y}})^2$
  1. Total sum of squares: $S = \sum_{i=1}^{n}(y_i -\widehat{\bar{y}})^2 = u + Q$
  1. Residual sum of squares: $\hat{\sigma}^2 = S^{2}= \frac{Q}{n-m-1}$, $m$ is the number of parameters; n - m - 1: degrees of freedom
  1. Determination coefficient $R^2 = \frac{u}{S} ∈ (0,1)$

Linear Regression

$\beta = (\Phi^T(x) \cdot\phi (x)) /(\Phi^{T}(x)\cdot y)$, prediction interval $\approx [y_0 - u_{1-\alpha/2} s , y_o +u _{1- \frac{\alpha}{ 2}}s]$

Multivariate Linear Regression

[B, pci , e, eci,[R^2,F,pF(1,n-m-1), Fval], s^{ 2}] = regress (y, x , α)

Polynomial Linear Regression:

  1. Polynomial regression

$p = polyfit(x, y , m)$ B,pCI,e <-polytool (x,y,m,a)

  1. Multivariable Quadratic Regression: Ascending

B,s,e <- rstd (x,y,'model',a)

Non-Linear Regression

  1. [B, residual sum of squares , residuals] = lsqnonlin (@F,B0,v1,v2, opt,param) Residuals = F(B , param)
  1. [B, residual sum of squares, residuals] = lsqcurvefit (@F,B0,x,y,v1 ,v2,opt,param) y=F(B, x)

All of the above are based on least squares principle and thus belong to unconstrained optimization.


Page 5

Linear Programming; Nonlinear Programming

  1. Linear programming: $$\min z = c^T x$$
  2. Quadratic Programming: $$ \min z = 0.5 x^T Hx + c^Tx $$
  3. Nonlinear Programming: $$\min z = f(x)$$