Random sampling of an AC source: A tool to teach probabilistic observations Arvind,∗ Paramdeep Singh Chandi,† and R. C. Singh‡ Department of Physics, Guru Nanak Dev University, Amritsar 143005 India D. Indumathi§ and R. Shankar¶ Institute of Mathematical Sciences, CIT Campus Taramani, Chennai 600113 India An undergraduate level experiment is described to demonstrate the role of probabilistic obser- 3 vations in physics. A capacitor and a DC voltmeter are used to randomly sample an AC voltage 0 source. The resulting probability distribution is analyzed to extract information about the AC 0 source. DifferentcharacteristicprobabilitydistributionsarisingfromvariousACwaveformsarecal- 2 culatedandexperimentallymeasured. ThereconstructionoftheACwaveformisdemonstratedfrom the measured probability distribution under certain restricted circumstances. The results are also n comparedwithasimulateddatasample. Weproposethisasapedagogicaltooltoteachprobabilistic a measurements and their manipulations. J 1 PACSnumbers: 01.50.Pa,01.55.+b ] h p I. INTRODUCTION remains. This can be seen by joining the two terminals - ofthecapacitor,wherebyasparkisproduced. Thisvolt- d agecanbemeasuredbyahighimpedanceDCvoltmeter. e Probability is fundamental to physics in more ways TheDCvoltagemeasuredacrossthecapacitoristhenthe s. than one. Probabilistic errors can never be avoided in instantaneousACvoltageoftheoriginalsource. ThisDC c experimental observations,individual particles and their i voltage is the key variable measured in our experiment. s initial conditions cannot be tracked in classical physics, Theexperimentcanberepeatedandadifferentvoltage y and quantum mechanics, which is the best available de- h willbeobtainedeachtime! Iftheobservationisrepeated scription of nature, is intrinsically probabilistic. While p many times, it is indeed a random sampling of the AC thebasicconceptsofprobabilitycanbeintroducednicely [ voltagesource. This randomlysampledvoltagedata can through coin tossing and probability boards1, they re- be used to construct the probability distribution of the 1 main setups in the realm of statistics without a direct voltage. What information about the AC source is con- v connection to the physics laboratory. The pedagogy 2 tained in this probability distribution? We will see that of probability for physics students has received atten- 0 the probability distribution depends upon the type of tion, with many proposals of statistics-oriented experi- 0 AC waveform used. A triangular wave for example, will ments2,3,4,5 and theoretical expositions6,7,8,9, providing 1 give rise to a very different probability distribution as 0 interesting insights. A more physical example of ra- comparedtoasine wave. Furthermore,undercertainre- 3 dioactivedecay,anaturalrandom(quantum)processhas stricted circumstances we can reconstruct the waveform 0 also been used to teach and demonstrate probabilistic from the voltage probability distribution. We explicitly s/ ideas10,11,12,13. However,atypicalphysicslaboratoryre- demonstrate such a reconstruction for the case of a sine c quires more experiments involving probability distribu- i wave. s tions and their manipulation. This paper is an effort in The results presented here are an instructive demon- y thisdirectionwherewedescribeasimplegadgettostudy h the manipulation of probability distributions. stration of the role of probabilistic analysis in physics p experiments. The apparatus is simple and cheap. Ele- : ImagineinsertingtheterminalsofaDCvoltmeterinto mentaryC-programsrunningonanordinaryPCaresuf- v the AC mains outlet. We expect it to display zero be- ficienttoaccomplishthedataanalysis. Thedataanalysis i X cause the DC meter will respond to the average voltage can also be performed using a graph paper, pencil and r which in this case is zero. The DC voltmeter is not de- a pocket calculator. Computer analysis is not essential a signed to be sensitive to changes of voltage which oc- but is instructive and opens up possibilities of playing cur at the frequency (50-60Hz) of a typical AC source. around with various parameters. Therefore, the only information we can get from such a The experiment can be introduced in a physics labo- measurement is the average voltage. ratory course at several different levels. At the lowest How does one measure the instantaneous voltage? We level the data collected by the procedure described in need to “store” this value for long enough that a DC section II can be used to demonstrate the zero mean, voltmeter will be able to read it. One way to do this is maximum and minimum values and the RMS voltage to connect a capacitoracrossthe AC source. The capac- of an AC source. At the next level of the undergrad- itor will get charged; the instantaneous voltage across it uate physics laboratory, the analysis of Sections II, III, willdeterminethe instantaneouschargeonthe capacitor and IV can be used to calculate the voltage probability plates. When the capacitor is disconnected from the cir- distribution for different parameter values and to recon- cuit, the charge and hence the voltage, on the capacitor structthecorrespondingwaveforms. Atamoreadvanced 2 tion of the voltage developed across the capacitor. The measurement proceeds as follows: the switch is kept in placetoensurethattheDCvoltmetershowszerovoltage. (cid:0) ThishappensbecausetheACisoscillatingtoorapidlyfor (cid:0) (cid:0) the DC meter to be able to follow the voltage. Then the (cid:0) switchispressedtodisconnecttheACsourceandatthis S (cid:0) stage the voltmeter shows the instantaneous DC voltage (cid:31)AC (cid:28)(cid:0) (cid:31)DC (cid:28)across the capacitor. The maximum value shown on the C ∼ @ meter is recorded. This voltage is our main observation. V @ The voltage across the capacitor will decay slowly as it (cid:30)(cid:29) @ (cid:30)(cid:29)discharges through the voltmeter. We are not interested @ in this decay. The switch is pressed a second time to @ reconnect the AC source. This completes one measure- @ mentcycle. Torepeatthe observation,atsomestagethe switch is pressed again and the maximum voltage devel- opedacrossthe capacitoris recorded. The experimentis FIG.1: Thecircuitdiagramoftheexperiment. AnACsource repeatedseveraltimesandalistofvoltagesisgenerated. isconnectedtoacapacitor CthroughaswitchSwhichwhen This is our basic data set from which we want to draw pulled disconnects both the terminals of the source from the our conclusions. capacitor. The capacitor voltage is continuously monitored It is useful to have two students recording the data; throughaDCvoltmeterV.Whenthesourceisconnectedthe one presses the switch and the other records the maxi- DC meter shows zero voltage and when the source is discon- mum voltage on the voltmeter. In some voltmeters the nected the DC meter shows a random voltage which decays voltage first rises and then begins to fall. To a good as the capacitor begins to discharge through the voltmeter. approximation we take the maximum voltage to be the instantaneousvoltageacrossthecapacitor. Anidealvolt- level,thestatisticalanalysisofsectionVandsimulations meterwillnothavethisproblem;however,noinstrument can be carried out with the help of computer programs isidealsothereis alwaysafinite measurementtime over (availableinNumericalRecipes14)tobringoutthequan- which the voltage across the voltmeter builds up from titative statistical aspects of the experiment. zero. To accurately measure the voltage across the ca- pacitoris aninteresting exercisein itself; the best wayis The material in this paper is arranged as follows. In toactuallymeasurethechargeaccumulatedonthecapac- section II we describe the experimental apparatus. Sec- itorusing asensitivedevice like aballistic galvanometer. tionIII providesatheoreticalanalysisofprobabilitydis- Itwillbeinterestingtodevelopnewerinstrumentswhich tributions arising from a random sampling of voltages canbeusedinundergraduatelaboratoriesandwhichcan andwaveformreconstructionfromsuchaprobabilitydis- measurechargetoagoodaccuracy. However,forourex- tribution. Section IV describes the experimental mea- perimentsuchprecise measurementof voltageacrossthe surement with AC waveform and the data analysis. In capacitor is not required. We now turn to the theoret- SectionVwecomparetheresultsofourexperimentswith ical analysis of random sampling and probability distri- data obtained from a simulation. The C-program used butions. for the data analysis in Section IV is provided in the Appendix . Section VI contains a short discussion and conclusions. III. THEORY II. EXPERIMENTAL SETUP Consider a time-dependent observable quantity, say a voltagef(t). IfwemeasurethisvoltageN randomtimes in an interval, 0<t<T,we can determine the distribu- The experimentalsetup consists ofa capacitor,a volt- tionfunctionn(V),thenumberoftimesthemeasurement meter,anACsourceandadoublepoleswitch. Thevolt- off resultsinavaluebetweenV andV+∆V. Wedenote meter is connected across the capacitor which is in turn the corresponding probability distribution of values of f connected to the source through the switch. The switch by P(V), when pressed disconnects the source from the capacitor. Atthis instantthecapacitorbeginstodischargethrough the voltmeter. Upon pressing the switch a second time, n(V) P(V)∆V (1) thesourceisreconnectedtothecapacitor. Thevoltmeter ≡ N remains connected across the capacitor throughout. A Given f(t), what is P(V)? Consider a measurement of good digital voltmeter with high internal resistance and f being done between t and t+∆t. The measuredvalue smallcapacitanceshouldbeused. Thecircuitdiagramis V, willbe between f(t)and f(t+∆t). i.e., betweenf(t) shown in Figure 1. df(t) This arrangement is sufficient to sample the distribu- and f(t)+ dt ∆t. Let ti, i = 1,2,...M, be the times 3 A. Examples 6 f(t) 1. Triangular Wave V0 t1 t2 t3 t4 4t f(t) = V 1 , 0<t<T/2 " − 0 − T (cid:18) (cid:19) V 4t = V 3 , T/2<t<T (7) 0 − T (cid:18) (cid:19) For V V V , every V occurs twice at the times, 0 0 − ≤ ≤ T V t = 1+ 1 4 V (cid:18) 0(cid:19) T V - t = 3 (8) 2 0 t ! T 4 (cid:18) − V0(cid:19) FIG. 2: Example of a typical function f(t). Contribution g (V)andg (V)aregivenbytheRHSoftheaboveequa- 1 2 to P(V) nearV0 will come from four intervalsof time in this tions. We can now use the formula in Eqn. (6) to get, case because f(t) hits thevalue V0 at times t1,t2,t3 and t4. 1 P(V)= (9) 2V 0 at which the voltage is equal to V, i.e., all the solutions IndependentofV. Basically,f(t)isspendingequaltimes of the equation, at allvoltagesbetween V and V andthus all voltages 0 0 − in this range are equally likely. f(t )=V (2) i IfP (t)istheprobabilityofthemeasurementbeingdone 2. Sawtooth Wave t at time t, then the probability of the outcome of a mea- surement being between V and ∆V is, 2t M f(t)= V 1 (10) 0 P(V)∆V = P (t )∆t (3) − − T t i i (cid:18) (cid:19) i=1 X Here, every voltage between V and V occurs exactly 0 0 − once at, where, T V t = 1+ (11) ∆t =∆V df(ti) −1 (4) 1 2 (cid:18) V0(cid:19) i dt (cid:12) (cid:12) Applying Eqn. (6) as before yields, (cid:12) (cid:12) (cid:12) (cid:12) We can always invert f(t) i(cid:12)n the n(cid:12)eighborhood of each 1 P(V)= (12) ti. So let t = gi(V), t ≈ ti. Furthermore, let us assume 2V0 thattherandomtimesofmeasurementareuniformlydis- tributed so that P (t)=1/T. We then have, again, independent of V. In fact the probability distri- t butions for the triangular and sawtooth waveforms are exactlythe same. Inboth cases, f spends equaltimes at M P(V)∆V = 1 dgi(V) ∆V (5) all voltages between −V0 and V0. T dV i=1(cid:12) (cid:12)! X(cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) 3. Sinusoidal Wave Hence, M 1 dg (V) i P(V)= (6) 2π T dV f(t)=V sin t+φ (13) i=1(cid:12) (cid:12) 0 T X(cid:12) (cid:12) (cid:18) (cid:19) (cid:12) (cid:12) (cid:12) (cid:12) 4 Each value of the voltage occurs twice, 10 T V 8 t = sin−1 φ 1 2π (cid:18) (cid:18)V0(cid:19)− (cid:19) 6 t = π T sin−1 V φ (14) 4 2 − 2π V − (cid:18) (cid:18) 0(cid:19) (cid:19) 2 Applying Eqn. (6) gives, 0 -2 1 1 P(V)= (15) -4 π V2 V2 0 − -6 In Sections IV and V we sphow the comparison of this -8 calculation with the probability distribution computed fromthe experimentaldata using asinusoidalwaveform. -10 0 50 100 150 200 250 300 350 400 450 500 B. Wave form reconstruction FIG. 3: Plot of 500 voltages plotted with the measurement numberappearingalongthex-axis. TheACsourceusedhere had a peak voltage of 8.6V. Having determined the probability distribution P(V), the question now is, given P(V), what can we say about f(t)? In general, it is not possible to reconstruct f(t) Another situation where f(t) can be reconstructed is fromP(V)sincemanyfunctionscanhavethesameprob- if we are given that it is a periodic function with period ability distribution of values. However, as we will see, T ,has exactlyoneminimum (andhence onemaximum) p with some additional information about the function, it in a period and is symmetric about its maximum and is possible to reconstruct it. minimum. A sinusoidal waveform which we use for our Wefirstconsiderthecasewhenf(t)isaone-to-oneand experiment is an example of such a function. In this hence invertible function. We denote the inverse of f by case,weknowthatitmonotonicallyincreasesforhalfthe g f−1, so that t = g(V). Let P (t) be the probability t period and monotonically decreases for the other half of ≡ that a measurement is done between t and t+dt, then, the period. Furthermore, if we are sampling over times large compared to the time period, then we randomly P(V)dV =P (t)dt (16) t sample all the times in a period. So we can replace T by thehalf-period 1T inalltheaboveformulae,reconstruct wheretisthe time whenthe voltageisequaltoV. From 2 p f(t) for the half period and then using the symmetry, now, we will restrict ourselves to uniform distributions recover the function for the full period. We can get to for the random measurements, i.e., the wave shape from the probability distribution in this 1 case;however,weareunabletofindthesignalfrequency. P (t)= (17) t T We also have IV. RESULTS dg dt= dV , We now turn to the experimental results and their dV (cid:12) (cid:12) analysis. For good statistics, a large number of voltages (cid:12) (cid:12) hence, (cid:12) (cid:12) should be recorded,althoughinteresting results begin to (cid:12) (cid:12) emerge with a sample size as low as 100. The results in 1 dg this section pertain to a sample size of 500 data points P(V)dV = dV (18) T dV with a 50Hz AC source having a peak voltage of 8.6V. (cid:12) (cid:12) (cid:12) (cid:12) The500rawdatapoints(usedintheanalysis)areshown (cid:12) (cid:12) We now need some additionali(cid:12)nform(cid:12) ationabout f(t). If in Figure 3. The raw data clearly look random and it is f(t) is one-to-one, then it is monotonic. Assume that it notpossibletodrawanymeaningfulconclusionsbymere is monotonically increasing. We can then integrate the visual inspection. above equation to get g(V), The first step in the analysis is to choose a certain number of bins and find the probability distribution of V voltage. This is achieved by the C program given in g(V)=T dV′P(V′) (19) Appendix. InFigure4weshowthegraphcorresponding ZV0 to the probability distribution for the voltages divided where V = f(0) and g(V) can then be inverted to get into 101 uniform bins. 0 f(t). Furthermore, since the function in this case satisfies 5 dom, do not give us any time-scale information; hence the reconstruction gives us only the shape of the signal. 0.6 For example, two sine waves with different frequencies and same amplitudes will give the same probability dis- 0.5 tribution and hence the same reconstructed waveforms. It is instructive to play with the parametersof the ex- 0.4 periment. Different frequency and amplitude for the AC ) (V can be tried and the experiment can be repeated with P 0.3 differentwaveformsliketriangularorsawtoothandoth- ers. One can change the total number of points in the 0.2 raw data and see how the statistics improves by increas- ingthe samplepoints,whichwillbetakenupinthenext 0.1 section. For the data analysis the number of bins is the onlycrucialparameteranditisinterestingtoseehowthe quality ofanalysischangesas we change the bin size. As 0 -8 -6 -4 -2 0 2 4 6 8 a demonstration, we re-analyze the same data described V abovebyvaryingthenumberofbinsto11and1001. One observes(seeFigs.5and6)that11binsagivemuchless 8 accurateprobabilitydistributionandwaveform;however 6 going to 1001 bins does not help much compared to 101 bins. 4 The 101 bins are able to capture more information 2 availablein the data comparedto 11bins, leading to the improved quality of the result. Since the raw data has V 0 t only500points,there isa limitto whichwecanimprove the quality by increasing the bin number. If we want to -2 improve the results further we must increase the num- -4 ber of raw data points and not the bin number. This is a general principle of experimental observations wherein -6 the accuracy of the result is determined by the least ac- -8 curate part of the observation and analysis. FIG. 4: Probability distribution and reconstructed wave- V. STATISTICAL ANALYSIS AND form from 500 data points using 101 voltage bins. In the NUMERICAL SIMULATION upper graph we show the probability distribution which is calculated by dividingthefraction of voltages belonging to a As seen in the preceding section, the data when anal- bin by the width of the bin. In the lower graph the dotted ysedfitwellintoasinusoidalcurve,reproducingtheorig- curve corresponds to the reconstructed voltage as a function inal voltage form. We now analyse the goodness of this of timeinarbitrary units(nofrequencyinformation is recov- erable). The solid curveis the actual sine curve provided for fitanddeviationsfromthe expected(theoretical)values. comparison. When a sinusoidal waveform is sampled N times ran- domly, the voltage probability distribution of Eqn. (15) results in the frequency distribution of events the conditions for reconstruction, we use the formula given in Eqn. 19 and numerical integration (carried out n(V)=NP(V)dV (20) bythesecondpartoftheCprogramgiveninAppendix) forwaveformreconstructionanddisplaytheresultsinthe and the accumulated frequency of events upto a voltage lowerhalfofFigure4. Theexpectedsinusoidalwaveform V obtained on integration is emerges. Theactualsinecurveisalsoprovidedasasolid curveinthe samegraphforcomparison. Ifwe startwith V N N = NP(V)dV = sin−1V/V . (21) alargerrawdatasetwecanimprovethequalityofrecon- V π 0 structionandalsoreducethestatisticalfluctuationinthe Z0 probability distribution plot. A detailed statistical anal- For discrete bins of size ∆V, the integration is replaced ysis is presented in Section V. We observe here that the by a sum over bins, N = n(V) = NP(V)∆V. V probability distribution reveals the characteristics of the In other words, by a cumulative process of adding the waveform which are not at all obvious from the raw data. frequencies in bins, starting fProm the V =P0 bin to the We note here that there is no way of estimating the V = V bin, we recover the sine (actually sine-inverse) frequency of the signal. The sampling times, being ran- form. 6 0.16 3.5 0.14 3 0.12 2.5 ) 0.1 V 2 ( ) P 0.08 V ( P 1.5 0.06 1 0.04 0.02 0.5 0 0 -8 -6 -4 -2 0 2 4 6 8 -8 -6 -4 -2 0 2 4 6 8 V V 8 8 6 6 4 4 2 2 V0 V 0 t t -2 -2 -4 -4 -6 -6 -8 -8 FIG.5: Probabilitydistributionandreconstructedwaveform FIG.6: Probabilitydistributionandreconstructedwaveform forthesame500pointdatasetbutwithonly11voltagebins. forthesamedatasetwith1001voltagebins. Thereishardly The plots clearly indicate that there is a loss of information any improvement from the 101 bin analysis indicating that if we use too few bins for the data analysis. thereisnoadvantageinincreasingthebinsizebeyondapoint. V0 V0 V0 χ2/dof The N data are binned into m bins; assuming that (Actual) (Measured) (Fitted) eachsample is a randomindependent event, the statisti- 8.6 8.3 8.4 58/90 calerrorforthefrequencyineachbincanbetakentobe 17.1 16.4 16.4 105/90 σ = N/m. ThustheerroronN isσ =√jσ ,where 0 V j 0 there are j bins from V = 0 to V =V. With this error, p TABLEI:Fitsto500samplesofdataofanACVoltagewith the accumulated frequency N is fitted to the form in V peak voltage Vmax, binned into91 voltage bins. Eqn.(21), with V as the free parameters,by a standard 0 chi-squared minimisation procedure: indicate that the recovery of the waveform is truer at (Ndata(j) N (j,V ))2 χ2 = V − V 0 (22) lower peak voltages. j σj2 We now turn our attention to a numerical simulation. X Two sets of data were simulated (both with V =8.3V), 0 The result of the fitting procedure for the set of 500 one with 500 sample events (as in the actual experimen- sample data from a transformer stepped down to peak tal data) and one with twenty times as much data, by voltage (a) 8.6 V, and (b) 17.1 V, is shown in Table I. samplingasinewaveformrandomly. The simulateddata Note that due to switching losses, the largest value were binned and analysed as above. The larger data set of sampled voltage in the first case was 8.3 V and in wasscaledsuitablyforcomparisonwiththesmallersam- the latter, 16.4 V. Clearly, switching losses are larger ple/experimental data. at larger values of the peak voltage and the χ2 values Theerroronthefrequencyineachbinisagain N/m. p 7 The total frequency, N (j) = N √N = N(1 thefactthatSetIactuallysamplesawaveformwithpeak j V ± ± 1/√N). Hence, though the error increases as √N, the voltage Vpeak = 8.6 V with voltage losses at the time of P fluctuations on the accumulated frequency decrease as measurementdue to switching;these lossesmaybe com- 1/√N;therefore,weexpectthefitsfromthe10,000sam- plicated functions of V. No such losses are modeled in ple set to be about 5 times (√20) smoother than those our analysis. from the 500 sample set. We show the corresponding frequency vs. bin voltage histogram in Fig. 7. The his- Data Set V0 χ2/dof tograms I, II refer to the original data set and the simu- I 8.4 58/90 lated500-sampledata. Itisseenthatthey areverysimi- II 8.3 15/90 lar in appearance. The histogramIII, shifted by a factor III 8.3 2.6/90 of 50 for clarity, is from the 10,000 data set and clearly shows much smaller fluctuations. Correspondingly, as TABLEII: Fitsto500samplesofdataofanACVoltagewith shownin Table II, the χ2 for the fits to the accumulated peakvoltage V0,binnedinto91voltage bins. I:experimental frequency distribution N are much better for III than data set, II: simulated data, III: simulated 10,000 data set, V for I or II. scaled to 500 samples. 100 500 90 400 80 70 300 60 III 200 50 III II 100 40 I 0 30 20 -100 I,II 10 -200 0 -10 -8 -6 -4 -2 0 2 4 6 8 10 -300 V (Volts) -10 -8 -6 -4 -2 0 2 4 6 8 10 V (Volts) FIG. 7: Frequency of occurrence of voltage in 91 bins for a peak voltage Vpeak = 8.6V. Histograms I (solid lines), II FIG. 8: Integrated frequency, NV, shown as a function of (dottedlines)correspondtotheexperimentaldataandsimu- voltage V, in 91 bins, with errorbars. The solid lines are the lations with 500 samples respectively; histogram III (shifted best fits to the data, I: experimental data with V0 = 8.3V, by 50 along the y-axisfor clarity) is for 10,000 samples. The generatedbysamplingACvoltagefrom atransformer witha solidlinescorrespondtothetheoreticalfrequencydistribution peak voltage of 8.6 V. II: simulated data with same V0 and as given byEqn. (20) number of sample points (500) as data, III: simulated data with 10,000 sample points. Set II (III) has been shifted by 100 (200) along they-axisfor clarity. The accumulated frequency for the data/simulated data are shown as a function of the voltage in Fig. 8 In summary, data with smaller voltages at the trans- for the three cases. (The results for III have been scaled formergivebetter fitsto theoriginalsine waveformthan down (by 20) to match the overall normalisation for the data with largervoltages. As expected, the quality of fit other two cases.) While fluctuations in the simulated improves with amount of data. data for 500 samples (Case II) are similar to the exper- imental data, the fluctuations for the large data sample (CaseIII)areverysmallandthe correspondingdistribu- tion is very smooth. The resulting χ2 is therefore much VI. CONCLUDING REMARKS smaller in this case,as Table II shows. Furthermore,the goodness-of-fit is much better for II than for I, although A simple experiment was constructed to randomly theycorrespondtosimilarsamplesizes. Thismayreflect sampleanACvoltagesource. Thecruxoftheexperiment 8 involved charging a capacitor from an AC source, whose of changing the switching device (to limit losses due to instantaneous voltage is then measured by switching its sparking, etc.), the peak voltage of the AC source, and connectiontoaDC voltmeteratarandomtime. There- the voltage measuring device, can be studied at various sulting data were analysed to recover information about levels of complexity, depending on the ability and incli- the AC source. While the frequency of the source could nation of the reader. notbedetermined,thepeakvoltageandtheshapeofthe original waveform could be accurately found. The pro- cedure involved in inverting the data to recover this in- Acknowledgments formationwas tested through numericalsimulations and statisticalanalysis. Theexperiment,alongwiththeanal- ysis, can be effectively introduced into a physics labora- Arvind thanks National Science Foundation for finan- torycourseattheprimaryoradvancedlevel. Theeffects cial support through Grant Nos. 9900755and 0139974. APPENDIX: C PROGRAM We give here the C program used for the data analysis. The input to the program is a data file ‘input.dat’ which shouldhaveasinglecolumncontainingthevoltagesmeasuredintheexperiment. Theprogramscansthefile,findsthe data attributes (number of data points, the maximum value in the data, the average voltage, etc.) and writes them in the file ‘cap1.out’. It then divides the voltage range into equal sized odd number of bins. The bin number is to be specified on the screen and is read as the variable bin_nu. The binned data is written into the file ‘cap2.out’ with the first column containing the bin center and the second the probability of occurrence of voltage in that bin. The second part of the program carries out the waveform reconstruction for the periodic signal and the result is written in the file ‘cap3.out’ where the first column contains the ‘scaleless’ time variable and the second column the voltage reconstructed for that time. #include "stdio.h" #include "math.h" main() { const int bin_max=5000; /* max array size */ const float epsilon=0.001; /* voltage range extension(end points) */ int bin_nu; /* no. of bins to be used (must be odd)*/ int bin[bin_max]; /* array of bins */ int j,i,k; /* integers to be used in loops */ int data_max; /* data points in input.dat */ int bin1_nu; float voltage[data_max];/*array of voltages read from input.dat*/ float max_voltage; /* maximum voltage */ float average; /* average voltage */ float bin_nuf,bin_width,sum[bin_max]; /* bin no. as float, bin width and sum */ float pbin[bin_max]; /* probability bin */ FILE *fp0,*fp1,*fp2,*fp3; fp0=fopen("input.dat","r"); /* Input file */ fp1=fopen("cap1.out","w"); /* Output file 1 */ fp2=fopen("cap2.out","w"); /* Output file 2 */ fp3=fopen("cap3.out","w"); /* Output file 3 */ printf("Input the number of bins to be used (odd number)\n"); scanf("%d",&bin_nu); bin_nuf=bin_nu; data_max=0; /* Initialization */ max_voltage=0; /* Initialization */ average=0; /* Initialization */ for(i=0;i<bin_max;i++) /* Initialization */ bin[i]=0; j=1; i=0; while(i!=EOF) /* Reading data from ‘input.dat’ */ 9 { fscanf(fp0,"%f",&voltage[j]); i=getc(fp0); if (i==’\n’) { j++; data_max++; } } for(i=1;i<=data_max;i++) { average=average+voltage[i]; if(fabs(voltage[i]) > max_voltage) max_voltage=voltage[i]; } bin_width = 2*(max_voltage+epsilon)/bin_nuf; /* Computed bin width */ average = average/data_max; /* Average Voltage */ for(i=1;i<=data_max;i++) /* Filling the bins */ { for(j=-(bin_nu-1)/2;j<=(bin_nu-1)/2;j++) { if(voltage[i] >=j*bin_width-bin_width/2 && voltage[i] < j*bin_width+bin_width/2) bin[j+(bin_nu-1)/2]++; } } Calculating the probabilities for bins for(j=0;j<bin_nu;j++) { pbin[j]=(1.0)*bin[j]/data_max; } Some basic facts about the data are computed and written in a file ‘cap1.out’ fprintf(fp1,"Number of Voltages Scanned = %i\n",data_max); fprintf(fp1,"Maximum Voltage = %.3f\n",max_voltage); fprintf(fp1,"Number of Bins = %i\n",bin_nu); fprintf(fp1,"Average Voltage = %.3f\n",average); fprintf(fp1,"Size of each bin = %.3f\n",bin_width); Probabilities for each bin written into the output file ‘cap2.out’ with first column being the center of the bin and the second column the probability for finding the voltage in that bin. fprintf(fp2,"Bin Center Probability\n"); for(j=0;j<bin_nu;j++) fprintf(fp2,"%+8.3f %-1.4f\n", (j-(bin_nuf)/2+0.5)*bin_width,pbin[j]); INTEGRATION OF THE DATA This partof the programintegrates the data and reconstructsthe waveformassuming that f(t) canbe reconstructed from the values of f(t) in the interval [0,T/2) (where T is the period of f(t)) in the following way: f(T/2+t) = f(T/2 t) 0<t<T/2. The output is written in a file ‘cap3.out’ − 10 sum[0]=bin[0]*bin_width; for(j=1;j<bin_nu;j++) { sum[j]=sum[j-1]+bin[j]*bin_width; } for(j=0;j<bin_nu;j++) { fprintf(fp3,"%+8.3f %+8.3f\n",sum[j], (j-(bin_nuf)/2+0.5)*bin_width); } for(j=0;j<bin_nu;j++) { fprintf(fp3,"%+8.3f %+8.3f\n",sum[j]+sum[bin_nu-1], -(j-(bin_nuf)/2+0.5)*bin_width); } for(j=0;j<bin_nu;j++) { fprintf(fp3,"%+8.3f %+8.3f\n",sum[j]+2*sum[bin_nu-1], (j-(bin_nuf)/2+0.5)*bin_width); } for(j=0;j<bin_nu;j++) { fprintf(fp3,"%+8.3f %+8.3f\n",sum[j]+3*sum[bin_nu-1], -(j-(bin_nuf)/2+0.5)*bin_width); } } ∗ Electronicaddress: [email protected];Presentad- of random variables, American Journal of Physics 51(6), dress: DepartmentofPhysics,CarnegieMellonUniversity, 520–532 (June 1983). Pittsburgh PA 15217, USA. 8 J.D.Ramshaw,Probabilitydensitiesandtherandomvari- † Electronic address: chandi˙p@rediffmail.com abletransformationtheorem, AmericanJournalofPhysics ‡ Electronic address: [email protected] 53(2), 178–180 (February 1985). § Electronic address: [email protected] 9 M.D.SturgeandS.B.Toh,Anexperimenttodemonstrate ¶ Electronic address: [email protected] the canonical distribution, American Journal of Physics 1 B. L. Saraf, Physics Through Experiments Vol. I & II, 67(12), 1129–31 (December 1999). Vikas Publishing House, New Delhi, 1979. 10 R.Aguayo,G.Simms,andP.B.Siegel, Throwingnature’s 2 K. K. Gan, H. P. Kagan, and R. D. Kass, Simple demon- dice, American Journal of Physics 64(6), 752–758 (June stration of the central limit theorem using mass measure- 1996). ments, American Journal of Physics 69(9), 1014–1020 11 H. W. Lewis, What is an experiment?, American Journal (September2001). of Physics 50(12), 1164–1165 (December 1982). 3 E. M. Levin, Experiments with loaded dice, American 12 H.W.Lewis, Whatisan experiment? II, American Jour- Journal of Physics 51(2), 149–152 (February 1983). nal of Physics 53(6), 592–593 (June 1985). 4 G. Fischer, Exercise in Probability of and statistics or 13 C. S. Barnett, Probabilistic description of radioactivity probability of winning at tennis, American Journal of based on thegood-as-new postulate, American Journal of Physics 48(1), 14–19 (Jan 1980). Physics 47(2), 173–177 (February 1979). 5 P. C. B. Fernando, Experiment in elementary statistics, 14 W.H.Press, S.A.Teukolsky,W.T. Vetterling,and B. P. American Journal of Physics 44(5), 460–463 (May 1976). Flannery, Numerical Recipies C, Cambridge University 6 N. B. Tufillaro, Generating a fractal using a capacitor, Press, 2 edition, 1992. American Journal of Physics 69(6), 721–22 (June2001). 7 D. T. Gillespie, A Theorem for physicists in the theory