Sunday, January 28, 2024

Swiss Micros DM42 and TI-84 Plus: Sum of an Infinite Geometric Series

Swiss Micros DM42 and TI-84 Plus:  Sum of an Infinite Geometric Series



Introduction


An infinite geometric series has the form:


a + a × r + a × r^2 + a × r^3 + ...


= a × (1 + r + r^2 + r^3 + ....)



If |r| < 1, the series converges and a sum exists. 


Σ  a × r^n   =   a ÷ (1 - r)

n=0


Σ  a × r^(n-1)   =   a ÷ (1 - r)

n=1


However if |r| ≥ 1, the series diverges and does not have as sum.



DM42 Program:  GSUM


Calculators: DM42, HP 42S, Free42, Plus42


00 { 36-Byte Prgm }

01▸LBL "GSUM"

02 ENTER

03 ABS

04 1

05 X<>Y

06 X>Y?

07 GTO 00

08 R↓

09 R↓

10 1

11 X<>Y

12 -

13 ÷

14 RTN

15▸LBL 00

16 CLX

17 "DIVERGES"

18 AVIEW

19 .END.


In the case the series diverges, the X stack is cleared (displays 0).  



TI-84 Plus Program:  GSUM


Calculators:  TI-84 Plus, TI-84 Plus CE (Python), TI-83 Premium CE (Python)


Disp "Σ(A*R^N,0,INF)","Σ(A*R^(N-1),1,I)"

Prompt A,R

ClrHome

Disp "A=",A,"R=",R

If abs(R)<1

Then

A/(1-R)→S

Disp "SUM=",S

Else

Disp "DIVERGES"

End



Examples


A:  3,  R:  -0.2

Stack:  Y = 3, X = -0.2

Result = 2.5


A:  3,  R:  0.2

Stack:  Y = 3, X = -0.2

Result = 3.75


A:  3,  R:  -2.2

Stack:  Y = 3, X = -2.2

Result = diverges


A:  3,  R:  2.2

Stack:  Y = 3, X = 2.2

Result = diverges



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. 


Saturday, January 27, 2024

HP Prime - Restart and Some CAS Command Comparisons

HP Prime - Restart and Some CAS Command Comparisons


restart - A Rescue in CAS Mode

I learned about this command in a recent HPCC virtual meeting about the command restart.   One of the participants had trouble storing equations in variables.   After changing settings and trying other formats, the restart command was introduced and it solved the problem.  

What the restart command does is purge all the variables in CAS variables and reset all CAS settings.    The restart command can be typed or found in the Catalog.
The command does not require arguments.

When the restart command, the screen will show:

============== restarted ==============

Pressing enter will show a list of the CAS variables in a list.  



Some CAS Command Comparisons


ifactor vs. ifactors

ifactor gives the prime factorization of integers.

ifactors returns a list of prime factors with the associated multiplicity in a list in the format:    
[ factor1, multiplicity1, factor2, multiplicity2, ... ]


Examples:


ifactor(480) returns 2^5 * 3 * 5

ifactors(480) returns [2, 5, 3, 1, 5, 1]


ifactor(507) returns 3 * 13^2

ifactors(507) returns [3, 1, 13, 2]


normal vs. regroup

Both the normal and regroup commands can be found in the catalog or can be typed.  According to the help facility:

normal simplifies an expression to an irreducible form.

regroup simplifies and collects terms in an expression, to match the Minimum simplification setting.  


Examples:


normal(a*(b+a-b^2)) returns a^2-a*b^2+a*b

regroup(a*(b+a-b^2)) returns a*(-b^2+a*b)


normal(x+5*x+6*(x^2-3*x)) returns 6*x^2-12*x

regroup(x+5*x+6*(x^2-3*x)) returns 6*(x^2-3*x)+6*x


normal(x^2*√2-(x^3-1)/(x+1)) returns ((√2-1)*x^3+2*√2*x^2+1)/(x+2)

regroup(x^2*√2-(x^3-1)/(x+1)) returns √2*x^2-(x^3-1)/(x+2)


normal((x+3)^5) returns x^5+15*x^4+90*x^3+270*x^2+405*x+243

regroup((x+3)^5) just returns (x+3)^5


iquo vs irem vs. iquorem

The three commands iquo, irem, and iquorem are commands in Euclidean Division.

iquo(x,y) returns the quotient of x/y

irem(x,y)  returns the remainder of x/y

iquorem(x,y)  returns the quotient and remainder of x/y in a list.

The arguments x and y must be positive integers.  


Examples:


iquo(258,19) returns 13

irem(258,19) returns 11

iquorem(258,19) returns [13, 11]

258 = 13 * 19 + 11



I really need to work with the CAS engine of the HP Prime more often,

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. 

Sunday, January 21, 2024

Approximating Limits to Avoid Overflow

Approximating Limits to Avoid Overflow


For most 10-digit scientific calculators, the maximum that a number can be before an overflow error occurs is 9.999999999×10^99.



The Maximum Number



What is the maximum number x can be before the calculator overflows?   (For reference, I used a TI-84 Plus to calculate these numbers.)


Function:  Maximum Number


e^(x^2):   15.17427129


x!:   69    (most calculators only allow nonnegative integers for the factorial function)


3^x:   209.5903274


e^x:  230.2585093


2^x:  332.1928095


x^4:  slightly less than 1E25  (1 × 10^25)  (like 9.99999999999E24)


x^3:  2.15443469E33  (2.15443469 × 10^33)


x^2:  slightly less than 1E50  (1 × 10^50)  (like 9.99999999999E49)


x^(3/2):  4.641588833E66  (4.641588833 × 10^66)  



Limits to Infinity



Why is this important?    This could be useful in applications, say approximating values of y(x) when x approaches infinity.




Example 1:


y = ln(x) / x^3


To find the limit x can be, look at the function presented and select the "part" that has the lowest limit.   In this case, that "part" is x^3.  Approach to that limit.


y(1E33):  7.59853081E-98


y(1.5E33):  2.26343032E-98


y(2E33):  9.58480691E-99


y(2.1E33):  8.28498493E-99


It would appear that ln(x)/x^3 approaches 0 as x approaches ∞.



The key is to select x values that will not cause the calculator to provide the overflow error.



Example 2:  


y = e^x/x^2


e^x has a max x of 230.2585093, while x^2 has a max x of 9.99999999999E49.  To prevent an overflow, we must choose x values approaching the lower max, in this case, 230.2585093.


y(229.9):  1.321975623E95


y(230):  1.459738847E95


y(230.1):  1.611859E95


y(230.2):  1.779832347E95


It would appear that e^x/x^2 approaches ∞ as x approaches ∞.



Example 3:


y = (x^3 - 1) / (x! * x^2)


Since the factorial is involved, the highest x can be is 69.


But y(69) overflows in this case!   Then we have to select lower x values until we can get answers.  This can be a trial and error approach.


y(68):  overflow


y(67):  1.83706434E-93


y(66):  1.21246228E-91


y(65):  7.88100352E-90


Looking at the results from y(65), y(66), and y(67), it appears that (x^3 - 1) / (x! * x^2) approaches 0 as x approaches ∞.



Remember that this isn't proof, but we can get an idea how a rational function will behave.  We still need the tools such as the ratio, root, and other tests.



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. 


Saturday, January 20, 2024

Retro Review: Panasonic CompuVoice JF-721U

Retro Review:  Panasonic CompuVoice JF-721U



My partner, Chris, gave me this calculator as a Christmas present.  Thank you and love you, Chris!









Quick Facts


Model:  JF-721U

Company:  Panasonic

Timeline:  early to mid 1980s

Type:   Four Function Calculator, Stopwatch, Timer, Clock, with Voice

Number of Digits:  8

Power:  3 AA batteries



An All-In One Calculator



This is like a dream machine:  a calculator, a clock, stopwatch, timer, and it talks, and it came with a beautiful brown leather power that shows the clock and a button labeled [ TIME ], when pressed the calculator reads the time.   [ TIME ] is located on the upper left hand corner of the calculator next to its speaker.  


Chris definitely did well!


The voice is a male machine voice, loud and clear. 



The Three Modes:  LOCK, COMP-TIME-STOP WATCH, and SET



The switch on the JF-721U selects the calculator's three modes:  LOCK, COMP-TIME-STOP WATCH, and SET.   Let's go through these modes one by one.   



LOCK Mode


LOCK mode is basically the calculator's sleep mode.  The display shows the clock and the only key that operates is the [ TIME ] button.  



COMP-TIME-STOP WATCH Mode


On this mode, we can run the calculator, timer, and the stopwatch.   


Timer:  The timer can be set in hours (h) and minutes (m) only.  To set the timer, press the [ SET ] button, enter the time desired in hh-mm format, and press [ S/S ].   The [ S/S ] acts as the start/stop button.


Stopwatch:  The stopwatch is actived by pressing the [ SET ] and [ S/S ] keys in sequence to start the stopwatch.  The stop the stopwatch again, press the [ S/S ] key and record the time.   If the voice is turned on, the final time will be read.   We can start and stop the stopwach as many times as we want.  


To cancel the stopwatch without seeing the result, press the clear [ C ] button.


Calculator:  The JE-721U is a four-function calculator.   The calculator is activated by the clear [ C ] button.   There are three standard memory keys:  memory plus [ M+ ],  memory minus [ M- ], and memory recall-clear [ MRC ].  The number in the memory register is retained as long as there is battery power.


One curious thing with the percent key, [ % ], is that the key only works with multiplication and division problems.  


To add a percent: 

Enter the number, press [ × ], enter the percent, press [ % ], press [ + ]


To subtract a percent: 

Enter the number, press [ × ], enter the percent, press [ % ], press [ - ]


The calculator's change sign key is labeled [ (-) ]. 


In this mode, the calculator's voice is toggled on and off by the [ VOICE ] key.


The hour [ HOUR ] key is also available.  If the hour key is on, then the calculator will announce the hour.



SET Mode


We can set the clock and the alarm in SET mode.   In this mode we can set the clock and an alarm.


To set the clock:  press [ SET ], enter the hour and minute, and then the [ TM ] key.  


To set the alarm:  press [ SET ], enter the hour and minute, and then the [ ALM ] key. 


In this mode, the decimal key, [ . ], switches between AM/PM.   


If this calculator can handle military time (00:00 to 23:59), I don't know how to set it.  Also, the calculator is a clock only, so for daylight savings time, the time must be manually set. 



Final Thoughts


I like this calculator.  The voice is loud and clear and the time functions are really nice additions.   I imagined the CompuVoice calculators set on the desks of professionals and were companions of travelers back in the 1980s.     




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. 


Sunday, January 14, 2024

Swiss Micros DM32: Remote XEQ: Calling Program from Other State Files

Swiss Micros DM32:   Remote XEQ:  Calling Program from Other State Files



Required Firmware:  2.07 or later


The Swiss Micros DM32 is truly an enhanced HP 32SII, and some of the new features take this platform to the next level.   One of the newest features is the ability to call programs from other state files, which Swiss Micros calls Remote XEQ.  


What is a state file?  A state file is a calculator file that contains its set of programs, equations, variables, and settings.   Since the DM32, like the HP 32SII, has only have one letter label names, state files are the way to expand and organize lots of programs and equations without having to re-program the calculator every time.


Calling programs from other state files allow the use of programs from other available state files.  How do you know if a state file is available?  Press the fourth key from the left on the top row of keys.  There will be a list of available states loaded into calculator memory.   If the state file that you need isn't listed, select Load (second key from the left on the row of blank keys in the Available States menu) and load the required state file. 


As of Firmware 2.07, we can only execute remote labels in programs, not from the home screen.  



Using Remote XEQ in a Program



1.  Make sure your source state file is available. 


2.  In the program, press [ XEQ ] twice.   ( [ XEQ ] [ XEQ ])   You will be taken to a screen of available state files.


3.  Select the source state file.  In the Available States screen, use the plus [ + ] and minus [ - ] keys to scroll the cursor.  Press [ ENTER ].


4.  Insert the required label from the source file.   All variables in the remote execution are considered local.



Communication Note:   When you have a program that uses remote XEQ, be sure upload both the source and the current state files, and communicate that both files have to be available (active) to those you download your programs.  



Example


Let's assume the following states are available:  demo.d32 and clean.d32.   The demo file is the source file containing the following program:


R01 LBL R

R02 1/x 

R03 x<>y

R04 1/x 

R05 +

R06 1/x 

R07 RTN


This calculates 1/(1/x + 1/y).   


In the clean file, we can call program R from demo by:


A01 LBL A

A02 XEQ R:DE 

 

(Press [ XEQ ] [ XEQ ], select demo from the list of available states, [ ENTER ] , R)


A03 RTN


Now executing program A in the clean state will execute program R in the demo state.



In the demo state:

4 [ ENTER ] 9 [ XEQ ] R  returns 2.7692    (FIX 4 mode is set)


In the clean state:

4 [ ENTER ] 9 [ XEQ ] A  returns 2.7692    (FIX 4 mode is set)



Source


SwissMicros GmbH  "DM32 User Manual"  v3.46b 2016-2023

https://technical.swissmicros.com/dm32/doc/dm32_user_manual.html



I hope you find this new feature useful,


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. 


Saturday, January 13, 2024

TI-30Xa Algorithms: Probability

TI-30Xa Algorithms:  Probability



Introduction


Even when a calculator isn't (technically) programmable, algorithms can be applied to scientific and financial calculations.


The calculations take numerical arguments that are stored in the TI-30Xa's three memory slots:  M1, M2, and M3.  Store amounts into the memory registers by the [ STO ] key.  


Careful:  For the solar versions of the TI-30Xa, do not press the [ON/AC] button as doing so clears the memory registers.


The registers used:


M1 = n 

M2 = k 

M3 = p 



Repeated Combinations


nHk = (n + k -1)Ck = (n + k - 1)! ÷ (k! × (n - 1)!)


Registers:


M1:  n = number of objects

M2:  k = number of objects chosen in the population


nHk = number of combinations of picking k from n objects, assuming repeats are allowed


Algorithm:


[ ( ] [ RCL ] 1 [ + ] [ RCL ] 2 [ - ] 1 [ ) ] [ 2nd ] (nCr) [ RCL ] 2 [ = ]


Example:


M1: n = 50

M2: k = 5


Result:  3,162,510



Binomial Probability Distribution


Prob(k) = nCk × p^k × (1 - p)^(n - k) = n! ÷ (k! × (n - k)!) × p^k × (1 - p)^(n - k) 


Registers:


M1:  n = number of trials

M2:  k = number of successes

M3:  p = probability of success (in decimal; i.e. enter 0.30 for 30%)


Prob =  probability of k successes out of n trials with a success probability p


Algorithm:  


[ RCL ] 1 [ 2nd ] (nCr) [ RCL ] 2 [ × ] [ RCL ] 3 [ y^x ] [ RCL ] 2 [ × ] [ ( ] 1 [ - ] [ RCL ] 3  [ ) ] [ y^x ] [ ( ] [ RCL ] 1 [ - ] [ RCL ] 2 [ ) ] [ = ] 


Example:


M1: n = 50

M2: k = 5

M3: p = 0.8


Result:  2.442763967 × 10^-26



Geometric Probability Distribution


Prob(k) = (1 - p)^(k - 1) × p


Registers:


M2:  k = number of failures before the first success

M3:  p = probability of success (in decimal) 


Prob = probability of a event taking k trials before the first success


Algorithm:


[ ( ] 1 [ - ] [ RCL ] 3 [ ) ] [ y^x ] [ ( ] [ RCL ] 2 [ - ] 1 [ ) ] [ × ] [ RCL ] 3 [ = ]


Example:


M2: k = 5

M3: p = 0.8


Result:  0.00128



A Simple Pseudorandom Number Generator


The TI-30Xa does not have a random number function.  To generate random numbers, a pseudorandom number generator algorithm must be used in the form of:


x_n+1 = f(x_n)


where x_0 is the initial value, known as the seed value.  



A simple pseudorandom  number generator to generate numbers between 0 and 1 is:


x_n+1 = frac(997 × x_n + π)



Algorithm:


With x_n in display:

[ × ] 997 [ + ] [ π ] [ = ] 

[ - ] the integer part of the number in the display [ = ]


Result:  x_n+1.   


There is no fraction part or integer part functions are not available on the TI-30Xa.  



Example:   


Starting seed:   0.7896   


[ × ] 997 [ + ] 

[ π ] [ = ]        Display:  799.3457927

[ - ] 799 [ = ]  Display:  0.345792654


[ × ] 997 [ + ] 

[ π ] [ = ]        Display:  347.8968683

[ - ] 347 [ = ]  Display:  0.896868283


[ × ] 997 [ + ] 

[ π ] [ = ]        Display:  897.3192706

[ - ] 897 [ = ]  Display:  0.319270625


[ × ] 997 [ + ] 

[ π ] [ = ]        Display:  321.4544059

[ - ] 321 [ = ]  Display:  0.454405908


and so on...


The random numbers with the starting seed 0.7896 are:

0.345792654

0.896868283

0.319270625

0.454405908


Take as many decimal points as you wish.  




If you enjoy this post, I will consider making a series using the TI-30Xa calculator (and similar simple scientific calculators).  Until next time,


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. 


Sunday, January 7, 2024

Casio fx-9750GIII: Equatorial to Galactic Coordinates Conversions

Casio fx-9750GIII: Equatorial to Galactic Coordinates Conversions 



Introduction



Coordinate Systems


There are several coordinate systems used by astronomers to determine the placement of celestial objects, such as stars, galaxies, planets, and black holes, in our night skies.


Two coordinate systems are:



Equatorial System:


The equatorial system frames the University with the Earth's center as the center of the university.  


Right Ascension (α):   Customarily stated in hours, minutes, and seconds (H°M°S°).   Each hour is equivalent to 15 degrees.  The right ascension at 0 hours is aligned where the sun would be during the vernal equinox.  


Declination (δ):   Customarily stated in degrees, minutes, and seconds (D°M°S°).  



Galactic System:


The galactic system frames the University, aligning it with the Milky Way Galaxy.  The center of the system is our Sun.  The galactic longitude at 0 degrees aligns with the center of our galaxy (Sagittarius A*).


Galactic Longitude (l):  Customarily stated in degrees, minutes, and seconds (D°M°S°).  


Galactic Latitude (b):  Customarily stated in degrees, minutes, and seconds (D°M°S°).  



The program EQT2GLT converts equatorial coordinates (α, δ) to galactical coordinates (l, b).  


b = arcsin( cos δ × cos 27.1284° × cos(α - 192.8595°) + cos δ × cos 27.1284° )


l = 

arctan( ( sin δ - sin b × sin 27.1284° ) ÷ ( cos δ × sin(α -192.8595°) × cos 27.1284°) + 32.93117169°

=  atan2((sin δ - sin b × sin 27.1284°), (cos δ × sin(α -192.8595°) × cos 27.1284°)) + 32.93117169°


b is in hours, from -90 to 90 degrees.


l is in degrees, from 0 to 360 degrees.  Be sure to consider quadrants in your calculation.   



The program GLT2EQT converts galactical coordinates (l, b) to equatorial coordinates (α, δ).  


δ = arcsin( (cos b × cos 27.1284° × sin( l - 32.93117169° ) + sin b × sin 27.1284° )


α = arctan( ( cos b × cos( l - 32.93117169° ) ) ÷ ( sin b × cos 27.1284° - cos b × sin 27.1284° × sin( l - 32.93117169° ) ) + 192.8595°

= atan2((cos b × cos(l - 32.93117169°),(sin b × cos 27.1284° - cos b × sin 27.1284° × sin(l-32.93117169°)) + 192.8595°


δ is in degrees, from -90 to 90 degrees.  


α is in hours, from 0 to 24 hours.  Be sure to consider quadrants in your calculation.   Remember that 1 hour is equivalent to 15 degrees.  



The equations are from Practical Astronomy With Your Calculator by Peter Duffett-Smith, with the constants updated for J2000.0.


From the "Conversion of coordinates" page of Tobias Westmeier's webpage, the J2000.0 of the north pole are:


α0 ≈ 192.8595°  (12h 51m 26.28s)

δ0 ≈ 27.1284°  (27°07'42.24")


(Sources:   Duffett-Smith, Westmeier - refer to the Source section)


For more details, please refer to the Equatorial to Galactic Coordinates:  Updating the Constants posted on January 6, 2023.   


Casio fx-9750GIII Program:  EQT2GLT

a+bi
Deg
"EQUATORIAL -> GALACTIC"
"J2000.0"
"R.A. IN H°M°S°"
?->A
"DEC. IN D°M°S°"
?->D
15*A->A
192.8595->R
27.1284->E
32.93117169->C
sin^-1 (cos D*cos E*cos (A-R)+sin D*sin E)->B
sin D-sin B*sin E->Y
cos D*sin (A-R)*cos E->X
Arg (X+Yi)->T
Y<⇒T+360->T
T+C->L
ClrText
"B="
B ▶DMS◢
"L="
L ▶DMS

Note:  The calculator is set to the following modes: degrees, and rectangular complex mode. 

Example:  

The star Hamal in the constellation Aries (Alpha Arietis) is located approximately at:
α = 2 hours, 7 minutes, 10 seconds
δ = 23°27'44"

Enter hours-minutes-seconds and degrees-minutes-seconds by pressing [ OPTN ], [ F6 ] ( > ), [ F5 ] (ANGL), [ F4 ] (°''').

b:  -36°12'22.12"
L:  144°34'33.2"


Casio fx-9750GIII Program:  EQT2GLT

a+bi
Deg
"GALACTIC_->_EQUATORIAL"
"J2000.0"
"B (LAT) IN D°M°S°"
?->B
"L (LONG) IN D°M°S°"
?->L
192.8595->R
27.1284->E
32.93117169->C
sin^-1 (cos B*cos E*sin (L-C)+sin B*sin E)->D
cos B*cos (L-C)->Y
sin B*cos E-cos B*sin E*sin (L-C)->X
Arg (X+Yi)->T
R+T->A
A>360⇒A-360->A
A÷15->A
ClrText
"R.A.="
A ▶DMS◢
"DEC="
D▶DMS

Example:

The star Regulus in the constellation Leo (Alpha Leonis) is located approximately at:  
b:  48°56'03"
l:  226°25'36"

α:  10°08'22.31"  (10 hr, 8 min, 22.31 sec)
δ:  11°58'02.14"

Note:  The results are approximated.  


Sources


"Equatorial coordinate system"  Wikipedia.  Last Edited April 10, 2023.  Accessed December 10, 2023.  https://en.wikipedia.org/wiki/Equatorial_coordinate_system


"Galactic coordinate system" Wikipedia.  Last Edited April 21, 2023.  Accessed November 23, 2023.  https://en.wikipedia.org/wiki/Galactic_coordinate_system


Duffett-Smith, Peter.  Practical Astronomy With Your Calculator  Second Edition.  Cambridge University Press: Cambridge, UK.  1981.  

ISBN: 0 521 28411 2  (paperback) 


National Aeronautics and Space Administration (NASA).   "Coordinate Calculator"  NASA/IPAC Extragalactic Database.  Operated by the California Institute of Technology.  2023.   Accessed November 26, 2023.  https://ned.ipac.caltech.edu/coordinate_calculator?in_csys=Equatorial&in_equinox=J2000.0&obs_epoch=2000.0&ra=17h45m40.036s&dec=-29d00m28.17s&pa=0.0&out_csys=Galactic&out_equinox=J2000.0


Westmeier, Tobias.   "Conversion of coordinates"  Homepage of Tobias Westmeier.  The University of Western Australia.  Last Modified 26 September 2023.   Accessed November 26, 2023.   https://www.atnf.csiro.au/people/Tobias.Westmeier/index.php


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. 


Saturday, January 6, 2024

Equatorial to Galactic Coordinates: Updating the Constants

Equatorial to Galactic Coordinates:  Updating the Constants 



Introduction


There are several coordinate systems used by astronomers to determine the placement of celestial objects, such as stars, galaxies, planets, and black holes, in our night skies.   



Equatorial System


The most common system is the Equatorial System.  Imagine a sphere which represents the Universe with the center of the Earth as the center.   The coordinates are the right ascension (α) and the declination (δ).


Right ascension (α):  The right ascension is the angular distance from the vernal equinox, going eastward traveling with the celestial equator. The 0 point is the vernal equinox.   The vernal equinox, which generally takes place around March 20 or 21, is when the sun is over the Earth's equinox heading north.  The lengths of daytime and nighttime are equal.   For the northern hemisphere, it's the first day of spring, and for the southern hemisphere, it's the first day of autumn.  Sometimes, the vernal equinox is called the First Point of Aries (♈).  The range of the right ascension is from 0 hours to 24 hours.   Each hour is equivalent to 15° (15 degrees).


Declination (δ): The declination is the angular distance north (above) or south (below) the celestial equator.  The range of declination is from -90° to +90°.



Galactical System


The galactic coordinate system focuses on aligning with our Milky Way Galaxy, with our Sun as the center of the sphere.  


Galactic Longitude (l):  The galactic longitude measures the angular distance from the center of the Milky Way Galaxy, increasing in the eastward direction.   The range of the galactic longitude is from 0° to 360°, with the 0° point at the Galactic Center, which lies in the constellation Sagittarius the Archer.   (Sagittarius A*)


Galactic Latitude (b):  The galactic latitude is the angle northward from the galactic equator, and it's range is from -90° (south pole located in the constellation Sculptor) to 90° (north pole located in the constellation Coma Berenices).



Practical Astronomy:  With Updated Constants


A popular resource for astronomical calculations is the book Practical Astronomy With Your Calculator by Peter Duffett-Smith.  


On page 48 of Practical Astronomy With Your Calculator, Duffett-Smith provides these equations for converting from equatorial (α, δ) to galactic (l, b) coordinates:


b = arcsin( cos δ × cos 27.4° × cos(α - 192.25°) + cos δ × cos 27.4° )


l = arctan( ( sin δ - sin b × sin 27.4° ) ÷ ( cos δ × sin(α -192.25°) × cos 27.4°) + 33°


Note that in calculation, α, δ, b, and l must be in decimal degrees.   Usually the coordinates are given in hours-minutes-seconds or degrees-minutes-seconds, and the quantities must be converted before calculation.   



The numerical constants?   Those are the 1950.0 coordinates of the north galactic pole with  α0 = 192.25° = 12h 49m and δ = 27.4° = 27°24'.  


Obviously, in 2024, we would be working with the epoch J2000.0 coordinates of the north galactic pole.   If we want to work the J2000.0 coordinates in the above formulas, the constants must be changed.


From the "Conversion of coordinates" page of Tobias Westmeier's webpage, the J2000.0 of the north pole are:


α0 ≈ 192.8595°  (12h 51m 26.28s)

δ0 ≈ 27.1284°  (27°07'42.24")


I choose to use these coordinates because it provides more decimal places than what is presented in the Galactic coordinate page of Wikipedia.


This leaves us with updated equations:


b = arcsin( cos δ × cos 27.1284° × cos(α - 192.8595°) + cos δ × cos 27.1284° )


l = 

arctan( ( sin δ - sin b × sin 27.1284° ) ÷ ( cos δ × sin(α -192.8595°) × cos 27.1284°) + C


We need to determine the value of C.


I'm going to use our galactic center, Sagittarius A*, as a reference point, with the coordinates as determined by NASA/IPAC Extragalactic Database's Coordinator Calculator tool:


Sagittarius A*:


Equatorial Coordinates

α ≈ 266.41681667° (17h 45m 40.036s)

δ ≈ -29.007825° (-29°00'28.17")


Galactic Coordinates

l ≈ 359.94418679°  (359°56'39.072")

b ≈ -0.04610951° (-0°2'45.994")

(Theoretically, this should be l0 = 0°, b0 = 0°).



Substituting the following data into equation for l (only the second equation has C):


l = 

arctan( ( sin δ - sin b × sin 27.1284° ) ÷ ( cos δ × sin(α -192.8595°) × cos 27.1284°) + C


359.94418679°  = 

arctan( ( sin -29.007825°  - sin -0.04610951°  × sin 27.1284° ) ÷ ( cos -29.007825°  × sin(266.41681667° - 192.8595°) × cos 27.1284°) + C



359.94418679°  = arctan( (-0.4845538612°)  ÷ (+0.7465187073°)) + C


We have to keep in mind that anytime we are working with astronomical math, we have to mind the coordinate system.  


359.94418679°  = atan2(0.7465187073°, -0.4845538612°) + C


359.94418679°  = arg(0.7465187073° - 0.4845538612° × i) + C   (where i = √-1)



Note:  


atan2(0.7465187073°, -0.4845538612°) = -32.98698493°


To put this answer in the range of 0° to 360°:


-32.98698493° + 360° = 327.0130151°



359.94418679°  = 327.0130151° + C   


C = 32.93117169



Our final updated equations are:



b = arcsin( cos δ × cos 27.1284° × cos(α - 192.8595°) + cos δ × cos 27.1284° )


l = 

arctan( ( sin δ - sin b × sin 27.1284° ) ÷ ( cos δ × sin(α -192.8595°) × cos 27.1284°) + 32.93117169


and will be used in the programs coming up this weekend.




Sources


"Equatorial coordinate system"  Wikipedia.  Last Edited April 10, 2023.  Accessed December 10, 2023.  https://en.wikipedia.org/wiki/Equatorial_coordinate_system


"Galactic coordinate system" Wikipedia.  Last Edited April 21, 2023.  Accessed November 23, 2023.  https://en.wikipedia.org/wiki/Galactic_coordinate_system


Duffett-Smith, Peter.  Practical Astronomy With Your Calculator  Second Edition.  Cambridge University Press: Cambridge, UK.  1981.  

ISBN: 0 521 28411 2  (paperback) 


National Aeronautics and Space Administration (NASA).   "Coordinate Calculator"  NASA/IPAC Extragalactic Database.  Operated by the California Institute of Technology.  2023.   Accessed November 26, 2023.  https://ned.ipac.caltech.edu/coordinate_calculator?in_csys=Equatorial&in_equinox=J2000.0&obs_epoch=2000.0&ra=17h45m40.036s&dec=-29d00m28.17s&pa=0.0&out_csys=Galactic&out_equinox=J2000.0


Westmeier, Tobias.   "Conversion of coordinates"  Homepage of Tobias Westmeier.  The University of Western Australia.  Last Modified 26 September 2023.   Accessed November 26, 2023.   https://www.atnf.csiro.au/people/Tobias.Westmeier/index.php




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. 


TI 30Xa Algorithms: Greatest Common Divisor

TI 30Xa Algorithms: Greatest Common Divisor To find the greatest common divisor between two positive integers U and V: Let U ≥ V. ...