Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrectly written scientific notation #173

Closed
KatieWoe opened this issue Jul 21, 2020 · 9 comments
Closed

Incorrectly written scientific notation #173

KatieWoe opened this issue Jul 21, 2020 · 9 comments
Assignees
Labels

Comments

@KatieWoe
Copy link
Contributor

KatieWoe commented Jul 21, 2020

Test device
Hooper and Dell
Operating System
iOS 12 and Win 10
Browser
Safari and Chrome
Problem description
For phetsims/qa#514. This does seem to occur in the published sim. On the second screen, it is possible to get two numbers on the side graph that should be equal, but are written differently, causing confusion. Specifically, you can have the number 1.0x10^-7 written as 10.0x10^-8, which is equal, but not scientific notation. This incorrect notation does also occur elsewhere, this is just how I encountered it, and seemed easiest to see due to how long it stayed that way. As you continue to change pH it does go to the correct notation.
Steps to reproduce

  1. Go to the second screen and select blood as a solution.
  2. Use the water and drain faucets to dilute the solution until pH is 7.
  3. Observe the Concentration graph on the left and dilute a bit further, until the H3O+ concentration reaches 10.0x10^-8
  4. Dilute further until concentration is 1.0x10^-7

Visuals
Image from iOS

@pixelzoom
Copy link
Contributor

pixelzoom commented Jul 21, 2020

This seems like something that should be fixed, unless there's pedagogical reason for it (which I doubt). @arouinfar your opinion?

@pixelzoom
Copy link
Contributor

pixelzoom commented Jul 21, 2020

Reproduced.

To inspect the actual concentration values, I added this console output to LogarithmicGraphNode.js:

valueH3OProperty.link( value => console.log( `|H3O| = ${value}` ) );
valueOHProperty.link( value => console.log( `|OH| = ${value}` ) );

For the scenario that @KatieWoe described, the values printed to the browser console are:

|H3O| = 9.952541657737637e-8
|OH| = 1.0047684645685927e-7

Values are broken into mantissa and exponents by ScientificNotationNode.toScientificNotation. Using the above values:

> phet.sceneryPhet.ScientificNotationNode.toScientificNotation( 9.952541657737637e-8 )
{mantissa: "10.0", exponent: "-8"}
> phet.sceneryPhet.ScientificNotationNode.toScientificNotation( 1.0047684645685927e-7 )
{mantissa: "1.0", exponent: "-7"}

So this is a problem in ScientificNotationNode.toScientificNotation, and changing the behavior will affect all sims that use ScientificNotationNode, which includes: blackbody-spectrum, coulombs-law, gravity-force-lab, gravity-force-lab-basics.

@pixelzoom
Copy link
Contributor

Tracking the general issue in phetsims/scenery-phet#613.

@pixelzoom
Copy link
Contributor

Fixed in phetsims/scenery-phet#613. Patched in 1.4 branches for ph-scale and ph-scale-basics. Ready to regression test in next RC.

@arouinfar
Copy link
Contributor

@pixelzoom it definitely doesn't serve a pedagogical purpose, and it looks like a possible reoccurrence of #2.

@pixelzoom
Copy link
Contributor

pixelzoom commented Jul 21, 2020

@arouinfar gets the Super Sleuth award for locating #2 !! That facilitated further digging, and I discovered that this bug was (re)introduced by @jessegreenberg in phetsims/scenery-phet@bfa1874 on 9/20/17. I will note this in phetsims/scenery-phet#613.

@pixelzoom
Copy link
Contributor

pixelzoom commented Aug 4, 2020

This is irrelevant for ph-scale-basics.

To verify in ph-scale, follow the steps to reproduce in #173 (comment).

@brooklynlash
Copy link

On Chromebook, the pH scientific notation is fixed for the blood solution on master.

@pixelzoom
Copy link
Contributor

Thanks @brooklynlash. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants