First Post in this Blog
This first semester of AY 2018-19, I am taking App Physics 186 which focuses (I think) on Image and Video Processing. Finally, a course that will help me understand how the popular freeware Tracker works when I use it to analyze footage taken in our Physics 191/2 courses.
As a start to this new blog, I'd like to test whether it is compatible with \(\LaTeX\), and so, I will be adding a few equations. Please don't mind them as it this only assures me that if it works, I know it is working.
\begin{align}\label{euler} \mathrm{e}^{\mathrm{i}\,x}&=\sum_{n=0}^\infty\frac{(-1)^n}{(2n)!}x^{2n}+\mathrm{i}\,\sum_{n=0}^\infty\frac{(-1)^{n}}{(2n+1)!}x^{2n+1} \\ \label{fourier} \mathscr{F}\{g(\omega)\}&=\int_{-\infty}^{\infty}f(t)\mathrm{e}^{2\pi\mathrm{i}\,\omega t}\,\mathrm{d}t\end{align}
Here, \eqref{euler} refers to the summation form of Euler's Formula, while \(\eqref{fourier}\) refers to a simple Fourier Transform. Another nice equation to note is that to get the \(n\)-th Laguerre polynomial \(\mathcal{L}_n(x)\), given by:
\begin{align}\label{laguerre}\mathcal{L}_n(x)=\sum_{m=0}^n\dfrac{(-1)^m\,n!}{(n-m)!\,(m!)^2}\,x^m\end{align}
Lastly, I'd like to test if this blog can also handle showing codes, thus I show one to implement \eqref{laguerre} and plot it for \(x\in[0,5]\).
\begin{align}\label{euler} \mathrm{e}^{\mathrm{i}\,x}&=\sum_{n=0}^\infty\frac{(-1)^n}{(2n)!}x^{2n}+\mathrm{i}\,\sum_{n=0}^\infty\frac{(-1)^{n}}{(2n+1)!}x^{2n+1} \\ \label{fourier} \mathscr{F}\{g(\omega)\}&=\int_{-\infty}^{\infty}f(t)\mathrm{e}^{2\pi\mathrm{i}\,\omega t}\,\mathrm{d}t\end{align}
Here, \eqref{euler} refers to the summation form of Euler's Formula, while \(\eqref{fourier}\) refers to a simple Fourier Transform. Another nice equation to note is that to get the \(n\)-th Laguerre polynomial \(\mathcal{L}_n(x)\), given by:
\begin{align}\label{laguerre}\mathcal{L}_n(x)=\sum_{m=0}^n\dfrac{(-1)^m\,n!}{(n-m)!\,(m!)^2}\,x^m\end{align}
Lastly, I'd like to test if this blog can also handle showing codes, thus I show one to implement \eqref{laguerre} and plot it for \(x\in[0,5]\).
import matplotlib.pyplot as plt
import numpy as np
from scipy.special import factorial
# nth Laguerre Polynomial
n = 9
# Initialize variables
x = np.arange(0, 5, 0.01)
Ln, y = [], []
# Create the coefficients of the terms in the polynomial
for m in range(n+1):
Ln.append((-1)**m * factorial(n) / (factorial(n-m) * factorial(m)**2))
for f in x:
s = 0
for m in range(n+1):
s += Ln[m] * f**m
y.append(s)
plt.xlabel("$x$")
plt.ylabel("$L_m(x)$")
plt.plot(x, y)
This code enables one to plot the \(n\)-th Laguerre Polynomial.
Another nice code is one to obtain the prime factorization of some number, which follows.
Another nice code is one to obtain the prime factorization of some number, which follows.
import java.util.*;
public class primefac {
public static void main(String[] args) {
nprime j=new nprime();
Scanner m=new Scanner(System.in);
long a, b=2, c=m.nextLong();
System.out.println("The prime factors of "+c+" are:");
for(a=1;a<=c;a++) {
if(c%a==0) {
System.out.print(a+" ");
c/=a;
a=1;
}
}
}
}
Hopefully this course will help me understand the techniques of processing images and videos so that I may find ways to implement my own version of Tracker.
Comments
Post a Comment