Tuesday, July 31, 2012

Computer Science-Bluestacks

Bluestacks is a very fun android emulator that operates on regular machines and os's. It is currently supported on both mac and windows and is aimed to enable developers to make more universal applications. This allows development to exist on the pc end as well as on android devices, and other Asus devices!
http://bluestacks.com/bstks_mac.html

Monday, July 30, 2012

Computer Science-CMake

Cmake is a cross platform build process that is both os and compiler independent. The releases can be found here.
http://cmake.org/cmake/resources/software.html
As of release 2.8.2 and above, up until at least release 2.8.8 there is an error when you try to update your version of cmake. The installer does not remove the system links if they previously exist and so fails to complete the installation to the command line. In order to fix this issue you have to remove the system links manually by doing
cd /usr/bin/
and then
sudo rm ccmake
sudo rm cmake
sudo rm cmake-gui
sudo rm cmakexbuild
sudo rm cpack
sudo rm ctest

Once this is done you will be able to reinstall cmake successfully to update your version. In a future version they will most likely automate this issue.

Wednesday, July 25, 2012

Computer Science-Android Development Environment


Android Development Environment

This is meant to be a quick summary, in setting up an android development environment. There is more thorough documentation provided at http://developer.android.com/tools/index.html. However it can be a bit confusing to read through. This is meant to help as a quick reference. Now first to get started we must install the necessary development kits and tools, these include the Eclipse JDT, and the Android NDK and SDK. You can find Eclipse at:
http://www.eclipse.org/downloads/
Select Eclipse classic 4.2 for your system whether it be Windows, Linux, or Mac.
Then go to:
http://developer.android.com/sdk/index.html
Where you can find the android sdk, and here for the ndk
http://developer.android.com/tools/sdk/ndk/index.html

Eclipse is the java environment where you can develop your android application, and the ndk and sdk are development kits for c++ and java respectively. Place the ndk and sdk in a development directory of your choosing. Choose a simple file path as you will need to link to these later on.

Now we have to set up eclipse itself for android development. Open eclipse and select a workspace folder.



Installing the ADT Plugin
Follow the instructions located here in order to set up the ADT Plugin
http://developer.android.com/sdk/installing/installing-adt.html
I’ve summarized the instructions here for convenience:

  1. In eclipse, select Help > Install New Software
  2. Click Add in the top right corner
  3. An add repository window should appear, enter "ADT Plugin" for the name and this as the URL for Location: https://dl-ssl.google.com/android/eclipse/
  4. click ok, if there is an error try http instead of https
  5. select the available software and click next, and download the tools that you require for the given api levels.
  6. restart eclipse when finished with instillation
SDK NDK Setup
This is to tell eclipse where to find the development kits

  1. Select Window > Preferences or Eclipse > Preferences if on Mac OS X
  2. Select Android
  3. Find the SDK Location in the top of this main panel and browse to the SDK directory
  4. Apply, then ok
For the NDK

  1. Select Window -> Preferences -> Android -> NDK or Select Eclipse -> Preferences -> Android -> NDK if on Mac OS X
  2. Then locate the NDK directory through browse




Emulation Wrapper
Now browse to the top level folder of your the android sdk.
cd /android-sdk/tools/
Once here we need to make some changes to the emulator, current as of July 2012 there is an error caused by an audio memory leak in running the android emulator through eclipse. Thus we have to create a wrapper so that eclipse can run the emulator with a reduced risk of crash.

mv emulator emulator.real
vi emulator

Input the following into the text file

#!/bin/sh
exec /Users/lukchristo/eclipse/android-sdk/tools/emulator.real -noaudio -avd AndroidTest

Additional commands can be found here
http://developer.android.com/tools/help/emulator.html



AVD Command Line Creation
Now to create a Android virtual device we follow the directions here:
http://developer.android.com/tools/devices/managing-avds-cmdline.html

./android-sdk-macosx/tools/android list targets
./android-sdk-macosx/tools/android create avd -n MyTestAVD -t 1
Do you wish to create a custom hardware profile [no] no

The AVD devices will be placed in /User/<username>/.android/avd/MyTestAVD
~/.android/avd/


ADB Install and Commands
In the case where you want to install a package onto the emulator, first open the emulator. You can do this from either command line or from eclipse. From the command line run
/filepath/android-sdk-macosx/tools/emulator
in order to open the avd
Then once the emulator is open go to
/filepath/android-sdk-macosx/platform-tools/
then run the command
./adb install /filepathtopackage/package.apk

./adb push can be used to push a file from your directory to the device being simulated
./adb push foo.txt /sdcard/foo.txt
./adb pull can be used in the opposite manner to push, retrieving a file from the device being simulated

Electrical Engineering-Intro to Digital

What are the basic goals for Digital systems? One of the key properties of digital systems is its data storage accuracy and resistance to corruption. A basic example where we can apply this idea is the storage of information in Magnetic tapes. So if we assume some magnetic reader/writer using some inductance principle to store information on some tape, we can see that there must be some noise by necessity due to random thermal effects in the data. Thus we have some signal to noise ratio.

In an analog sense, if we want to get a better S/N ratio, we would make the magnetic tape wider. We can take

W = Β x W0

With our increase in width, we can increase our Signal in analog by

S = Β x S0

However our noise will increase by a factor of

N = Β1/2 x N0

S/N = Β1/2

so if we want a S/N of 103, we would need a Β of 106 over some initial length.
In a digital sense, since we are storing information in on and off bits of information, our signal increases as

S = 2 Β

However our Noise will remain as 1 due to the inaccuracy of the least bit.

N = 1

S/N = 2 Β / 1
so here we only need a Β = 10, which is a huge decrease in the width necessary for the same increase in accuracy.

Math-Intro to Vectors and Calculus



Introduction to vectors-
A vector is simply an object that has a magnitude and a length in euclidean geometry space.
The components of the vector are defined by y = r sin (θ), and x = r sin (θ) the where theta is the angle between the axis and the vector, and r is defined as the magnitude/length of the vector. If they started out written as components in x and y, you would just see them as (x , y), sometimes the parentheses are substituted with another notation to denote vectors, or x and y will be underlined with a squiggle.
In order to add or subtract two vectors from one another, separate both vectors into their components. Take for example, a vector of length two 30 degrees above the axis, and a vector of length 2 1/2 45 degrees above the axis. First break the two into components thus the first vector becomes (2 (3) 1/2 , 1) and the second vector becomes (1 , 1). Thus the combined result is (2 (3) 1/2 + 1, 2) approximately (4.4, 2).
There are multiple ways to multiply vectors together. The first of which is the most simple, which is to multiply by a scalar. A scalar is a quantity that does not have a direction, and so does not change under coordinate transformations. In this case, you multiply the magnitude of the vector by the scalar, so the r component gets multiplied. For example if you have a vector (1, 1) and you multiply the vector by 2, the magnitude of the vector defined by the pythagorean theorem, (1 + 1 1/2 = (2) 1/2 would become 2 (2) 1/2 , and the components would be (2, 2).
The next way to multiply vectors is called the dot product. A . B which is defined by Σ . This is a scalar multiplication which removes the direction from the vectors and turns it into a scalar. For example, the vector in three space, (1, 2, 3) . (4, 5, 6) would become 1(4) + 2 (5) + 3 (6) = 22. This is equivalent to the magnitude of A multiplied by the magnitude of B multiplied with the cosine of the angle between them.
Another way to multiply vectors together is called the cross product. A x B is equal to magnitude of A multiplied by the magnitude of B sin (θ) in the direction n where n is the normal vector to both A and B. Normal is another term for perpendicular. A more detailed description of the cross product will be given after the introduction to matrices.
Introduction to basic integrals and derivatives-
In order to remember the basic positional equations just use integrals and derivatives to transform from one to another. First we start with some constant acceleration a.
a = a
Then we can integrate this equation with respect to time. Since a is a constant, we can think of this as a x . We then raise 0 to 1 and divide by 1. This gives us the velocity equation.
v = at + v 
The reason why there is a v in this equation is because of the vagueness left by taking a derivative. The derivative of a constant is 0 so a = a + 0, which turns into the constant v0.
This process gets repeated for position.
x = 1/2 a t + v t + x 0
You can also start form the position equation and take derivatives in order to get the other equations of motion. Starting with
x = 1/2 a t + v t + x 
We then take the derivative, multiplying by the exponent then subtracting one from the exponent. giving us
v = at + v 
and so on.

Math-Intro to Linear Algebra


Introduction to matrices-
Matrices- A matrix is a rectangular array with some elements.
A common use for matrices is to represent the coefficients of systems of equations. The standard ways to solve system of equations involve using a substitution method or an elimination method by adding and subtracting equations from one another. For example:
- 2 x + x = 0
2 x - 8 x = 8
-4 x + 5 x + 9 x = -9
In a substitution method you would normally do something along the lines of using equation 2 to set 2 x = 8 + 8 x  to get x = 4 + 4 x and substitute into the other equations.
In an elimination method you can add two equations together in order to get rid of terms. For example adding equation one and two will give you x - 7 x = 8, and continue doing that to solve equations.
This can be summed up in a more simple fashion by using matrices, which contain the coefficients of the system of equations.
[ 1 -2 1 0 ]
| 0 2 -8 8 |
[ -4 5 9 -9 ]
Then use row operations in order to create a diagonalized matrix. There are a few basic row operations that can be used in diagonalizing a matrix such as this.
Scaling-Multiply all the entries in a row by a nonzero constant
Interchange-Interchange two rows
Replacement-Replace one row by the sum of itself and a multiple of another row.
Diagonalization means to reduce the matrix to the identity matrix, which contains only ones on the diagonal. The 4th column in the previous matrix represents solutions so the matrix can be rewritten as:
[ 1 -2 1 | 0 ]
| 0 2 -8 | 8 |
[ -4 5 9 | -9 ]
where | represents the separation between the matrices. The matrix in reduced form can also be called an echelon matrix or in reduced echelon form when the diagonals are 0, and only the solutions remain. Should a row solve to 0 0 0 0, this means that the variable this row is supposed to solve for is free and can take any value.
So to solve this we can perform operations such as
[ 1 -2 1 0 ]
| 0 2 -8 8 |
[ -4 5 9 -9 ]

[ 1 0 -7 8 ]
| 0 2 -8 8 |
[-4 5 9 -9 ]

[ 1 0 -7 8 ]
| 0 2 -8 8 |
[ 0 5 -21 23 ]

[ 1 0 -7 8 ]
| 0 2 -8 8 |
[ 0 5 -21 23 ]

[ 1 0 -7 8 ]
| 0 2 -8 8 |
[ 0 0 1 3 ]

[ 1 0 0 29 ]
| 0 2 -8 8 |
[ 0 0 1 3 ]

[ 1 0 0 29]
| 0 2 0 32|
[ 0 0 1 3 ]

[ 1 0 0 29]
| 0 1 0 16|
[ 0 0 1 3 ]

This result means that x = 29, x = 16, and x = 3.
Cross-product definition-
In matrix form the cross product of two 3 element vectors is defined as:
(a b c) x (x y z)
[ i j k ]
| a b c |
[ x y z ]
(bz - cy)i -(az - cx)j + (ay - bx)k
Where i j k are the unit vectors that define the axis in which both vectors are defined.

Least Squares and Data fitting
In order to find the least square solution, or a regression fit of a set of data, we calculate  
AAx = AT b 
However, if the ker(A) = {0} we can also get a unique least squares solution of 
x = (ATA)-1 ATb


Example:
A = [1 1]
        |1 2|
        [1 3]
b = [0]
       |0|
       [6]


So we can compute Aas
[1 1 1 ]
[1 2 3]
so ATA is
[ 3 6  ]
[ 6 14]
Then we take the inverse
[2.3 -1]
[-1   .5]
Next we solve for ATb
[ 6 ]
[18]
multiple the above two together to get
x = [ -4]
       [ 3 ]


Inner products
An inner product is a linear space that assigns a real scalar to any pair of elements in that linear space with the following properties:
i. <f, g> = <g, f>
ii. <f+h, g> = <f, g> + <h, g>
iii. <cf, g> = c <f, g>
iv. <f, f> > 0 for all nonzero f in V

Math-Intro to Complex Analysis


Complex numbers are defined as points in the complex plane which consist of a real axis and an imaginary axis. By convention we denote a complex number as the point z = (x , y) where x is the real component and y is the imaginary component. z can also be written as z = x + iy.
Imaginary numbers - Imaginary numbers are just numbers who have a negative square. They are often written as a number multiplied with i, in a similar form to defining the coefficient of a unit vector. i is defined as i = (-1) 1/2 
When i is raised to some exponent it repeats a pattern of 4 different results.
= 1
= i
= -1
= -i
And then i to the 4 th will go back to one and the pattern repeats.'
Algebraic Rules-
Complex numbers follow many of the same basic properties real numbers have. They have the same commutation, association, and distribution properties that real numbers have for both addition and multiplication. i.e.
+ z = z + z 
= z 
(z + z ) + z = z + (z + z )
(z ) z = z (z )
(z + z ) = z + z 3
Vectors-
Complex numbers can also be treated as vectors, represented by the segment between the origin and the point. Thus add and subtract complex numbers in the same way, separately adding and subtracting the components. i.e.
1 + 2i + 3 + 4i = 4 + 5i
Again just as in vector operations, you can perform addition and subtracting using the tail to head methods, where you move the tail end of one vector without distorting it to the head end of the other vector and draw the resultant vector from the origin to the final point. However, it is more common and efficient to just use the components of the vector to calculate the resultant.
Modulus-
We can also define the modulus, or length of a vector in the complex plane, and once again it is done in a similar way to real vectors. The modulus of a complex number is the square of its components square rooted, denoted by |z|. i.e.
|z| = (x + y 1/2
The modulus can also be defined as the zz̅ = |z| 2.
z̅ is the complex conjugate of z. The complex conjugate is defined as if z = x + iy, z̅ = x - iy. This means the complex conjugate is the reflection of the vector defined by z over the real axis.
Exponential form-
Complex numbers can also be defined in exponential form. R and θ are used to define polar coordinates and this can be done in complex form as well.
z = r (cos (θ) + i sin (θ))
then we use the definition of Euler's formula which states:
i θ = cos (θ) + i sin (θ)
which gives us z = r e i θ 
Where r is the modulus or length of the vector that defines the complex number.
Defining complex numbers in exponential form gives grants us access to a lot of properties due to the simplicity of exponents.
Multiplying complex numbers-
1 z 2 = r 1 r 2 e i θ 1 i θ 2 
1 z 2 = r 1 r 2 e i (θ 1 + θ 2)
Thus when you multiply two complex numbers together, the resultant vector is rotated through an angle that is the sum of the two component angles, and the length is the multiplied modulus of both component vectors.
Dividing complex numbers-
1 / z 2 = (r 1 / r 2) e i θ 1 /e i θ 2 
1 z 2 = (r 1 / r 2) e i (θ 1 - θ 2)
When you divide two complex numbers, the resultant vector is rotated through an angle that is the difference of the two component angles, and the length is the divided modulus of the component vectors.
Raising to an exponent-
= r i n θ 
Raising a complex to the exponent is equivalent to raising the modulus of the vector to that power, and rotating through the angle theta of the component vector a number of times equal to the power you are raising to.
de Moivre's Formula-
This is the formula or theorem that connects complex numbers to trigonometry.
(cos(θ) + i sin(θ)) n = cos (n θ) + i sin (n θ)
This allows us to derive trigonometric identities such as the double and half angle formulas.
Example:
(cos(θ) + i sin(θ)) 2 = cos (2θ) + i sin (2θ)
cos (θ) - sin (θ) + 2 i sin(θ) cos(θ) = cos (2θ) + i sin (2θ)
Then in order to get the identities, equate the imaginary parts on both sides together and the real parts on both sides to one another.
cos (2θ) = cos (θ) - sin (θ)
i sin (2θ) = 2 i sin(θ) cos(θ)
The i's cancel in the second equation so you are left with
cos (2θ) = cos (θ) - sin (θ)
sin (2θ) = 2 sin(θ) cos(θ)
Phasors-
Phasors are time dependent complex vectors. They can be fully written as
A e  e iωt
Where A is the length of the vector, e  gives the initial orientation of the vector and e iωt drives the motion of the vector around in a circle in the complex plane.
This can also be written as the just A e iωt. In principle the A can also be a complex number but that is absorbed into the A e  term, we are assuming for now that the A is just a real number.
We can then separate out the real portion of this, and in doing so we get a sinusoid. This is the projection of the phasor onto the real axis.
A e iωt = A cos(ωt) + A i sin (ωt)
Re {A e iωt} = A cos(ωt)
Fourier Analysis-
F(ω) = ∫ dt V(t)e -iωt
V(t) = 1/2π ∫ dω F(ω) e iωt
These two are called Fourier transforms. The idea in the first case is to take a function of time and go to a function of frequency. The second reverses the operation and goes from a function of frequency to a function of time.
You can think of this as a form of projection, similar to the case where if we take the projection of a phasor onto the real axis we get a sinusoidal function. If you have some function in the time domain, you can approximate it with a Fourier series. A Fourier series is a series of oscillating functions with some coefficients, that when summed together form some function.
The Fourier transform when applied to a function in the time domain, gives you a function that tells you the contribution of the base waveform you are using at that frequency. This is like projecting the waveform from in the time domain into its components in the frequency domain.

Electrical Engineering-Intro to Analog

The following is a review of some electrostatics necessary for understanding analog electronics.

Force exerted on a point charge moving in a B and E field, magnetic and electric field.

F = q(E + v x B)

Electric field generated by a point charge.

E = (1 / 4 π ε 0 ) Q / r 2

Change in electric potential associated with charge and capacitance.

Δ V = ∫ E . dl = k Q / r = Q / C

Work done by an electric field.

Work = ∫ q E . dl = q Δ V

Power done by an electric field

Power = d Work / dt = dq Δ V / dt
Power = I Δ V
Power = I2 R = V2 / R (in situations where ohm's law applies)

Ohm's Law

V = I R (ohm's law)

Properties of one electron

e = 1.6 x 10 -19 Coulomb
1eV = 1.6 x 10 -19 Joule
= 11,600 o K

Properties of Temperature

1/40 eV ≈ 30o K = 4140 Yocto-Joules
13.8 Yocto-Joule = 1o K

Constants

ε0 = 8.85 x 10 -12 Coulomb / Volt m = 8.85 pF / m
k = 1 / 4 π ε0 = 9 x 10 -9 Volt m / Coulomb
μ0  = 4 π x 10 7 T m / A
c = 0.3 x 10 9  m / s

When E is energy in electron volts
Ε = h fλ = 1240 nm (Ε / 1eV) -1 
f = .24 x 10 15  (Ε / 1eV)

Masses
me = .511 MeV / c2
mp = .938 MeV / c2
Na = 6.02 x 1023

Physics-Intro to Quantum Mechanics



Constants:
Masses of particles: electron, proton, neutron, in units of MeV/c 
= 0.511 MeV/c 
= 938.26 MeV/c 
= 939.55 MeV/c 2
Approximations for the value of hc
h c = 12,400 eV A
ħ c = 1,973 eV A
Approximation of k boltzmann
= 1/11,600 eV/K
Approximation of Coulomb constant and two electrons worth of charge.
k e =14.4 eV A
= (k e ) / (2 a ) = (m k ) / (2 ħ ) = 13.6 eV
R = 1.097 x 10 -1
Relativity:
E = (m + p 1/2
Planck's Law:
u (λ) = n (λ) E (λ)
n (λ) = 8 π / λ 
E (λ) = h c / [ λ (e h c / λ k -1)]
Energy in an oscillator:
= n h f
P (E) ∝ e -E / k T
Stefan's law:
R = σ T 
σ = 5.67 x 10 -8 W / m 
R = c U / 4
U = ∫ u (λ) dλ
Wein's Displacement law:
λ T = h c / 4.96 k B
Photons:
Energy, momenta and frequency of photons
E = p c
E = h f
p = h / λ
f = c / λ
Photoelectric effect:
e V = m v / 2 = h f - φ
Compton Scattering:
λ ' - λ = h (1 - cos (θ) / (m c)
Rutherford Scattering:
b = (k q α Q cot (θ / 2)) / m α 
ΔN ∝ 1 / sin (θ / 2)
Electrostatics:
F = k q / r 
U = q V
V = k q / r
Hydrogen spectra:
1 / λ = R (1 / m - 1 / n )
Bohr atom:
= k e Z / 2 r = - Z / n 
= k e / 2 a = m k / 2 ħ = 13.6 eV
h f = E - E 
= r 
= a / Z
= ħ / m k e = 0.529 A
L = m v r = n ħ
X - ray spectra:
1/2 = A (Z - b)
K : b =1, L : b = 7.4
de Broglie:
wavelength, frequency, momentum, and energy of particles
λ = h / p
f = E / h
ω = 2 π f
k = 2 π / λ
E = ħ ω
p = ħ k
E = p / 2 m
Group and phase velocity:
= dω / dk
= ω / k
Heisenberg Uncertainty principles:
Δx Δp ≈ ħ
Δt ΔE ≈ ħ
Wave Function:
Ψ(x , t) = |Ψ(x , t)| e i θ (x , t)
P(x , t) = |Ψ(x , t)| dx
Schrodinger Equation:
-ħ δ Ψ / 2 m δx + V(x) Ψ(x , t) = i ħ δ Ψ / δ t;
Ψ (x , t) = ψ(x) e -i E t / ħ 
-ħ δ Ψ / 2 m δx + V(x)&psi(x) = Eψ(x)
∫ dx Ψ * Ψ = 1
Ψ (x) = (2/L) 1/2 sin(n π x / L)
(x) = π 
op = x
op = ħ δ / i δ x
< A > = ∫ δ x Ψ * A op Ψ
op Ψ = a Ψ
uncertainty:
Δ A = ( <A > - <A>  ) 1/2
Harmonic Oscillator:
Ψ (x) = C n H n (x) e -m ω x 2 / 2 ħ 
= (n + 1/2) ħ ω
E = p 2 / 2 m + m ω / 2 = m ω / 2 , Δ n = +- 1
Step potential:
R = (k - k ) 2 / (k + k ) 2 
T = 1 - R
k = (2 m (E - V) / ħ) 1/2
Tunneling
Ψ (x) ≈ e -αx 
T ≈ e -2αx 
T ≈ e -2 ∫ αx dx
α(x) = [(2 m [V(x) - E]) / ħ 1/2
3-D square well
Ψ(x, y, z) = Ψ (x) Ψ (y) Ψ (z)
E = π 2
Spherically symmetric potential
Ψ n,l,m (r, θ, φ) = R n l (r) Y l m (θ, φ)
l m (θ, φ) = f l m (θ) e i m φ

Physics-Intro to Optics, Relativity



Snell's Law
1 Sin [θ ] = n 2 Sin [θ ]
= c / n
λ = λ / n
θ = I θ / E 
Where n is the refraction index of the material
Lens Equation:
1 / d + 1 / d = 1 / f
m = - d / d 
Where d is the distance to the image and d is the distance to the object. m represents the magnification of the object in comparison to the objects actual size.
Lens maker Equation:
1 / f = (n - 1) (1 / R + 1 / R )
r = f / 2
f is the focal length, and r is the radius of curvature. The focal length is the distance at which the parallel rays of light travelling through the lens will converge to a point. The radius of curvature represents the radius of the sphere that the lens could make if it was continued to a sphere.
Interference and Diffraction-
Double Slit interference:
θ = I [Cos(δ / 2)] 
d Sin[θ] = m λ / Maxima
d Sin[θ] = (m +1/2) λ / Minima
Single Slit diffraction:
θ = I [Sin(Β/2) / (Β / 2)] 
D Sin[θ] = (m +1/2) λ / Maxima
Note - θ = 0 is the central and highest peak
D Sin[θ] = m λ / Minima
Single and double slit effects:
θ = I [Sin(Β/2) / (Β / 2)] [Cos(δ / 2)] 2
Diffraction grating:
Sin (θ) = m λ / d
R = λ / (Δ λ) = N m
R is the resolving power of the lens
Circular hole diffraction
θ = 1.22 λ / D
Polaroids
I = I (Cos[θ]) 2
Relativity
Minkowski space-This is the setting in which relativistic calculations are done. Points in Minkowski space are represented by a 4-vector which defines position in x, y, z and time, and is represented by the Minkowski metric, which is defined as:
[-1 0 0 0]
| 0 1 0 0|
| 0 0 1 0|
[ 0 0 0 1]
Invariance of the interval:
(Δs) = (Δx) - (c Δt) 
(Δs') = (Δs) 
The invariance of the interval is also known as the line element of the minkowski metric.
Lorentz Transformations-
ct = γ ( v x' / c + c t ' )
x = γ ( x' + v t ' )
y = y'
z = z'
This is assuming your working in a frame where there is movement in only one direction, however due to the isotropy of space, you can almost always make this assumption.
γ = 1 / [1 - (v / c) 1/2 
This is known as the lorentz factor, which is used in the lorentz transformation.
Velocity addition formulas-
parallel = (u parallel ' + v) / (1 + (u ' v / c ))
perpendicular = (u perpendicular ') / [γ (1 + (u perpendicular ' v / c ))]
Contraction
L' = L / γ
Where L' is the length of the moving object as observed by the stationary frame.
Δt' = γ Δt
Where t ' is the length of time experienced by an observer in the stationary frame.
Stationary frames are described by no acceleration.


Non constant velocity
τ = ∫ [1 - ( v (t) / c )] 1/2 dt
Momentum and Energy
p = γ m v
E = γ m c = [m + |p| ]
= m + p 
KE = E - m = (γ - 1) m c 2

Phyiscs-Intro Heat, Waves, Fluids


Useful math functions/approximations:
cos( A ) + cos( B ) = 2 cos [ ( A + B ) / 2 ] cos [ ( A - B ) / 2 ]
sin( A ) + sin( B ) = 2 sin [ ( A + B ) / 2 ] cos [ ( A - B ) / 2 ]
1/L - 1 / ( L + ΔL ) ≈ ΔL / L 
for x << 1
(1 + x) 1/2 ≈ 1 + x/2
ln (1 + x) ≈ x
due to taylor expansion
Constants:
ρ = 1 x 10 kg/m 
g = 9.8 m/s 
= 1 x 10 5
Speed of sound:
air = 340 m/s
water = 1440 m/s
1 atmosphere = 1 x 10 = 76 cm Hg
R = N = 8.3 J/(mol K)
= 1.4 x 10 -23 
= 6.0 x 10 23 
1 atomic mass unit = 1.7 x 10 -27 kg
1 cal = 4.2 J
Water
C = 4.2 kJ/kg-K
= 330 kJ/kg
= 2.2 x 10 kJ/kg
Pressure:
ρAv = const
P + ρ v / 2 + ρgy = const
Simple Harmonic Oscillator:
z / d t + cz = 0
z = z cos(ωt + φ), and ω = c 1/2
For a spring:
E = m v / 2 + k x / 2
For damped spring:
y / dt + b dy / m dt + k y / m = 0
y = y -α t cos ( ω ' t )
α = b / 2 m
ω ' ≈ ω = ( k / m ) 1/2
Forced oscillator
F = F i ω t
y = [(F / m) e i ω t ] / [ - ω + ω + 2 i α ω ]
Waves on a string
v = (T / μ)
ε ' = (1/2) μ ω 
P = (1 / 2) μ ω p
For sound waves
= (B / ρ) 1/2 
Δ p = - B (dD / dx)
I = (1 / 2) ρ ω s
Decibels
Β = 10 log 10 (I / I0)
= 1 x 10 -12 W/m 2
Wave refraction, Snell's law
sin(θ ) / v = sin( θ ) / v 
sin( θ ) / sin( θ ) = v / v = n / n 2
Beats in waves f - f 2
cos(ω t) + D cos(ω t) = 2 D cos[(ω t + ω t) / 2] cos[(ω t - ω t) / 2]
f = f (v +/- v ) / (v +/- v s0 )
B = - V (dp / dV) T
Thermodynamics
α = (1 / L) (dL / dT) 
Β = (1 / V) (dV / dT) 
P V = n R T
(m v avg ) / 2 = (3 k T) / 2
mfp = 1 / [2 1/2 4 π r (N / V)]
dQ = dE + dW
= (3 / 2) R , (5 / 2) R , 3 R
atoms, diatomic, polyatomic
= c + R for ideal gas
P V γ = const. γ = c / c v
W = [p / (γ -1)] [1 - (V / V γ - 1 ]
dQ / dt = e σ A T 
σ = 5.7 x 10 -8 W/m 
dQ / dt = -k A dT / dx
ΔS ≥ 0
dQ = T dS
ΔS = ∫ dQ / T
S = k ln (W)
b - > a = exp(-ΔS ab / k )
e = W / Q ≤ 1 - T / T 
COP = Q / W ≤ T / (T - T )

Physics-Intro to Electrostatics

k = 1/(4 π ε ) = 8.99 x 10 N m / C 
k is the proportionality constant in Coulomb's law, and is sometimes known as Coulomb's constant.
ε = 8.85 x 10 -12 / Nm 
ε is a constant known as the permittivity of free space, which is the absolute value of the dielectric permittivity of a vacuum.
F 12 = (k Q )/ r 12
Coulomb force law, inverse square law between objects 1 and 2 with a given charge a s a function of distance squared. Can be both attractive and repulsive in nature.
E = Q r / (4 π ε )
Electric field due to a point charge, written with ε as opposed to using constant k.
Dipole field
E = [3 ( p . r ) r - p] / (4 π ε ) - [p δ (r)] / (3 ε )
In one direction along or perpendicular to dipole axis
E = p / (2 π ε )
Energy and Torque on a dipole in an external E-field
U = - p . E , τ = p x E
Electric field of infinite line of charge:
E = λ / (2 π ε r)
Where λ is defined as the charge per unit length.
Electric field of infinite charged plane:
E = σ / (2 ε )
Where σ is defined as the charge per unit area.
Electric field of ring along axis:
E = Q x / [ 2 π ε r (x + a 3/2 ]
Electric field of disk along axis
E = σ / 2 ε [ 1 - z / (z + R 1/2 ]
Electric flux:
Φ = E . A ;
dΦ = E . dA ; Φ = ∫ E . dA
Gauss's Law:
§ E . dA = Q enc / ε 0
Potential energy
ab = U - U = -W ab = - ∫ F . dl ;
ab = V - V = - ∫ E . dl ; V = k Q / r ; V = k ∫ dq / r ; E = - dV / dl
= - dV / dx
12 = k Q / r 12
Capacitors
Q = C V
Parallel plate
Q = ε A / d
U = Q / 2 C
C = K C 
ε = K ε 
C = C + C 
1/C = 1/C2 + 1/C3
Ohm's law
I = V/R = Δ Q / Δ t
Resistivity
ρ = ρ [ 1 + α (T - T )]
Power
P = VI = V / R = I R
The basic relation P = VI was transformed to the other two states by using Ohm's law.
Alternating Current
V = V sin ω t
P = V sin (ω t) / R
avg = V / (2 R)
Current density
j = I/A = n e v drift = E / ρ
e = -1.6 x 10 -19 C