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