Astronomy: Distance and Midpoint Between Two Celestial Objects
Stars and celestial objects have the equatorial coordinates ( α, δ, R ) where:
α = right ascension in hours, minutes, and seconds
δ = declination in degrees, minutes, and seconds
R = distance to the celestial about (in light years, astronomical units, etc)
Convert α and δ to decimal degrees:
α = (hours + minutes/60 + seconds/3600) * 15
δ = sign(δ) * ( degrees + minutes/60 + seconds/3600 )
However, calculating distance between two points in space requires that we have cartesian coordinates (x, y, z). The conversion formulas to go from equatorial to cartesian coordinates are:
x = R * cos δ * sin α
y = R * cos δ * cos α
z = R * sin δ
For completeness, here are the conversion formulas to from cartesian to equatorial coordinates:
R = √(x^2 + y^2 + z^2)
δ = asin(z/R)
α = atan(y/x) (pay attention to the quadrant!). Alternatively: α = arg(x + i*y)
The distance formula between two points in space is:
D = √( (x2  x1)^2 + (y2  y1)^2 + (z2  z1)^2 )
Source: http://en.m.wikipedia.org/wiki/Equatorial_coordinate_system
Example
Find the distance between Sagittarius A* (center of the Milky Way Galaxy) and the Andromeda Galaxy (M31).
Equatorial Coordinates:
From Wolfram Alpha: ( http://m.wolframalpha.com )
Sagittarius A*:
R = 24,824 light years
α = 17h45m40s = 266.42°
δ = 29°0'28" = 29.008°
Andromeda Galaxy:
R = 2,571,000 light years
α = 42m40s = 10.68°
δ = 41°16'8" = 41.269°
Converting to the cartesian system:
Sagittarius A*:
x = 21,667.514038
y = 1,355.611275
z = 12,037.945401
Andromeda Galaxy:
x = 358,122.65578
y = 1,898,943.67736
z = 1,695,818.99789
Calculation:
D = √( (21,667.514038  358,122.65578)^2 + (1,355.611275  1,898,943.67736)^2
+ (12,037.945401  1,695,818.99789)^2 ) ≈ 2,583,051.16059
The distance between Sagittarius A* and the Andromeda Galaxy is about 2.583 million light years.
Happy Thanksgiving, or Day of Thanks, wherever you are. Please be safe and use good judgement. We need all the positive we can get on Earth, and in the cosmos. Cheers!
Eddie
This blog is property of Edward Shore. 2014
A blog is that is all about mathematics and calculators, two of my passions in life.
Wednesday, November 26, 2014
Astronomy: Distance and Midpoint Between Two Celestial Objects
Tuesday, November 25, 2014
Complex Analysis: Line Integral
Contour Integrals
Let the complex function f(z) be defined as f(z) = u(x,y) + i*v(x,y)
Using the definition of the integral:
∫ f(z) dz = lim n → ∞ [ Σ f(z_k) * Δz_k from k = 1 to n ]
= lim n → ∞ [ Σ ( u(x_k, y_k) + i*v(x_k, y_k) ) * ( Δx_k + i*Δy_k ) from k = 1 to n ]
= lim n → ∞ Σ [ (u(x_k, y_k) * Δx_k  v(x_k, y_k) * Δy_k) + i*(v(x_k, y_k) * Δx_k
+ u(x_k, y_k) * Δy_k) ]
= ( ∫ u(x,y) dx  ∫ v(x,y) dy ) + i*( ∫ u(x,y) dy + ∫ v(x,y) dx )
In summary:
∫ f(z) dz = ( ∫ u(x,y) dx  ∫ v(x,y) dy ) + i*( ∫ u(x,y) dy + ∫ v(x,y) dx )
What is needed:
1. A contour curve f = y(x). This is where you get your end points.
2. We need f(z) to integrate. Separate f(z) into its parametric parts.
Let's look at a couple examples.
Examples
1. Contour: y = x + 1 from (3,4) to (4,5). Integrate ∫ z^2 dz.
Since y = x + 1, x = y  1
z^2 = (x + i*y)^2 = (x^2  y^2) + i*(2*x*y)
u = x^2  y^2
v = 2*x*y
u = x^2  y^2
u = x^2  (x + 1)^2
u = 2*x  1
∫ u dx from 3 to 4 = 8
v = 2 * x * y
v = 2 * (y  1) * y
∫ v dy from 4 to 5 = 95/3
u = (y  1)^2  y^2
u = 2 * y + 1
∫ u dy from 4 to 5 = 8
v = 2 * x * y
v = 2 * x * (x + 1)
∫ v dx from 3 to 4 = 95/3
∫ z^2 dz from (3 + 4*i) to (4 + 5*i) = (8  95/3) + i*(8 + 95/3) ≈ 39.666667 + 23.666667*i
2. Contour: y = x^2  1 from (0, 1) to (2, 1). Integrate ∫ z^2 + 1 dz.
y = x^2  1, x = √(y + 1)
z^2 + 1 = (x + i*y)^2 + 1 = x^2 + 2*i*x*y  y^2 + 1
u = x^2  y^2 + 1
v = 2 * x * y
u = x^2  y^2 + 1
u = x^2  (x^2  1)^2 + 1
∫ u dx from 0 to 2 = 8/5
v = 2 * x * y
v = 2 * √(y + 1) * y
∫ v dy from 1 to 1 = 8/15 * √2
u = x^2  y^2 + 1
u = y + 1  y^2 + 1
u = y^2 + y + 2
∫ u dy from 1 to 1 = 10/3
v = 2 * x * y
v = 2 * x * (x^2  1)
∫ v dx from 0 to 2 = 4
∫ z^2 + 1 dz from i to 2+i = (8/5  8/15 * √2) + i*(4 + 10/3) ≈ 0.845753 + 7.333333*i
This is the basics of line integrals.
Source: Wunsch, A. David. Complex Variables with Applications. 2nd Edition. AddisonWesley Publishing Company. 1994.
Take care, Eddie
This blog is property of Edward Shore. 2014
Saturday, November 22, 2014
Complex Analysis: CauchyReimann Equations
Continuing my blogging adventures at the Last Drop Cafe in Claremont, CA:
CauchyReimann Equations
Let the complexvalued function f(z), where z = x+i*y, be defined in the parametric form:
f(z) = u(x,y) + i*v(x,y) where u(x,y) = Re(f(z)) and v(x,y) = Im(f(z)).
Then by the definition of the derivative:
f(z) = lim x0 → x [(f(z) + x0)  f(z))/(x  x0)]
= lim x0 → x [(u(x +x0, y)  u(x, y) + i*v(x + x0, y)  i*v(x, y))/(x  x0)]
= du/dx + i*dv/dx (I)
Also:
f(z) = lim y0 → y [(f(z + y0)  f(z))/(i*y  i*y0)]
= lim y0 → y [(u(x, y + y0)  u(x, y) + i*v(x, y + y0)  i*v(x, y))/(i*(y  y0))]
= i*(lim y0 → y [(u(x, y + y0)  u(x, y) + i*v(x, y + y0)  i*v(x, y))/(y  y0)])
= i*du/dy + dv/dy (II)
Taking the real and imaginary parts of (I) and (II):
du/dx = dv/dy and du/dy = dv/dx
The CauchyRiemann equations can be used to determine whether f(z) is differentiable and if so, where.
Two Quick Examples
1. z^2 = (x^2  y^2) + 2*i*x*y
u=x^2  y^2
v=2*i*x*y
du/dx = 2*x, dv/dy = 2*x
du/dy = 2*y, dv/dx = 2*y (note the negative sign in front of du/dy!)
Since the CauchyRiemann equations hold, and without restriction, then z^2 is differentiable for all z. And:
df/dz = 2*x + 2*i*y = 2*(x+i*y) = 2*z
2. e^z = e^(x+i*y) = e^x*cos y + i*e^x*sin y
u=e^x*cos y
v=e^x*sin y
du/dx = e^x*cos y, dv/dy = e^x*cos y
du/dy = e^x*sin y, dv/dx = e^x*sin y
Since the CauchyRiemann equations hold, and without restriction, then e^z is differentiable for all z. And:
df/dx = e^x*cos y + i*e^x*sin y = e^z
I used (I), but using (II) will garner the same result.
That is the CauchyRiemann equations in a nutshell!
Source: Wunsch, A. David. Complex Variables with Applications. 2nd Edition. AddisonWesley Publishing Company. 1994.
As always, have a great day! Take care. Eddie
This blog is property of Edward Shore. 2014
Complex Analysis: The Conjugate, the Modulus, and its Properties
Blogging today from Last Drop Cafè in Claremont, CA. I think I found a new favorite drink: mint mocha made with soy milk.
Here are some basics of the conjugate and modulus of complex numbers.
Let z = x+i*y, with i=√1
Conjugate
Usually labeled "zbar" (z with a line over it), the conjugate is also labeled conj(z) and z*.
conj(z) = x  i*y
Modulus or Absolute Value
Not surprisingly, the modulus, also called the absolute value of the complex number z is defined as:
z = √(x^2 + y^2)
Properties
Let's explore some properties of the conjugate and modulus.
z + conj(z) = (x + i*y) + (x  i*y) = 2*x
z  conj(z) = (x + i*y)  (x  i*y) = 2*i*y
(conj(z))^2 = (x  i*y)^2 = x^2  2*i*x*y + (i*y)^2 = x^2  y^2  2*i*x*y
conj(z)^2 + z^2 = (x  i*y)^2 + (x + i*y)^2 = x^2  2*i*x*y  y^2 + x^2 + 2*i*x*y  y^2
= 2*(x^2  y^2)
conj(z) * z = (x  i*y) * (x + i*y) = x^2 + i*x*y  i*x*y  i^2*y^2 = x^2 + y^2 = z^2
which easily leads to: z = √(z * conj(z)) and
z1 * z2 = √(z1 * conj(z1) * z2 * conj(z2)) = √(z1 * conj(z1)) * √(z2 * conj(z2)) = z1 * z2
and:
z1/z2 = √((z1 * conj(z1))/(z2 * conj(z2))) = √((z1 * conj(z1))/√((z2 * conj(z2)) = z1/z2
Source: Wuncsh, David A. Complex Numbers with Applications. 2nd Edition. AddisonWesley Publishing Company. Reading, MA. 1994
Wednesday, November 12, 2014
Casio fx9750gII, fx9860gII, Prizm: Prime and Complex Number Prime (Gaussian Prime)
“N”?>N
Int N>N
For 2>K To S
If Frac (N÷K)=0
Then
“NOT PRIME” /rtri
Stop
IfEnd
Next
“PRIME”
36 is NOT PRIME
a+bi
“Z”?>Z
(Abs Z)^2>T
If ReP Z=0 or ImP Z=0
Then
Goto 1
IfEnd
For 2>K To Abs Z
If Frac(T÷K)=0
Then Goto 2
IfEnd
Next
Goto 3
Lbl 1
If MOD(Abs Z, 4)≠3
Then Goto 2
IfEnd
Next
Goto 3
Lbl 2
“NOT PRIME” /rtri
Stop
Lbl 3
“PRIME”
7 is (complex) prime
5+4i is (complex) prime
Tuesday, November 11, 2014
Darts: The Probability of Getting the Best Score
Area of a Circular Ring
= (π * (R3^2 – R2^2 + R5^2 – R6^2)/(π * R^2)
= (R3^2 – R2^2 + R5^2 – R6^2)/R^2
= (R6^2 – R5^2)/R^2
= (R4^2 – R3^2)/R^2
= (π * R2^2)/(π * R^2)
= R2^2/R^2
Scoring 60
Sunday, November 9, 2014
Two New Videos: Derivatives on the HP Prime, Derivative and Integral of abs(x)
Video: http://youtu.be/LXwLiPlKO2M
Notes:
Derivative Template: Template Key, template is on the top row, 4th column
Numeric Format: (d* function)/(d varaible = point), press Enter
In RPN Mode: You also need to press Shift+Comma (Eval)
Symbolic Format (CAS Mode): (d function)/(d variable)
*d represents the derivative symbol
diff command:
diff(function, variable)
Derivative and Integral of abs(x)
Video: http://youtu.be/8PikrlA5UlQ
A short derivation of the derivative and integral of absolute value function (abs(x)), and how the signum (sign(x)) function plays a part its calculation.
Graphs made with the online Desmos calculator. Please visit and explore at www.desmos.com
(This is NOT a paid endorsement)
Eddie
Blog Entry #403
This blog is property of Edward Shore. 2014
Saturday, November 8, 2014
My Morning at Honnold/Mudd Library: 20141108 (Game Shows, Bravias Lattice, Prime Numbers)
Honnold/Mudd Library  Claremont, CA 
Monday, November 3, 2014
Derivative of abs(x) and Integrals of abs(x), abs(e^x), abs(e^(a*x) + e^(a*y))
Derivative of abs(x) and Integrals of abs(x), abs(e^x), abs(e^(a*x) + e^(a*y))
For this blog entry, assume that are functions are in terms of x and a, x, y represent real numbers.
Definition of abs(x) (also symbolized as x)
Piecewise definition:
abs(x) = x if x > 0
abs(x) = 0 if x = 0
abs(x) = x if x < 0
Also:
abs(x) = x * sign(x)
Where the sign(x), sometimes labeled sgn(x), is the sign or signum function. It is defined as:
sign(x) = 1 for x > 0
sign(x) = 0 for x = 0
sign(x) = 1 for x < 0
d/dx sign(x)
We can clearly demonstrate that d/dx sign(x) = 0 since:
d/dx sign(x) = 0 for x > 0
d/dx sign(x) = 0 for x = 0
d/dx sign(x) = 0 for x < 0
d/dx abs(x)
Using the chain rule:
d/dx abs(x)
= d/dx (x * sign(x))
= d/dx (x) * sign(x) + x * d/dx (sign(x))
= sign(x)
This can also be done with the piecewise representation:
d/dx abs(x) = 1 if x > 0
d/dx abs(x) = 0 if x = 0
d/dx abs(x) = 1 if x < 0
∫ abs(x) dx
∫ abs(x) dx
= ∫ x * sign(x) dx
Using integration by parts:
where u = sign(x), dv = x dx
Then: du = 0 dx, v = x^2/2
∫ abs(x) dx
= ∫ x * sign(x) dx
= x^2/2 * sign(x)  ∫ 0 dx
= x^2/2 * sign(x) + C
C is the arbitrary integration constant
With the piecewise representation:
∫ abs(x) dx = x^2/2 if x > 0
∫ abs(x) dx = 0 if x = 0
∫ abs(x) dx = x^2/2 if x <0
Note that this is x^2/2 * sign(x).
∫ abs(e^(a*x)) dx
∫ abs(e^(a*x)) dx
= ∫ e^(a*x) * sign(e^(a*x)) dx
= 1/a * e^(a*x) * sign(e^(a*x))  ∫ 0 dx
= 1/a * e^(a*x) * sign(e^(a*x)) + C
∫ abs(e^(a*x) + e^(a*y)) dx
∫ abs(e^(a*x) + e^(a*y)) dx
= ∫ (e^(a*x) + e^(a*y)) * sign(e^(a*x) + e^(a*y)) dx
= (e^(a*x)/a + x*e^(a*y)) * sign(e^(a*x) + e^(a*y))  ∫ 0 dx
= (e^(a*x) + a*x*e^(a*y))/a * sign(e^(a*x) + e^(a*y)) + C
Eddie
This blog is property of Edward Shore. 2014
(Blog Entry # 401)
Casio fxCG 50 and HP Prime: The Price is Right Wheel Simulation
Casio fxCG 50 and HP Prime: The Price is Right Wheel Simulation Introduction On the very famous game show, The Price Is Right, c...

Casio fx991EX Classwiz Review Casio FX991EX The next incarnation of the fx991 line of Casio calculators is the fx991 EX. ...

One of the missing features of the TI82/83/84 family is the ability to convert between bases. Here are two programs in TIBasic to help...

HP Prime: Basic CAS Commands for Polynomials and Rational Expressions Define the following variables: poly: a polynomial o...