BASIC programs for the evaluation of wavenumbers and for solving

BASIC programs for the evaluation of wavenumbers and for solving polynomials. K. Janardhanam, and S. V. J. Lakshman. J. Chem. Inf. Comput. Sci. , 1992...
0 downloads 0 Views 287KB Size
369

J. Chem. In$ Comput, Sci. 1992,32,369-372

BASIC Programs for the Evaluation of Wavenumbers and for Solving Polynomials K. Janardhanam and

S.V. J. Lakshman'

Sri Venkateswara University, Tirupati 5 17502, India Received February 26, 1992 BASIC programs useful for the conversion of wavelengths intovacuum wavenumbers and for solving polynomials are presented. The latest (1972) dispersion formula of Peck and Reeder for the refractive index of air is used in the evaluation of the wavenumbers. In both programs, the Birge-Vieta method is used for solving the polynomials. INTRODUCTION In all spectroscopic work, the measured wavelengths of the

observedspectral lines or bands must be converted into vacuum wavenumbers for the evaluation of spectroscopicparameters. For the conversion of wavelengths into vacuum wavenumbers, Kayser's' tables were used in earlier days and NBS wavenumber tablesZmore recently. Wavenumbers are evaluated using the relation Y = l/nX, where Y is the wavenumber, X is the wavelength, and n is the refractive index of air at that particular wavelength. In the preparation of the NBS wavenumber tables, Coleman et al. used the following formula by Edlen3 for the

correction of the refractive index of air:

n = 1 + 6432.8 X

lo-* +

2949810 1 4 6 X 108-v2

140 150 160 170 180 190 2 00 210 220 2 30 240 250 260 270 280 2 90 300 310 32 0 330 34 0 35 0 360 370 380 390

(1)

REM CALN OF WAVENUMBER DIM A(5) , M(5) , R ( 5 ) INPUT "W .LENGTH=" ;X Y=X/lOOO A (1) =-1.000272608 A(2)=-3.298622625/YA2 A(3) =3 .299368771/YA2 A ( 4 ) =1 .922234267/Yn4 A ( 5 ) = - 1 , 9223892O8/YA4 G= 1

M= 1 M(l)=G+A(l) R (1) =1 FOR K=2 TO 5 M ( K ) = A ( K ) + M ( K - l ) *G R ( K ) = M ( K - l ) +R(K-l) *G NEXT K I F ABS ( R ( 5 ) ) > O . 0001 THEN 300 G=G+O , 1 GOTO 210 H=G-M (5) /R (5) I F ABS (H-G)20 THEN 360

M=M+1 G=H GOTO 2 1 0 PRINT "FAILS TO CONVERGE" GOTO 400 2=100000/(H*Y) PRINT "WAVENUM=" ;2

4 00 GOTO 1 2 0

Note:

25 540 41 X 108-v2

where Y is the wavenumber (in cm-1). In the early days when computer time was very expensive, it was necessary to consult the large volumes of NBS wavenumber tables for the conversion of wavelengths into wavenumbers. Now, any scientist can afford to buy a reasonablypriced pocket computer and use it for computational work such as the evaluation of wavenumbers.

Table I. BASIC Program for Evaluation of Wavenumbers 100 110 120 130

+

1 . The DIM s t a t e m e n t i n l i n e number 1 1 0 is t o f o r p o c k e t c o m p u t e r s l i k e CAS10 PB 1 1 0 .

be

2 . Wavelength X i s t o b e f e d i n A n g s t r o m s ,

009S-2338/92/1632-0369$03.00/0 Q 1992 American Chemical Society

deleted

370 J. Chem. Inf. Comput. Sci., Vol. 32, No. 4, 1992

JANARDHANAM AND LAUSHMAN

Table 11. Comparison of Wavenumbers (in cm-I) Calculated Using Euuations '3 and I* wavewavewavewavewavewavenumber number number number usingeq 3 using eq 1 usingeq 3 usinaw 1 2100 2200 2300 2400 2500 2600 2700 2800 2900 3000 3100 3200 3300 3400 3500 3600 3700 3800 3900 4000 4100 4200 4300 4400 4500 4600 4700 4800 4900 5000 5100 5200 5300 5400 5500 5600 5700 5800 5900 6000 6100 6200 6300 6400 6500 a

47 603.9372 45 440.3586 43 464.8753 41 653.9860 39 987.9460 38 450.0464 37 026.0525 35 703.7624 34 472.6566 33 323.6180 32 248.7057 31 240.9709 30 294.3073 29 403.3267 28 563.2567 27 769.8550 27 019.3380 26 308.3202 25 633.7635 24 992.9334 24 383.3623 23 802.8174 23 249.2738 22 720.8905 22 215.9903 21 733.0417 21 270.6436 20827.5117 20 402.4663 19 994.4224 19 602.3799 19 225.4157 18 862.6763 18 513.3714 18 176.7683 17 852.1866 17 538.9934 17 236.5999 16 944.4569 16 662.0518 16 388.9058 16 124.5709 15 868.6274 15 620.6820 15 380.3657

47 603.9373 45 440.3590 43 464.8758 41 653.9865 39 987.9464 38 450.0467 37 026.0527 35 703.7625 34 472.6566 33 323.6180 32 248.7056 31 240.9708 30 294.3071 29 403.3265 28 563.2565 27 769.8548 27 019.3378 26 308.3201 25 633.7634 24 992.9333 24 383.3621 23 802.8173 23 249.2736 22 720.8904 22 215.9902 21 733.0416 21 270.6435 20827.5116 20 402.4662 19 994.4224 19 602.3799 19 225.4156 18 862.6762 18 513.3714 18 176.7683 17 852.1865 17 538.9934 17 236.5999 16 944.4569 16 662.0518 16 388.9058 16 124.5708 15 868.6274 15 620.6820 15 380.3657

6600 6700 6800 6900 7000 7100 7200 7300 7400 7500 7600 7700 7800 7900 8000 8100 8200 8300 8400 8500 8600 8700 8800 8900 9000 9100 9200 9300 9400 9500 9600 9700 9800 9900 10000 1 1000 12000 13000 14000 15000 16000 17000 18000 19000 20000

15 147.3316 14 921.2536 14 701.8249 14 488.7564 14 281.7755 14 080.6250 13 885.0620 13 694.8568 13 509.7923 13 329.6627 13 154.2734 12 983.4396 12 816.9861 12 654.7466 12 496.5630 12 342.2852 12 191.7703 12 044.8821 1 1 901.4913 1 1 761.4744 1 1 624.7136 1 1 491.0968 1 1 360.5167 1 1 232.8709 1 1 108.0618 10 985.9956 10 866.5830 10 749.7385 10 635.3800 10 523.4290 10413.8103 10 306.4518 10 201.2843 10 098.2413 9997.2592 9088.4199 8331.0533 7690.2043 7140.9049 6664.8452 6248.2929 5880.7467 5554.0389 5261.7213 4998.6354

15 147.3315 14 921.2536 14 701.8249 14 488.7564 14 281.7755 14 080.6251 13 885.0620 13 694.8568 13 509.7923 13 329.6627 13 154.2734 12 983.4396 12 816.9861 12 654.7466 12 496.5631 12 342.2853 12 191.7703 12 044.8822 1 1 901.4914 1 1 761.4744 1 1 624.7137 1 1 491.0968 1 1 360.5167 1 1 232.8710 1 1 108.0618 10 985.9956 10 866.5831 10 749.7385 10 635.3800 10 523.4290 10413.8104 10 306.4519 10 201.2843 10 098.2414 9997.2593 9088.4200 8331.0534 7690.2043 7140.9049 6664.8453 6248.2930 5880.7467 5554.0389 5261.7213 4998.6355

Taking into account the dependence of refractive index on water vapor, carbon dioxide, pressure, and temperature of the medium of propagation of light, Edlen4 suggested that in the wavelength region of 6440-3985 A, the refractive index (n) and wavenumber (v in cm-l) are better represented by the formula

n = 1 + 8342.13 X lo-'+

2406030 130 X 10' - v2

+

15 997 38.9 X lo8 - v2 (2)

Peck and ReederS suggested that the following dispersion formula can better fit experimental results from the far infrared region down to 1850 A:

+ 8060.51 X

It is convenient to write eq 3 as n = A + - + BC-vz

D E-vz

(4)

where A=1

+ 8060.51 X lo4

B = 2 480 990 C = 132.274 X 10'

D = 17 455.7

E = 39.329 57 X lo8 Substituting v = l/nX in eq 4 and writing the equation in the form of a polynomial, we obtain

+

+

ns A( i)n4 + ~ ( 2 +)~ (~3 ) ~n ' ~ ( 4 ) n+ 4 5 ) = o ( 5 ) where

+ BE + DC)/CE 4 2 ) = -(c + E ) / ( c E x ~ ) A(3) = ( B + D + AE + AC)/(CEXz) A(l) = -(ACE

A(5) = -A/(CEX4)

Substituting the values of A, B, C, D and E in the above expressions, we obtain A( 1) = -1 .OOO 272 608

4 2 ) = -3.298 622 625 X 10-'o/X2

This paper. Ref 2.

n=1

COMPUTATIONAL PROCEDURE

+

2480990 132.274 X lo8- v2 17 455.7 (3) 39.329 57 X lo8 - v2 +

where n is the refractive index and Y is the wavenumber (in cm-I) .

4 3 ) = 3.299 368 771

X

10-10/X2

4 4 ) = 1.922 234 267 X 10-20/X4 4 5 ) = -1.922 389 208 X 10-20/X4

Equation 5 is then solved by the Birge-%eta6 method to get the value of n for a given wavelength A. PROGRAM FOR EVALUATION OF WAVENUMBERS Srinvivas and Lakshman' have provided a BASIC program useful for conversion of any wavelength into its wavenumber in about 30 s. But this program is suitable for computers with large RAM area and which have provision for DIM (DIMENSION) statement. Moreover, they have made use of the old formula of Edlen, Le., eq 1 . This paper presents a revised program making use of the latest dispersion formula of Peck and Reeder, Le., eq 3. The number of iterations is set as 20, and the limit of accuracy is fixed at 0.0001. The BASIC program written is given in Table I. The computation time for the calculation of wavenumber for a

J. Chem. In& Comput. Sci., Vol. 32, No. 4, 1992 371

BASIC PROGRAMS Table 111. BASIC Program for Solving Polynomials 1 0 0 REM CALN OF ROOTS OF A POLYNOMIAL 1 0 5 DEFM2 110 INPUT "ORDER OF POLY=";A 120 DIM A ( A ) , M(A> , R(A) , W(A) 140 FOR I=1 TO A 1 5 0 INPUT "COEF=";A(I) 160 NEXT I 170 FOR J=1 T O A-1 180 L=A+l-J 190 G= 1 2 00 M= 1 210 M ( l ) = G + A ( l ) 220 R (1) =1 2 30 FOR K=2 T O L 240 M (K) =A (K) +M (K-1) *G 250 R ( K ) = M ( K - l ) + R ( K - l ) * G 260 NEXT K 270 I F ABS ( R ( L ) ) > O , 0 0 0 1 THEN 300 2 80 G=G+O, 1 2 90 GOTO 210 300 H=G-M (L) /R (L) 310 I F ABS (H-G)20 THEN 360 330 M=M+1 34 0 G= H 35 0 GOTO 210 360 PRINT "FAILS TO CONVERGE" 370 GOTO 470 380 W (J)=H 390 FOR K = l TO L-1 400 A (K) =M (K) 410 NEXT K 420 NEXT J 4 30 W (A) =-A (1) 440 FOR J=1 TO A 450 PRINT "ROOT (" ;J ; ") = I ' ;W (J) 4 60 NEXT J 470 GOTO 1 1 0 Note:

1 . The D I M s t a t e m e n t i n l i n e number 120 i s t o f o r p o c k e t c o m p u t e r s l i k e CASIO PB 110.

be

deleted

2 , The DEFM s t a t e m e n t i n l i n e number 105 i s t o be d e l e t e d f o r c o m p u t e r s l i k e SHARP EL-5500 111, b u t i s n e c e s s a r y f o r c o m p u t e r s l i k e CASIO PB 1 1 0 t o e x p a n d t h e number of variables r e q u i r e d f o r s o l v i n g 4 t h and 5 t h o r d e r polynomials, For s o l v i n g h i g h e r o r d e r polynomials, t h e number of v a r i a b l e s s h o u l d be f u r t h e r e x p a n d e d a n d a p p r o p r i a t e v a r i a b l e names a r e t o be u s e d .

given wavelength is found to be about 4 s. As an example, let us calculate the wavenumber for the wavelength of 2500 A. When the computer asks for 'W.LENGTH', we key in 2500. After a lapse of 4 s, we get the value of the wavenumber (in cm-l) as 39 987.9460. The wavenumbers evaluated for a few wavelengths are presented in Table 11. As is seen, the present wavenumber values are found to widely vary in the fourth decimal place as compared to the values given by Coleman in the shorter wavelength region than in the longer wavelength region. PROGRAM FOR SOLVING POLYNOMIALS As the calculation of the value of n is nothing but solving a fifth-order polynomial, the same program with some modifications can be used for finding the real roots of a polynomial of any order. This program is given in Table 111. It can give the roots of second- or third-order polynomials in less than 3 s while it takes about 20 s for solving a polynomial of the fifth order. The same program can be used to solve polynomials of higher order by suitably expandingthe number

of variables in the pocket computer and using the appropriate variable names. A polynomial of nth order is written as

X" + A(~)x"-'+ A ( ~ ) X " ... - ~+ ~ ( n - 1 + ) ~A ( n ) = o The coefficients A( 1)-A(n) are to be fed to the computer to obtain the n roots of the polynomial. As an example, let us consider the fifth-order polynomial:

+

+

X 5 - 4 9 - 13X3 52X2 36X- 144 = 0 When the computer asks for the order of the polynomial, we key in '5'. When it asks next for the coefficients, we key in the values of the coefficients in the following sequence: -4 -1 3

52

36 -144

372 J. Chem. In$ Comput. Sci., Vol. 32, No. 4, 1992

After a lapse of about 20 s, the five roots of the polynomial are displayed as follows:

ROOT (1) = 2.oooO R O O T ( 2 ) = 4.oooO

ROOT (3)

-3.oooO

R O O T ( 4 ) - 3.oooO ROOT ( 5 ) = -2.oooO

CONCLUSION Severalcomputations like those above were made on pocket computers like Sharp EL-5500111, Casio PB 110, and Casio 720-P,and the results on all of them have been found quite satisfactory.

JANARDHANAM AND LAKSHMAN ACKNOWLEDGMENT We express our grateful thanks to Dr.G. W. A. Milne for bringing to light the latest work on the refractive index of air. REFERENCES AND NOTES (1) Kayser, H. Tabelle der Schwingungszahlen; Meggen, W. F.,Ed.; Ed-

wards Brothers, Inc.: Ann Arbor, MI, 1944. (2) Coleman, C. D.; Bozman, W. R.; Meggers, W. F. Tableof Wavenumbers, Vols. I and II; National Bureau of Standards: Washington, DC, 1960; Monograph 3. (3) Edlen, B. The Dispersion of Standard Air. J . Opt. Soc. Am. 1%3,43, 339-344. (4) Edlen, B. The Refractive Index of Air. Merrologia 1966, 2, 71-80. (5) Peck, E. R.; Reeder, K. Dispersion of Air. J. Opt. Soc. Am. 1972,62, 958-962. (6) Kunz, K. S. Numerical Analysis; McGraw-Hill Book Co.: New York, 1957. (7) Srinivas, S.; Lakshman, S. V. J. BASIC Program for Evaluation of Wavenumbers from Wavelengths. Inr. Lab. 1989,14 (May/June), 1 4 16. Also Am. Lab. 1988, 23 (Sept), 23-25.