phetsims / models-of-the-hydrogen-atom

"Models of the Hydrogen Atom" is an educational simulation in HTML5, by PhET Interactive Simulations at the University of Colorado Boulder.
GNU General Public License v3.0
2 stars 3 forks source link

Should wavelength values be integers? #53

Closed pixelzoom closed 1 month ago

pixelzoom commented 1 month ago

I'm opening this issue because wavelengths are visible in Studio and the PhET-iO data stream. So the actual values used in the model become more important. This is high priority because it affects most of the things that I'm working on (spectrometer, etc.)

Absorption/emission wavelengths are computed using the Rydberg formula (see BohrModel.ts getAbsorptionWavelength), and those wavelengths are not integer values:

lambda = 1240 / ( 13.6 * ( 1 / ( n1 * n1 ) - 1 / ( n2 * n2 ) ) )

In the Abosorption/Emission dialog, we are presenting those wavelengths as integers, and setting integer wavelengths for the light.

The light is also displaying integer wavelength values, but the values are not actually integers. So for example, setting the light to 500 nm may actually be setting monochromaticWaveLengthProperty to 500.432.

Watching the absorption/emission behavior of the atom is also a little odd. For example, you'll see an atom absorb 103 nm, then emit 102.57352941176471 nm.

The model works because (as in the Java version) we are considering wavelengths to be equal if they differ by less than 0.5 nm - ie, if their integer values are the same.

Also note that page 20 of the Java design doc (hydrogen-atom.pdf) shows non-integer wavelengths:

screenshot_3476
pixelzoom commented 1 month ago

8/19/24 design meeting: @DianaTavares @arouinfar @kathy-phet @Nancy-Salpepi @pixelzoom

Consensus was to use integer wavelengths, and mention this simplification in model.md, example.md, and Teacher Tips.

pixelzoom commented 1 month ago

After pushing, there's a CT problem, see below.

To reproduce manually, click on the slider track in MonochromaticWavelengthControl.

models-of-the-hydrogen-atom : interactive-description-fuzz-fuzzBoard-combo : unbuilt
URL: http://127.0.0.1/continuous-testing/ct-snapshots/1724088710891/models-of-the-hydrogen-atom/models-of-the-hydrogen-atom_en.html?continuousTest=%7B%22test%22%3A%5B%22models-of-the-hydrogen-atom%22%2C%22interactive-description-fuzz-fuzzBoard-combo%22%2C%22unbuilt%22%5D%2C%22snapshotName%22%3A%22snapshot-1724088710891%22%2C%22timestamp%22%3A1724089184258%7D&brand=phet&ea&supportsInteractiveDescription=true&fuzz&fuzzBoard
ERROR: QUERY: brand=phet&ea&supportsInteractiveDescription=true&fuzz&fuzzBoard
Error: Assertion failed: validation failed for value:
 641.024
 Property value not valid: Failed validation for validators[1]: Should be a valid integer: value failed isValidValue: 641.024
 prunedValidator:
 {
  "valueType": "number",
  "valueComparisonStrategy": "reference",
  "phetioType": {
    "validator": {
      "valueType": "number",
      "validationMessage": "Validation failed IOType Validator: NumberIO"
    },
    "typeName": "NumberIO"
  },
  "validators": [
    {
      "validationMessage": "Should not be NaN"
    },
    {
      "valueType": "number",
      "validationMessage": "Should be a valid integer"
    },
    {}
  ]
}
pixelzoom commented 1 month ago

Done, closing.