ToolKitP2

Description

BerekP
J E Patterson - jepspectro.com - Version 20250408

BerekP

A Berek Compensator can be inserted into the compensation slot just above the objective turret of a Polarising Microscope.
When calibrated the Berek Compensator can be used to measure the optical retardation of samples.

This program uses measurements taken with stacks of standard compensating plates to provide a calibration over a wide range.
In my case I used 3 mica plates each with 147.3 nm retardation and 3 gypsum plates each with 530 nm retardation.

The Berek compensator tilts a gypsum or magnesium fluoride plate.
This creates a range of thicknesses equivalent to several orders of optical retardation.
The corresponding interference colours are produced when the Berek compensator is inserted between crossed polars.
The plate can be tilted either way for the same retardation.
There is a tilt scale from marked 0 to 60 in degree intervals.
Two scale readings are obtained.

Let R1 = reading 1 and R2 = reading 2. The tilt angle X = (R1 - R2)/2.

I calibrated the Berek Compensator using combinations of the 147.3 nm and the 530 nm compensating plates.
A compensating plate was oriented at 45 degrees from extinction on the stage.
There were two tilt readings where the field of view went dark in cross polarized light.
Tilt reading differences were plotted against the total plate retardation, as the plates were stacked in combinations on the stage set at 45 degrees.
The smallest retardation was 147.3 nm while the largest retardation measured was (147.3 x 2) + (530 x 3) = 1885 nm.

There was a good fit to a power curve:

Y = 2.64 * X1.9853

where X = tilt angle reading and Y = retardation wavelength in nm.

With the Berek compensator I can now measure retardations from near zero to about 1885 nm.

Enter an angle of tilt X GSB A
The optical retardation Y in nm is displayed.



HgCalP
J E Patterson - jepspectro.com - version 20250408

Mercury Vapour Calibration

Elemental mercury vapour in air: The origins and validation of the 'Dumarey equation' describing the mass concentration at saturation

The concentration of mercury vapour in air, above liquid mercury, depends on the temperature.
A good calibration curve can be obtained using a simplified Dumarey equation.
Reference: R. Dumarey, E. Temmerman, R. Dams, J. Hoste, Analyt. Chim. Acta 170, 337 (1985).

Enter temperature T in °C of the mercury calibration vessel.
T GSB B
The mercury vapour concentration in the calibration vessel is displayed in ng/ml

The equation is Hg ng/ml = 10(-3229/(T+273.15)+14.6 - Log(T +273.15)).
At 20°C mercury saturated air has a mercury concentration of 13.12 ng/ml



RGCalP
J E Patterson - jepspectro.com - version 20151017

Rain Gauge Calibration

The calibration is in mm per bucket tip, given the number of bucket tips, the diameter of funnel in mm and the calibration volume of water in ml.

Water volume in ml ENTER
Number of tips ENTER
Diameter of funnel in mm GSB C
mm per tip is displayed.

A tipping bucket rain-gauge has a funnel diameter of 79 mm.
200 ml of slowly added water generates 81 tips.

200 ENTER
81 ENTER
79 GSB C

The result is x = 0.50 mm of rain per tip.



ResistanceP
J E Patterson - jepspectro.com - 20151003

Parallel Resistances

First resistance, ENTER, second resistance
GSB D for parallel resistance result

R/S to recall first resistance
New second resistance R/S for a new result

Repeat



PricingP
J E Patterson - jepspectro.com - version 20250498.

Calculate the Price of a Product

Margin % ENTER
Costs $ ENTER
Hours ENTER
Hourly Rate $ GSB E
The result is the calculated price of a product.
The result, with NZ GST added, is in the y register.



InductanceP
J E Patterson - jepspectro.com - 20231119

Description
This program calculates the inductance L (μH) of a coil using a 50 ohm output signal generator and an oscilloscope.
See A Simple Method to Measure Unknown Inductors by Ronald Dekker.
This version accounts for inductor resistance using a modified equation by Karen Orton.

The signal generator output amplitude is first measured at about 20 kHz using an oscilloscope.
The unknown inductor is then connected across the signal generator output.
The frequency f (kHz) is adjusted until the oscilloscope shows a reading of half the original amplitude.

On a digital oscilloscope I prefer to take rms readings as they are more stable than peak to peak readings.

The equation is quite simple: L =1000*√(21.11 + 0.84R - 0.025R2)/f.
If R is close to zero ohms the equation reduces to L = 4594/f.

R (ohms) ENTER
f (kHz) GSB 0
The result is L (μH)

f is the frequency where the signal amplitude is halved when the inductance is bridged across the connection to a 50 ohm signal generator.

For best accuracy remove the inductor when the signal is at half-amplitude.
Adjust the signal generator to the previous (convenient) full-amplitude value.
Replace the inductor and trim the frequency until the half-amplitude setting is found.
Use this frequency to calculate L.

The best measurement for R should subtract the resistance of the meter leads when they are shorted together.



Stat5P
Linear, logarithmic, power and exponential regressions - J E Patterson

This program provides linear, logarithmic, power and exponential regressions with a single entry of a data set.

This program is an adaptation of software I wrote for a personal computer in 1984.
For most statistical work a personal computer is best, but this program is good for a first look at experimental data.

Introduction:

Entered numbers should be positive.
Enter 1 EEX 9 CHS in place of zero.

For linear regressions the built-in HP-15 linear-regression function can be used if a wider number range is required.
The most recent data pair can be deleted with GSB .6.
The statistics counter n is also decremented by 1.

GSB 9 - zeros registers and clears flag 1.
If there is an obvious inverse relationship between x and y press GSB .7 which sets flag 1 to 1. This inverts any x data entered.

y ENTER x GSB 1
Repeat to enter more data.

Note: y is entered first, then x, as in the built in linear regression function.

GSB 2 for linear regression y = ax+b
GSB 3 for logarithmic regression y = a ln(x) + b
GSB 4 for power regression y = xa * b
GSB 5 for exponential regression y = eax * b

On pressing any of these keys b is first displayed, then a and finally the correlation coefficient r is left in the display.

x' R/S displays a y' estimate.

GSB 2, 3, 4, and 5 can be repeated at any time without entering new data.


Example:

y = 2, 4, 5, 6
x = 2, 5, 8, 13

GSB 6 to clear registers
2 ENTER 2 GSB 1
4 ENTER 5 GSB 1
5 ENTER 8 GSB 1
6 ENTER 1 3 GSB 1

GSB 2
Linear regression y = ax+b
b = 1.8106
a = 0.3485
r = 0.9571

GSB 3
Logarithmic regression y = a ln(x) + b
b = 0.5318
a = 2.1409
r = 0.9999

GSB 4
Power regression y = xa * b
b = 1.4005
a = 0.5950
r = 0.9870

GSB 5
Exponential regression y = eax * b
b = 2.0563
a = 0.0928
r = 0.9048

Clearly a logarithmic fit to the data is reasonable because the correlation coefficient r is closest to 1.
Once r is displayed x' can be entered to estimate y'
Note that a can also be recovered with RCL . 1 and b with RCL . 0.

5 R/S displays 3.9774 as the y' estimate instead of the original y entry of 4.
Repeat for more values of x'. This applies for all regression models.
Note that even with r = 0.9999 the fit is not quite perfect. To 6 places r = 0.999911.

It is easy to compare different regression models.
Just enter GSB 2 to GSB 5 as often as required to show b, a and r for the different regression models and then enter x' R/S to estimate y'.

Test data sets

Linear y = ax+b
y = 7, 9, 11, 13
x = 1, 2, 3, 4
b = 5.0000
a = 2.0000
r = 1.0000
3 R/S displays 11.0000


Logarithmic y = a ln(x) + b
y = 5, 6.3863, 7.1972, 7.7726
x = 1, 2, 3, 4
b = 5.0000
a = 2.0000
r = 1.0000
3 R/S displays 7.1972.


Power y = xa * b
y = 5, 20, 45, 80
x = 1, 2, 3, 4
b = 5.0000
a = 2.0000
r = 1.0000
3 R/S displays 45.0000.


Exponential y = eax * b
y = 36.9453, 272.9908, 2017.1440, 14904.7899
x = 1, 2, 3, 4
b = 5.0000
a = 2.0000
r = 1.0000
3 R/S displays 2017.1442.


Time Value of Money

(See https://www.hpmuseum.org/forum/thread-385.html}

1. Store 4 of the following 5 variables, using appropriate cash flow conventions as follows:

n STO 1 --- Number of compounding periods
i STO 2 --- Interest rate (periodic) expressed as a %
PV STO 3 --- Present Value
PMT STO 4 --- Periodic Payment
FV STO 5 --- Future Value

Store the appropriate value (1 for Annuity Due or 0 for Regular Annuity) as
B/E STO 6 --- Begin/End Mode. The default is 0 for regular annuity or End Mode.

2. Store the register number X containing the floating variable to the indirect storage register as X STO I.

3. f SOLVE 7


BMI Index

Enter weight in kilograms.
ENTER
Enter height in cm.
GSB 8

The Body Mass Index (BMI) is displayed.


Little Gauss

Enter a number N.
GSB 9
The sum of all the digits up to N is displayed.

Program Resources

Labels

Name Description Name Description Name Description
 A BerekP  3 Logarithmic regression y - a*ln(x)+b .1 Power or exponential regression subroutine
 B HgCalP  4 Power regression y = x^a*b .2 Linear estimate y' from x' loop
 C RGCalP  5 Exponential regression y = e^a(x)*b .3 Logarithmic estimate y' from x' loop
 D ResistanceP  6 Clear Registers and Clear x and y .4 Power estimate y' from x' loop
 E PricingP  7 Time Value of Money .5 Exponential estimate y' from x' loop
 0 InductanceP  8 BMI calculation .6 Delete most recent data pair, decrement n
 1 StatP  9 Little Gauss formula to sum digits .7 Set flag 1 to 1
 2 Linear regression y= a(x)+b .0 Linear or logarithmic regression subroutine

Storage Registers

Name Description Name Description Name Description
 0 ∑x  7 ∑xy " .4 ∑lny
 1 ∑y, Kelvin Temperature, Resistance Sum  8 ∑x^2 .5 ∑(lnx)^2
 2 n, Hg (ng/l), First Resistance  9 ∑y^2 .6 ∑(lny)^2
 3 ∑y^2" copied from appropriate registers .0 x temporary storage .7 ∑((lnx) * (Lny))
 4 ∑x^2 " .1 y temporary storage .8 ∑(x * lny)
 5 ∑y" .2 ∑xy .9 ∑(lnx *y)
 6 ∑y^2 ", B/E = 0 or 1 default 0 .3 ∑lnx (i) TVM required variable register number

Flags

Number Description
1 Flag 1 set to 1 inverts any x data entered.

Program

Line Display Key Sequence Line Display Key Sequence Line Display Key Sequence
000 125 43 12 g LN 250 42 31 f PSE
001 42,21,11 f LBL A 126 44,40, .5 STO + . 5 251 1 1
002 1 1 127 43 11 g 252 42 48 f ŷ,r
003 48 . 128 44,40, .6 STO + . 6 253 43 35 g CLx
004 9 9 129 45 .0 RCL . 0 254 33 R⬇
005 8 8 130 44,40, 0 STO + 0 255 43 32 g RTN
006 5 5 131 43 11 g 256 42,21, .1 f LBL . 1
007 3 3 132 44,40, 1 STO + 1 257 42 49 f L.R.
008 14 133 11 √x̅ 258 12
009 2 2 134 43 12 g LN 259 44 .0 STO . 0
010 48 . 135 44,40, .3 STO + . 3 260 42 31 f PSE
011 6 6 136 43 11 g 261 34 x↔y
012 4 4 137 44,40, .4 STO + . 4 262 44 .1 STO . 1
013 20 × 138 45 .0 RCL . 0 263 42 31 f PSE
014 43 32 g RTN 139 45 .1 RCL . 1 264 1 1
015 42,21,12 f LBL B 140 20 × 265 42 48 f ŷ,r
016 2 2 141 44,40, .2 STO + . 2 266 43 35 g CLx
017 7 7 142 45 .0 RCL . 0 267 33 R⬇
018 3 3 143 45 .1 RCL . 1 268 43 32 g RTN
019 48 . 144 43 12 g LN 269 42,21, .6 f LBL . 6
020 1 1 145 20 × 270 45 .1 RCL . 1
021 5 5 146 44,40, .8 STO + . 8 271 44,30, 8 STO 8
022 40 + 147 45 .0 RCL . 0 272 43 11 g
023 44 1 STO 1 148 43 12 g LN 273 44,30, 9 STO 9
024 3 3 149 45 .1 RCL . 1 274 11 √x̅
025 2 2 150 20 × 275 43 12 g LN
026 2 2 151 44,40, .9 STO + . 9 276 44,30, .5 STO . 5
027 9 9 152 45 .0 RCL . 0 277 43 11 g
028 16 CHS 153 43 12 g LN 278 44,30, .6 STO . 6
029 45,10, 1 RCL ÷ 1 154 45 .1 RCL . 1 279 45 .0 RCL . 0
030 1 1 155 43 12 g LN 280 44,30, 0 STO 0
031 4 4 156 20 × 281 43 11 g
032 48 . 157 44,40, .7 STO + . 7 282 44,30, 1 STO 1
033 6 6 158 1 1 283 11 √x̅
034 40 + 159 44,40, 2 STO + 2 284 43 12 g LN
035 45 1 RCL 1 160 45 2 RCL 2 285 44,30, .3 STO . 3
036 43 13 g LOG 161 43 32 g RTN 286 43 11 g
037 30 162 42,21, 2 f LBL 2 287 44,30, .4 STO . 4
038 13 10ˣ 163 45 0 RCL 0 288 45 .0 RCL . 0
039 44 2 STO 2 164 44 3 STO 3 289 45 .1 RCL . 1
040 43 32 g RTN 165 45 8 RCL 8 290 20 ×
041 42,21,13 f LBL C 166 44 5 STO 5 291 44,30, .2 STO . 2
042 2 2 167 45 1 RCL 1 292 45 .0 RCL . 0
043 10 ÷ 168 44 4 STO 4 293 45 .1 RCL . 1
044 36 ENTER 169 45 9 RCL 9 294 43 12 g LN
045 20 × 170 44 6 STO 6 295 20 ×
046 43 26 g π 171 45 .2 RCL . 2 296 44,30, .8 STO . 8
047 20 × 172 44 7 STO 7 297 45 .0 RCL . 0
048 20 × 173 32 .0 GSB . 0 298 43 12 g LN
049 10 ÷ 174 42,21, .2 f LBL . 2 299 45 .1 RCL . 1
050 26 EEX 175 31 R/S 300 20 ×
051 3 3 176 45 .1 RCL . 1 301 44,30, .9 STO . 9
052 20 × 177 20 × 302 45 .0 RCL . 0
053 43 32 g RTN 178 45 .0 RCL . 0 303 43 12 g LN
054 42,21,14 f LBL D 179 40 + 304 45 .1 RCL . 1
055 44 1 STO 1 180 22 .2 GTO . 2 305 43 12 g LN
056 33 R⬇ 181 43 32 g RTN 306 20 ×
057 44 2 STO 2 182 42,21, 3 f LBL 3 307 44,30, .7 STO . 7
058 44,40, 1 STO + 1 183 45 .3 RCL . 3 308 1 1
059 43 33 g R⬆ 184 44 3 STO 3 309 44,30, 2 STO 2
060 20 × 185 45 .4 RCL . 4 310 45 2 RCL 2
061 45,10, 1 RCL ÷ 1 186 44 4 STO 4 311 43 32 g RTN
062 31 R/S 187 45 8 RCL 8 312 42,21, .7 f LBL . 7
063 45 2 RCL 2 188 44 5 STO 5 313 43, 4, 1 g SF 1
064 31 R/S 189 45 9 RCL 9 314 43 32 g RTN
065 22 14 GTO D 190 44 6 STO 6 315 42,21, 6 f LBL 6
066 43 32 g RTN 191 45 .9 RCL . 9 316 42 34 f REG
067 42,21,15 f LBL E 192 44 7 STO 7 317 43 35 g CLx
068 20 × 193 32 .0 GSB . 0 318 36 ENTER
069 40 + 194 42,21, .3 f LBL . 3 319 43 32 g RTN
070 34 x↔y 195 31 R/S 320 42,21, 7 f LBL 7
071 1 1 196 43 12 g LN 321 44 24 STO (i)
072 34 x↔y 197 45 .1 RCL . 1 322 45 2 RCL 2
073 43 14 g % 198 20 × 323 26 EEX
074 30 199 45 .0 RCL . 0 324 2 2
075 10 ÷ 200 40 + 325 10 ÷
076 36 ENTER 201 22 .3 GTO . 3 326 36 ENTER
077 36 ENTER 202 43 32 g RTN 327 36 ENTER
078 1 1 203 42,21, 4 f LBL 4 328 1 1
079 5 5 204 45 .3 RCL . 3 329 40 +
080 43 14 g % 205 44 3 STO 3 330 43 12 g LN
081 40 + 206 45 .5 RCL . 5 331 34 x↔y
082 34 x↔y 207 44 5 STO 5 332 43 36 g LSTΧ
083 43 32 g RTN 208 45 .4 RCL . 4 333 1 1
084 42,21, 0 f LBL 0 209 44 4 STO 4 334 43,30, 6 g TEST x≠y
085 44 2 STO 2 210 45 .6 RCL . 6 335 30
086 34 x↔y 211 44 6 STO 6 336 10 ÷
087 44 1 STO 1 212 45 .7 RCL . 7 337 20 ×
088 2 2 213 44 7 STO 7 338 45,20, 1 RCL × 1
089 1 1 214 32 .1 GSB . 1 339 36 ENTER
090 48 . 215 42,21, .4 f LBL . 4 340 12
091 1 1 216 31 R/S 341 45,20, 3 RCL × 3
092 1 1 217 45 .1 RCL . 1 342 34 x↔y
093 36 ENTER 218 14 343 2 2
094 48 . 219 45 .0 RCL . 0 344 10 ÷
095 8 8 220 20 × 345 42,22,23 f HYP SIN
096 4 4 221 22 .4 GTO . 4 346 43 36 g LSTΧ
097 45 1 RCL 1 222 43 32 g RTN 347 12
098 20 × 223 42,21, 5 f LBL 5 348 20 ×
099 40 + 224 45 0 RCL 0 349 2 2
100 48 . 225 44 3 STO 3 350 20 ×
101 0 0 226 45 .5 RCL . 5 351 45,20, 4 RCL × 4
102 2 2 227 44 5 STO 5 352 26 EEX
103 5 5 228 45 1 RCL 1 353 2 2
104 45 1 RCL 1 229 44 4 STO 4 354 45,10, 2 RCL ÷ 2
105 43 11 g 230 45 .6 RCL . 6 355 45,40, 6 RCL + 6
106 20 × 231 44 6 STO 6 356 20 ×
107 30 232 45 .8 RCL . 8 357 40 +
108 11 √x̅ 233 44 7 STO 7 358 45,40, 5 RCL + 5
109 26 EEX 234 32 .1 GSB . 1 359 43 32 g RTN
110 3 3 235 42,21, .5 f LBL . 5 360 42,21, 8 f LBL 8
111 20 × 236 31 R/S 361 26 EEX
112 45 2 RCL 2 237 45 .1 RCL . 1 362 2 2
113 10 ÷ 238 20 × 363 10 ÷
114 43 32 g RTN 239 12 364 43 11 g
115 42,21, 1 f LBL 1 240 45 .0 RCL . 0 365 10 ÷
116 43, 6, 1 g F? 1 241 20 × 366 43 32 g RTN
117 15 1/x 242 22 .5 GTO . 5 367 42,21, 9 f LBL 9
118 44 .0 STO . 0 243 43 32 g RTN 368 43 11 g
119 34 x↔y 244 42,21, .0 f LBL . 0 369 43 36 g LSTΧ
120 44 .1 STO . 1 245 42 49 f L.R. 370 40 +
121 44,40, 8 STO + 8 246 44 .0 STO . 0 371 2 2
122 43 11 g 247 42 31 f PSE 372 10 ÷
123 44,40, 9 STO + 9 248 34 x↔y 373 43 32 g RTN
124 11 √x̅ 249 44 .1 STO . 1