phetsims / faradays-electromagnetic-lab

"Faraday's Electromagnetic Lab" is an educational simulation in HTML5, by PhET Interactive Simulations.
GNU General Public License v3.0
1 stars 0 forks source link

Confusing comment about vectors #144

Closed samreid closed 3 months ago

samreid commented 3 months ago

During code review #103, we observed this code in FieldMeterNode.ts

    // Dynamic labels. The Java version showed a line over 'B' for these labels, presumably indicating magnitude.
    // That notation was incorrect, since 'B' is (by definition) the *magnitude* of the magnetic field. See for
    // example https://en.wikipedia.org/wiki/Magnetic_flux.
    const stringBLabelProperty = new DerivedStringProperty( [ BStringProperty ], B => `${B}` );
    const stringBxLabelProperty = new DerivedStringProperty( [ BStringProperty, xStringProperty ], ( B, x ) => `${B}<sub>${x}</sub>` );
    const stringByLabelProperty = new DerivedStringProperty( [ BStringProperty, yStringProperty ], ( B, y ) => `${B}<sub>${y}</sub>` );

Here is a picture of the line over the B in the Java:

image

It appears the line over the B is meant to indicate it is a vector, like so:

image

In the wikipedia link, the authors use an alternate strategy for showing that it is a vector, which is to use a boldface font, like so:

image

Note in this image, B is a vector and B is a scalar.

pixelzoom commented 3 months ago

B, Bx, and By are all scalars, so the vector notation was incorrect in the Java version. @samreid Does this updated doc clarify?

    // Dynamic labels. The Java version showed a line over 'B' for these labels, presumably indicating 'vector'.
    // Using that vector notation was incorrect, because the values we are showing here are all scalars.
    // See for example https://en.wikipedia.org/wiki/Magnetic_flux.
    const stringBLabelProperty = new DerivedStringProperty( [ BStringProperty ], B => `${B}` );
    const stringBxLabelProperty = new DerivedStringProperty( [ BStringProperty, xStringProperty ], ( B, x ) => `${B}<sub>${x}</sub>` );
    const stringByLabelProperty = new DerivedStringProperty( [ BStringProperty, yStringProperty ], ( B, y ) => `${B}<sub>${y}</sub>` );
samreid commented 3 months ago

Looks good, thanks. Closing.