Showing posts with label complex analysis. Show all posts
Showing posts with label complex analysis. Show all posts

Saturday, December 3, 2016

TI-84 Plus: Intersection of two lines – program by Jack Kesler

TI-84 Plus:  Intersection of two lines – program by Jack Kesler

Special thanks to Jack Kessler for providing the program CPXINT.  CPXINT uses complex numbers to determine:

* The equation of a line between two points.  CPXINT uses two lines:

            y = Ax + B for coordinates N1, E1 and N2, E2.
            y = Cx + D for coordinates N3, E3 and N4, E4

* The intersection of the two lines, labeled by point N5, E5.

Keep in mind N is for North (y axis) and E is for East (x axis).




TI-84 Plus Program CPXINT – Jack Kesler

Note:  Initialize all the variables by choosing option 1, SETUP.  Choose 2 for input, 3 for equations of the lines, and 4 for intersection.

ClrHome
Disp "LINE INT"
Disp "USNG CPX"
Disp "VER. 1.0"
Pause
ClrHome
Lbl 50
Menu("CPXINT","SETUP",89,"INP PTS",90,"COMP LINS",91,"COMP INT",92,"EXIT",93)
End
Lbl 89
ClrHome
ClrAllLists
11→dim(L₁)
{2,2}→dim([A])
{2,1}→dim([B])
Goto 50
Lbl 90
ClrHome
Disp "INP CRDS:"
Input "N1= ",T
T→L₁(1)
Input "E1= ",T
T→L₁(2)
Input "N2= ",T
T→L₁(3)
Input "E2= ",T
T→L₁(4)
Input "N3= ",T
T→L₁(5)
Input "E3= ",T
T→L₁(6)
Input "N4= ",T
T→L₁(7)
Input "E4= ",T
T→L₁(8)
ClrHome
Goto 50
Lbl 91
ClrHome
a+bi
L₁(2)+L₁(1)i→I
L₁(4)+L₁(3)i→J
angle(J-I)→θ
If θ=90 or θ=­90
Then
real(I)→B
0→[A](1,1)
1→[A](1,2)
B→[B](1,1)
0→A
Else
tan(θ)→A
imag(I)-A*real(I)→B
1→[A](1,1)
­A→[A](1,2)
B→[B](1,1)
End
Disp "Y=A*X+B"
Disp "A= ",A
Disp "B= ",B
Pause
ClrHome
L₁(6)+L₁(5)i→I
L₁(8)+L₁(7)i→J
angle(J-I)→θ
If θ=90 or θ=­90
Then
real(I)→D
0→[A](2,1)
1→[A](2,2)
D→[B](2,1)
0→C
Else
tan(θ)→C
imag(I)-C*real(I)→D
1→[A](2,1)
­C→[A](2,2)
D→[B](2,1)
End
Disp "Y=C*X+D"
Disp "C= ",C
Disp "D= ",D
Pause
ClrHome
Real
Goto 50
Lbl 92
ClrHome
If A=C
Then
Disp "PARLLEL LINES"
Disp "NO SOLUTION"
Pause
ClrHome
Goto 50
End
[A]^-1*[B]→[D]
Disp "N5= ",[D](1,1)
[D](1,1)→L₁(9)
Disp "E5= ",[D](2,1)
[D](2,1)→L₁(10)
Pause
ClrHome
Goto 50
Lbl 93
ClrHome
Stop

Example:

Line 1:  N1 = 0, E1 = 1, N2 = 7, E2 = 2. 
Line 2:  N3 = 4, E3 = 3,  N4 = 4, E3 = -3

Results:
Y = AX + B:  A = 0,  B =  4
Y = CX + D:  C = 7,  D = -7
Intersection:  N5 = 4,  E5 = 1.571428571


Thank you Jack! 

Eddie


This blog is property of Edward Shore, 2016

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. Addison-Wesley Publishing Company. 1994.

Take care, Eddie

This blog is property of Edward Shore. 2014

Saturday, November 22, 2014

Complex Analysis: Cauchy-Reimann Equations

Continuing my blogging adventures at the Last Drop Cafe in Claremont, CA:

Cauchy-Reimann Equations

Let the complex-valued 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 Cauchy-Riemann 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 Cauchy-Riemann 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 Cauchy-Riemann 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 Cauchy-Riemann equations in a nutshell!

Source: Wunsch, A. David. Complex Variables with Applications. 2nd Edition. Addison-Wesley 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 "z-bar" (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. Addison-Wesley Publishing Company. Reading, MA. 1994

Monday, May 5, 2014

Complex Analysis Rap

Complex Analysis Rap

If you have a chance, check out this awesome complex analysis rap by Katherine Bellafiore Sanden:

http://youtu.be/PyYLzjYOHz0

You can download the song here: https://soundcloud.com/dragonflykbs/complex-analysis

Thank you Katherine for putting it on Soundcloud! The song is now proudly played on my iPod.

Thread where the rap, and other math sings are posted:

http://www.hpmuseum.org/forum/thread-1227.html

Thank you HP Forums (MoHPC)!

Just thought this is worth sharing - Eddie


Classic RPN Stack Operations

  Classic RPN Stack Operations Starting Stack: T:  d Z:  c Y:  b X:  a OVER :   Copies b to the Z and X stacks, while leaving ...