-
Notifications
You must be signed in to change notification settings - Fork 4
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
Model and decimals in sim screens #57
Comments
Specifically, this issue was broken off from https://github.com/phetsims/phet-io-wrapper-hookes-law-energy/issues/2#issuecomment-396770874. |
@kathy-phet also note that there's a more general issue that discusses the topic of "number of decimal places" as related to the PhET-iO message stream. See https://github.com/phetsims/phet-io/issues/1332. |
Here is a summary of how I am thinking about these screens. Screen 1: One model complication I don't fully follow on this screen is that position is adjustable with the arm, but F should always be the exact integer value shown since it is on the slider and that is exact. So I am not sure how the model is working here. Screen 2: Screen 3: k is also similarly defined with a set number of digits (100, 110) should not need to be calculated. F is now the dependent term and should be directly calculated from k and x. I guess I am seeing 2 different model variants depending on the screen - one where x=F/k and one where F=kx. How does the third screen work right now? where F is now the calculated value, not the controlled/set value? Apologies for not having much bandwidth to discuss this today - but I wanted to put these thoughts down for Amy and Christ to look over. |
Displacement definitely needs three decimal places on all three screens, otherwise some interactions will feel coarse, as @pixelzoom described. We consistently display the same number of decimal places across all screens. I believe we made the decision of how many decimals to display was based on the interaction pattern of the first two screens (user-controlled F and k). @kathy-phet raises some really great points about the third screen. I do not think there is any pedagogical advantage to controlling x in 0.001 m steps. We could kill the third decimal place altogether, and have the thumb/arm snap to 0.05 m steps, and use the tweaker to adjust by 0.01 m. When x is small, increasing k results in F increasing in jumps, regardless of whether x has two or three decimals. Since F is the derived quantity on this screen, it would benefit from an additional digit. I would vote for:
@pixelzoom I'd m also curious about this question:
On the Energy screen, does the model calculate F from the user-controlled x and k? |
@arouinfar asked:
Intro and Systems screens: Changing x solves for F. Changing F or k solves for x. |
@arouinfar wrote:
The current implementation uses the same sig figs throughout all screens. Changing so that one screen (Energy) can be different will be nontrivial.
As written, this seems to suggest that we constrain displacement in the model, but constrain applied force only in the view ("display"). Is that what you intended? I want to be very clear that model vs view constraint are very different things. Constraining anything in the model typically leads to more floating-point errors. |
Why do you need a changing F solves for x on this screen? x is fixed by the slider/model value? |
@pixelzoom it's unclear to me how a user could directly change F. The user can move the arm (which changes x) or adjust the k or x sliders.
An alternative would be:
I'm not sure I completely follow @pixelzoom. Doesn't the Displacement slider set the value of the x in the model? The Applied Force is then calculated, and its displayed value is rounded to the nearest tenths place. |
About the Energy screen... @kathy-phet asked:
@arouinfar said:
Sorry, let me try explaining again. All screens use the same model code. In the model, changing x computes F; changing F computes x. The model has an option that indicates which parameter is computed when k changes. In the first 2 screens, changing k computes x. In the Energy screen, changing k computes F. In the Energy screen, there is no direct control of F, so the "changing F computes x" part of the model is not exercised. But it's still part of the model code. |
@arouinfar asked:
Correct, the displacement slider and robotic arm are both constrained to set x to values with at most 3 decimal places. So when interacting with the displacement slider or robotic arm, x values will have 3 decimal places in the model. But values computed by the model (e.g. F is computed when dragging the robot arm changes x) are not similarly constrained to any number of decimal places, and computed values may contain floating-point error. If you want to constrain all model values to the same number of decimal places shown in the view, that is different (and more difficult) than simply controlling the number of decimal places used by view components to control and display values. |
I don’t want the model to display fewer decimals nor for PhET-io model values to be fewer decimals, but when the slider is set to 0.130, can you not have that set the model to 0.130000000 exactly? So all model position values have decimals that are 0 down the line? I agree F would have some non zeros down at the smallest decimals because of calculations, but not sure why x would need to.
Kathy
…Sent from my iPhone
On Jun 14, 2018, at 6:35 PM, Chris Malley <notifications@github.com<mailto:notifications@github.com>> wrote:
@arouinfar<https://github.com/arouinfar> asked:
I'm not sure I completely follow @pixelzoom<https://github.com/pixelzoom>. Doesn't the Displacement slider set the value of the x in the model? The Applied Force is then calculated, and its displayed value is rounded to the nearest tenths place.
Correct, the displacement slider and robotic arm are both constrained to set x to values with at most 3 decimal places. So when interacting with the displacement slider or robotic arm, x values will have 3 decimal places in the model.
But the value computed by the model (e.g. F when dragging the robot arm) is not similarly constrained to any number of decimal places, and the computed value may contain floating-point error. If you want to contain all model values to the same number of decimal places shown in the view, that is different (and more difficult) than simply controlling the number of decimal places used by view components to control and display values.
—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub<#57 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AE3FZB2QjYYeMkNCTeqiKwiX9eBfIiwjks5t8wE-gaJpZM4UmnOo>.
|
UI controls do set their associated Properties to exact values. But as I stated above: ... values computed by the model (e.g. F is computed when dragging the robot arm changes x) are not similarly constrained to any number of decimal places, and computed values may contain floating-point error.
If you drag a control that changes F, x will be computed. And depending on the values of F and k, x may contain some floating point error. In Javascript: |
On the third screen can we disable the recalculation of x. When k changes only F should change. x should not be calculated or changed on this screen, it should be fixed by the slider position only.
Kathy
…Sent from my iPhone
On Jun 18, 2018, at 12:43 PM, Chris Malley <notifications@github.com<mailto:notifications@github.com>> wrote:
don’t want the model to display fewer decimals nor for PhET-io model values to be fewer decimals, but when the slider is set to 0.130, can you not have that set the model to 0.130000000 exactly?
UI controls do set their associated Properties to exact values. But as I stated above: ... values computed by the model (e.g. F is computed when dragging the robot arm changes x) are not similarly constrained to any number of decimal places, and computed values may contain floating-point error.
I agree F would have some non zeros down at the smallest decimals because of calculations, but not sure why x would need to.
If you drag a control that changes F, x will be computed. And depending on the values of F and k, x may contain some floating point error.
In Javascript .05 + .01 = 0.060000000000000005. Really.
—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub<#57 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AE3FZB56AosfgPdASV2vBYfK_i90z2Gaks5t9_TGgaJpZM4UmnOo>.
|
In case anyone is interested in where Javascript floating-point error comes from... This is the simplest explanation that I've been able to find: https://modernweb.com/what-every-javascript-developer-should-know-about-floating-points/. |
@kathy-phet I'm not at all clear on what problem (specifically) you're trying to solve. |
Signed-off-by: Chris Malley <cmalley@pixelzoom.com>
When a NumberProperty value in the model changes, its value is now printed to the browser console if you use the There are 2 NumberProperties that (when computed) contain floating-point error that makes them have more decimal places than desired. Those 2 Properties are |
Signed-off-by: Chris Malley <cmalley@pixelzoom.com>
Signed-off-by: Chris Malley <cmalley@pixelzoom.com>
I will look again. Goal was to stop the recursion but if it is not being recalculated it should be fine. I thought I saw recursion still when using position tweakers but I will look again when I can. Are the position tweakers at 0.01 steps now?
K
…Sent from my iPhone
On Jun 18, 2018, at 6:11 PM, Chris Malley <notifications@github.com<mailto:notifications@github.com>> wrote:
When a NumberProperty value in the model change, its value is now printed to the browser console if you use the ?log query parameter.
There are 2 Properties that (when computed) contain floating-point error that makes them have more decimal places than desired. Those 2 Properties are appliedForceProperty (F) and leftProperty (position of the left end of the robotic arm). So I'm perplexed about why we need to "disable the recalculation of x" when I see no such recalculation of displacement occurring (that was addressed in #52 (comment)<#52 (comment)>) and all values for displacement appear to have the desired number of decimal places (max 3).
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#57 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AE3FZNJMpZPM_HQYdVXKDUoBmgxOdy01ks5t-EG3gaJpZM4UmnOo>.
|
I really think we should table this issue until we can have a real discussion. Getting fragmented/unclear feedback based on no specific version is making me a little crazy and does not feel productive. |
Unassigning until we resume work on Hooke's Law. |
8/16/18 design meeting: We met about this. I'm going to undo the constraints on the model, and revisit this. |
In 8/16/18 design meeting, we decided that it unnecessary to constrain the number of decimal places in the model, and that it was OK to show model values (including possible floating point errors) in the PhET-iO data stream. To that end, I removed such constrains in #52 (comment). This addresses the problems that @arouinfar reported in #57 (comment). In #60, we revised the intervals for slider thumbs and tweakers, the number of decimal places shown for values and tick marks, etc. Since this issue was originally about that topic, and has now been addressed, I'm going to close this issue. |
Reopening. There are still some problems here. For example, we added a decimal place to Spring Force. Shouldn't we then add an additional decimal place to Spring Force components for the parallel system? |
…ceDelta, #57 Signed-off-by: Chris Malley <cmalley@pixelzoom.com>
…57 Signed-off-by: Chris Malley <cmalley@pixelzoom.com>
Model value constraints have been removed, the number of decimals for displayed values has been revised, and the slider/tweaker intervals have been revised. Here are the current values, as implemented in // number of decimal places for displayed values
APPLIED_FORCE_DECIMAL_PLACES: 1,
SPRING_FORCE_DECIMAL_PLACES: 1,
SERIES_SPRING_FORCE_COMPONENTS_DECIMAL_PLACES: 1, // series system
PARALLEL_SPRING_FORCE_COMPONENTS_DECIMAL_PLACES: 2, // parallel system
SPRING_CONSTANT_DECIMAL_PLACES: 0,
DISPLACEMENT_DECIMAL_PLACES: 3,
ENERGY_DECIMAL_PLACES: 1,
// slider thumb intervals
APPLIED_FORCE_THUMB_INTERVAL: 5, // N
SPRING_CONSTANT_THUMB_INTERVAL: 10, // N/m
DISPLACEMENT_THUMB_INTERVAL: 0.05, // m
// tweaker intervals
APPLIED_FORCE_TWEAKER_INTERVAL: 1, // N
SPRING_CONSTANT_TWEAKER_INTERVAL: 1, // N/m
DISPLACEMENT_TWEAKER_INTERVAL: 0.01, // m
// drag intervals
ROBOTIC_ARM_DISPLACEMENT_INTERVAL: 0.05, // m, Energy screen only, see #54 These changes are present in 1.1.0-dev.12. @arouinfar please review. Here's a scenario that feels a little weird, but is not incorrect based on the number of decimal places that we've chosen. Verify that you're OK with this.
|
@pixelzoom the updated thumb/tweaker intervals all look good to me. Agreed that
This is OK with me. It's a consequence of the precision limits, and the values are being correctly rounded. Thanks for checking! |
OK, we're done here. In summary, the model is unconstrained, and we revised the view. |
This change has not been published. So reopening and labeling with "fixed-awaiting-deploy". |
To summarize, there were 4 categories of things that were adjusted: (1) the number of decimal places for quantities that are displayed For QA verification... Unless otherwise noted, verify the following on all 3 screens. Check the "Values" check box in each screen's control panel to see numeric values. Intro ScreenVerify that number of decimal places is as follows:
Verify that dragging the slider thumb changes the associated value in these increments:
Verify that pressing tweakers (aka, arrow buttons) changes the associated value in these increments:
Finally, verify dragging the robotic arm:
Systems ScreenVerify that number of decimal places is as follows:
Verify that dragging the slider thumb changes the associated value in these increments:
Verify that pressing tweakers (aka, arrow buttons) changes the associated value in these increments:
Finally, verify dragging the robotic arm:
Energy ScreenVerify that number of decimal places is as follows:
Verify that dragging the slider thumb changes the associated value in these increments:
Verify that pressing tweakers (aka, arrow buttons) changes the associated value in these increments:
Finally, verify dragging the robotic arm:
|
See the above checklist for what's been verified. Reassigning @pixelzoom. |
Looks like everything passed, thanks @liam-mulhall. Closing. |
This issue is broken off for a separate discussion reflecting on Hooke's law screens. Below is the initial context that initiated the discussion. But in the next comment I will try to summarize what I am seeing as the differences in the screens and the place value needs.
@kathy-phet wrote:
@pixelzoom replied:
The text was updated successfully, but these errors were encountered: