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

Saturday, April 20, 2024

Sharp EL-9300 Programs

Sharp EL-9300 Programs


Today’s blog entry takes us to the 1992 Sharp’s EL-9300 graphing calculator. On January 10, 2022, I gave a review of this calculator:

https://edspi31415.blogspot.com/2022/01/retro-review-sharp-el-9300c.html



The programs should also work on the EL-9200. Spaces are added for readability.



Sharp EL-9300 Program: polygon2


The program polygon2 calculates four properties of regular polygons:

* The internal angle of the polygon

* The length of the polygon’s apothem

* The length of the polygon’s radius

* The area of the polygon


A regular polygon is a polygon whose sides all have equal length and all the internal angles are equal.


REAL Mode

Print “Set Degrees 1st”

Wait 1

Print “number of sides”

Input n

Print “side length”

Input x

angle = (n – 2) / n * 180

apothem = x / 2 * tan (angle / 2)

radius = x / (2 * cos (angle / 2) )

area = n * x * apothem / 2

ClrT

Print angle

Print apothem

Print radius

Print area



Note that the calculator must be set in Degrees mode prior to running this program. To set the degrees mode, press [ SET UP ], [ B ], [ 1 ]. Note that this won’t set the angle mode indicator in the program as the angle mode change takes place outside of the program script.


Examples


Inputs: n = 6, x = 8

Outputs:

angle = 120 (internal angle)

apothem = 6.92820323

radius = 8

area = 166.2768775



Inputs: n = 12, x = 1.5

Outputs:

area = 150

apothem = 2.799038106

radius = 2.897777479

area = 25.19134295



Sharp EL-9300 Program: agm


The program agm calculates the arithmetic-geometric mean between two numbers x and y.


(x + y) / 2

√(x * y)


The program also asks for the tolerance. If the tolerance is small, it means we are asking for better accuracy at the expense of additional calculations.


REAL Mode

ClrT

Print “arithmetic/”

Print “geometric mean”

Input x

Input y

Print “tol (10^-nn)”

Input tol

Label loop

a = (x + y) / 2

g = √(x * y)

x = a

y = g

If abs(a – g) >= tol Goto loop

ClrT

Print “results”

Print a

Print g

End


Examples


Inputs: x = 15, y = 70, tol = 10^-6

Outputs:

a = 37.28076573

g = 37.28076573


Inputs: x = 1649, y = 1248, tol = 1E-7

Outputs:

a = 1441.519759

g = 1441.519759


The EL-9300 is pretty quick.



Sharp EL-9300: quadratic


The program quadratic solves the quadratic equation:


a * x^2 + b * x + c = 0


where a, b, and c can be real or complex numbers.


COMPLEX Mode

ClrT

Print “ax^2+bx+c=0”

Print “complex numbers”

Input a

Input b

Input c

x = (-b + √(b^2 – 4 * a * c)) / (2 * a)

z = x - √(b^2 – 4 * a * c) / a

ClrT

Print “solutions=”

Print x

Print z

End


Examples


Inputs:

a = 4 + 3i, b = 2 – 5i, c = 3i

Solutions:

x = 0.346818295 – 0.288439118i

z = -0.066818295 + 1.328439118i


Inputs:

a = 2, b = -6i, c = -4 + 8i

Solutions:

x = 1.370730624 + 0.040924113i

z = -1.370730624 + 2.959075887i



Sharp EL-9300 Program: twobytwo


The program twobytwo solves the simultaneous set of equations:


a * x + b * y = e

c * x + d * y = f


where a, b, c, d, e, and f can be complex numbers.


COMPLEX Mode

Print “2x2 system”

Print “complex numbers”

Print “A=((a,b)(c,d))”

Input a

Input b

Input c

Input d

Print “B=((e)(f))”

Input e

Input f

g = a * d – b * c

h = e * d – f * b

i = a * f – c * e

x = h / g

y = i / g

ClrT

Print “solutions=”

Print x

Print y

End



Examples


Input:

a = 3 + 2i, b = -i

c = 3 – 2i, d = 1 – i

e = 0, f = 5i

Outputs:

x = -0.660377358 + 0.188679245i

y = -0.754716981 + 2.358490566i


Input:

a = 3, b = -6

c = 3i, d = 6i

e = 1, f = -i

Outputs:

x = 0

y = -0.166666667




Eddie


All original content copyright, © 2011-2024. Edward Shore. Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited. This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.


Wednesday, May 3, 2023

Announcement: HP 15C Collector's Edition

 Announcement:  HP 15C Collector's Edition



The HP 15C Returns



Hewlett Packard and Moravia is bringing back the HP 15C Calculator with the HP 15C Collector's Edition, which is set to be delivered starting the summer of 2023.  


The HP 15C is a RPN (Reverse Polish Notation) programming scientific calculator, first released in in 1982 and has the following features:  


*  Matrices:  Store up to 5 matrices.  Operations include determinant, inverse, norm, and transpose.  

*  Complex Numbers:  The set of complex numbers includes powers, logarithms, and trigonometry.

*  Numerical integration

*  Solve:  Finding the roots of functions

*  Standard Scientific functions:  polar/rectangular conversions, trigonometry, powers, roots, logarithms, linear regression, fraction and integer parts, hyperbolic functions

*  Programming:  Keystroke with labels, comparison tests


The HP 15C Collector's Edition has the following improvements from the original and Limited Edition of the HP 15C:


*  There are now 99 memory registers, up from 67

*  There is now a memory capacity of 672 steps, up from 448

*  The new processor promises a faster speed 

*  The Collector's Edition comes with a printed manual, which can be downloaded from Calculator Store's website here:  https://www.thecalculatorstore.com/epages/eb9376.sf/en_US/?ObjectPath=/Shops/eb9376/Products/%22HP-15c%20%23INT%22


From browsing the PDF file of the manual, the manual looks nice and it's detailed. 


For details, credit, and discussion, click on Klass' original post is on the Museum of HP Calculators (MoHPC) here:  https://www.hpmuseum.org/forum/thread-19886.html



Pre-Orders


The HP 15C Collector's Edition is set to be delivered starting at the end of June 2023.   At this moment, Moravia Consulting, a licensee for HP Calculators, has two stores offering pre-sales:


Eduwinkel:  (Netherlands) (Price:  129,95 Euros as of 5/3/2023*)


https://www.eduwinkel.nl/hp-15c-collectors-edition-calculator.html


The Calculator Store:  (Spain) (Price: 129,99 Euros as of 5/3/2023*)


English:  

https://www.thecalculatorstore.com/epages/eb9376.sf/en_US/?ObjectPath=Categories


Spanish:  

https://www.thecalculatorstore.com/epages/eb9376.sf/es_ES/?ObjectPath=Categories


* Prices do not include delivery charges but does include value added tax (VAT).  Depending where the customer is from VAT may be subtracted from the price.  


Source:


Kuperus, Klaas.   "NEW: HP 15C Collectors Edition"  MoHPC (Museum of HP Calculators)   May 2, 2023.  https://www.hpmuseum.org/forum/thread-19886.html



I have pre-ordered a HP 15C Collector's Edition and can't wait to work with it.  



Disclaimer:  No compensation has been received for this post.  



All original content copyright, © 2011-2023.  Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author. 


Monday, February 8, 2021

An Alternative Way of Finding the Angle in a Rectangular to Polar Conversion

An Alternative Way of Finding the Angle in a Rectangular to Polar Conversion


Welcome to a special Monday edition of Eddie’s Math and Calculator Blog. 


The Traditional Method


Often we are required to find polar coordinates of a given point (x,y).   Finding the radius, r, is fairly simple:


r = √(x^2 + y^2) 


When talking about complex numbers, r represents the absolute value of x + yi where i = √-1.


Finding the angle, θ, often uses the formula:


θ = atan(y/x)


In complex numbers, θ represents the argument (arg) function.


On a scientific calculator the range of the arctangent function is ( -90°, 90° ).  (open interval).   In finding the true angle, adjustments will be required:





Let a = atan(y/x). Then: 


Quadrant I (x and y are both positive):  θ = a

Quadrant II (x is negative, y is positive): θ = a + 180°

Quadrant III (x and y are both negative):  θ = a - 180°

Quadrant IV (x is positive, y is negative):  θ = a 


If you are working with radian angle measures, know that 90° = Ï€/2, and 180° = Ï€.


This does not take into consideration situations where either x or y is 0:


If x > 0 and y = 0:  θ = 0°

If x = 0 and y > 0:  θ = 90°

If x < 0 and y = 0:  θ = 180°

If x = 0 and y < 0:  θ = -90°


Is there a shorter way to calculate θ?  


The Vector Method


Consider the point (x, y) as a vector [x, y].   Now draw another vector [x, 0].  In a regular Cartesian coordinate system, angles are measured from the x-axis counter clockwise.  





Let a and b represent two vectors.  Then the angle between two vectors are:


cos θ = (a ● b) / ( ||a|| ||b|| ) = dot(a,b) / ( norm(a) * norm(b) )


with:

dot(a,b) = a1 * b1 + a2 * b2

norm(a) = √(a1^2 + a2^2)

norm(b) = √(b1^2 + b2^2)


Let a = [x, y] and b = [x, 0].  Then:


cos θ = (x^2) / (√(x^2 + y^2) * √(x^2))

cos θ = (x^2) / (√(x^2 + y^2) * x)

cos θ = x / √(x^2 + y^2)

θ = acos( x / √(x^2 + y^2) )


The range of the arccosine function of a calculator is [ 0°, 180° ].  


If y < 0, the angle would be measured clockwise, and therefore I would make the adjustment:

θ = -acos( x / √(x^2 + y^2) )


In summary:

If y ≥ 0, θ = acos( x / √(x^2 + y^2) )

If y < 0, then θ = -acos( x / √(x^2 + y^2) )


Examples:


Find the angle, in degrees, in a rectangular to polar conversions:


Quadrant I  (2, 4):  y ≥ 0:   θ = acos( 2 / √(2^2 + 4^2) ) ≈ 63.43494882°


Quadrant II (-2, 4):  y ≥ 0:    θ = acos( -2 / √((-2)^2 + 4^2) ) ≈ 116.5650512°


Quadrant II (-2, -4):  y < 0:  θ = -acos( (-2) / √((-2)^2 + (-4)^2) ) ≈ -116.5650512°


Quadrant IV (2, -4):  y < 0:  θ = -acos( 2) / √(2^2 + (-4)^2) ) ≈ -63.43494882°


Vector Method for Navigation


In navigation, angles start from true North (up) and rotate clockwise towards East (right).  Angles are measured from 0° to 360°.


Use the vectors [0, N] and [E, N], then the angle between these vectors are:

If E ≥ 0,  θ = acos( N / √(E^2 + N^2))

If E < 0, θ = 360° - acos( N / √(E^2 + N^2))


Note:  This is the first blog entry that I have typed on Google Docs.  I have been using Windows app Wordpad for the last three years.   I am testing Google apps as I am considering buying a Chromebook.


Eddie


All original content copyright, © 2011-2021.  Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.


Sunday, May 15, 2011

Complex Number Operations (Part II)



For all the calculations, let z = a + bi

Assume your calculator is in Radians Mode. The algorithms are suggested.

Exponential of a Complex Number

e^z = e^a (cos b + i sin b)

This calculation is fairly easy because it is relatively straight forward.

A sample RPN (Reverse Polish Notation) routine would look like:

With b on the y stack and a on the x stack:

e^x
STO 0 (or whatever register or variable you want as temporary storage)
x< >y (swap)
ENTER
SIN
RCL 0
×
R↓
COS
×
x< >y (swap)
R↓

Result: real(e^z) is on the x stack, while imag(e^z) is on the y stack

Natural Logarithm of a Complex Number

ln z = ln r + i θ

where r = √(x^2 + y^2) and θ = arctan(y/x)

Casio fx-115ES:
ln(abs(a + bi)) + i arg(a + bi)

Sharp EL-W516:
ln(abs(a + bi)) + i tan^-1(b÷a)

TI-36X Pro:
ln(abs(a + bi)) + i angle(a + bi)

With b on the y stack and a on the x stack, a sample RPN routine mat look like this:
→P (Rectangular to Polar conversion)
LN

Argument vs Arctangent (tan^-1)

Bear in mind that the argument (often labeled arg or angle for TI calulators) and the arctangent functions returns different angles. However the angles are accurate, recall the identity tan(x ± Ï€) = tan(x).

Ranges of Calculator Functions:

angle/arg returns the angle between -Ï€/2 and Ï€/2 (-90° and 90°)

tan^-1 returns the angle between 0 and Ï€ (0° and 180°)






Sine of a Complex Number

There are two general formulas to calculate the sine of a complex number

(1) sin z = sin a cosh b + i cos a sinh b

(2) sin z = (e^iz - e^-iz)/(2i)

Formula (2) is good if your calculator can handle e^z. For the non-graphing calculators, I recommend using formula (1).

A sample RPN routine looks like this:

With b on the y stack and a on the x stack:

STO 0 (or A)
COS
x< >y
STO 1 (or B)
SINH
×
RCL 1 (or B)
COSH
RCL 0 (or A)
SIN
×


Cosine of a Complex Number

Calculating the cosine of a complex number is similar:

(1) cos z = cos a cosh b - i sin a sinh b

(2) cos z = (e^iz + e^-iz)/2

A sample RPN routine looks like this:

With b on the y stack and a on the x stack:

STO 0 (or A)
SIN
CHS (+/-)
x< >y
STO 1 (or B)
SINH
×
RCL 1 (or B)
COSH
RCL 0 (or A)
COS
×



The formulas are presented for completion.

ArcSine and ArcCosine

These formulas are presented for completion.

sin^-1 z = -i ln( i z ± √(1 - z^2))

cos^-1 z = -i ln(z ± i√(1 - z^2))

The principle angle is given by using +.

(staff.jccc.net)

Complex Power of a Complex Number

Let z and w be complex numbers, then:

z^w = e^(w ln z)

(HP 41C Math Pac)

DM42 and HP 42S: Quadratic Equation, Characteristic Polynomial, and Eigenvalues

DM42 and HP 42S: Quadratic Equation, Characteristic Polynomial, and Eigenvalues The programs are listed for the Swiss Micros DM42 an...