Curve Fitting Data

Hi there, so I’m attempting to take some data collected by Balmer during his study of spectral lines of hydrogen and fit a formula to it to find a constant.

The data in question is pulled from web.lemoyne.edu/giunta/balmer

I’ve collected the data for the values of m, and the wavelength in a .dat file, and I’ve had no trouble getting mathematica to understand and it and plot it out, but I’m having some issues getting it to curve fit balmers formula to it.

I’m attempting to get ?= h m^2 /(m^2 ? 4) for m=3,4,5…

I’ve having some trouble understanding how mathematica wants to to tell it to curvefit, the program tutorial for curve fitting is a bit confusing to be honest.

Any help at all is greatly appreciated. Thanks.

Here is your data:

wavelengths = 
 Import["http://web.lemoyne.edu/giunta/balmer.html", "Data"][[1,2 ;; 5]][[All, 2]]

giving

{6562.1, 4860.74, 4340.1, 4101.2}

You say this corresponds to m from 3 to 6.

So let’s fit it to your expression with h as the unknown:

FindFit[Transpose[{Range[3, 6], wavelengths}],  h m^2/(m^2 - 4), h, m] 

Giving:

 {h -> 3645.6}

Thanks for the reply, after fighting with the program for a while I got it to do what I wanted.

I came to the same value of h, so that’s promising :slight_smile:

Again, thanks for taking the time to answer a pretty basic question.