phetsims/collision-lab

Balls may still have velocity if they read 0

Closed this issue · 16 comments

Test device
iPad 6th Gen
Operating System
iPadOS 14.1
Browser
Safari
Problem description
For phetsims/qa#562
It is possible for balls to still have a slight amount of velocity and be moving very slowly even if their data says they have zero velocity. This can be seen with the velocity arrow being somewhat visible and if you wait long enough you can see the movement. This is best done on the third screen with 5% elasticity.

Visuals
ezgif com-gif-maker (1)

This seems like a design decision... 0.00 currently means "less than 0.005" due to rounding. @arouinfar how should this be handled? I could imagine "have a way of showing non-zero but small" velocities, OR some way of zeroing out low velocities (or their components), OR leaving as-is.

This is similar to #162. This is the nature of precision and rounding, which I'll make note of in the Teacher Tips.

The only thing I think we could do would be to display < 0.01 when the values are small but non-zero. I think we would need to do this for velocity, momentum, and KE. The worry I have with the approach is that we might not be able to easily detect when the ball comes to rest to switch the displays to 0.00. @jonathanolson what are your thoughts on this?

Just to document, a user wrote to phethelp:

there is a rounding error in the HTML5 collision phet so the total momenta before and after collision is slightly different sometimes
See this screenshot: m1 = 2.00, v1 = 0.14 and p1 = 0.29

Students may get confused since m1*v1 = 0.28.

Not sure how to fix this myself. Other than telling students that there is some rounding artifact. Use the p1 reported in phet and not use the m1*v1 equation.
after collision

@oliver-phet there isn't anything we can do here. The mass in the model is exactly 2.00 kg. However, the velocity is some long decimal that rounds to 0.14, which means it's actually anything in the range of [0.135, 0.145). The displayed momentum is the result of multiplying 2.00 by the actual value of velocity which is then rounded to two decimal places in the display. For example, the velocity in the model might actually be 0.14366789 which means the momentum would be 0.28733578 which rounds to the 0.29 shown in the display.

When users directly set the velocity by typing in a value or dragging the vector, the velocity will be exactly the displayed value. However, as soon as balls collide, the velocity will no longer be a nice, round number.

The only thing I think we could do would be to display < 0.01 when the values are small but non-zero. I think we would need to do this for velocity, momentum, and KE. The worry I have with the approach is that we might not be able to easily detect when the ball comes to rest to switch the displays to 0.00. @jonathanolson what are your thoughts on this?

This seems very doable, but we'd presumably have a very low threshold for "at rest" (e.g. 1e-8).

Design meeting: we'll show "< 0.01" when it is below that amount AND non-zero.

Implemented in the above commit. @arouinfar can you let me know how this looks?

I reviewed master and have a few thoughts.

  • Displaying < 0.01 for position looks strange and isn't particularly helpful.
  • Velocity and momentum can be negative, so situations that fall into [- 0.005, 0) are still displayed as 0.00. It's unbalanced to only have an alternative display for small, positive values. That said, > -0.01 does not have the same clarity as < 0.01 and doesn't seem particularly helpful here.

The first issue is likely trivial to address, but the second calls into question this entire approach. I think I'd rather just let small numbers show up as 0.00 and clarify things in the Teacher Tips. @ariel-phet what do you think?

@arouinfar what about going with a "~0.00" approach when it is not truly zero. I agree, with just labelling position as zero, but for velocity "~0.00" might be nice when it is actually moving visibly.

@arouinfar what about going with a "~0.00" approach when it is not truly zero.

That's brilliant! I think this will work really well for the velocity and momentum. Would we also use ~0.00 for things like the KE and magnitudes displayed with Values checked, or would we want to stick with < 0.01 (assuming it isn't overly complicated to do)?

@arouinfar I don't actually have a strong opinion, but probably best to just be consistent. I think ~0.00 could work well in all those cases if we wanted consistency. But for KE and magnitudes I would be fine with <0.01 as well.

Ok, let's go with ~0.00 for consistency.

@jonathanolson let's display ~0.00 for all non-zero values within (-0.005, 0.005), except for position.

Should be implemented above。

Looks great @jonathanolson! I think this is ready for QA in the next testing cycle.

This looks like it was implemented in 1.1.0 dev.13. I noticed that the ~ can look a bit like - in certain fonts. @arouinfar I don't know if that is worth looking at.
maybenegative

Thanks @KatieWoe. I don't think there's much we can do to control the font, but in your screenshot the ~ is quite a bit longer than - which helps keep them differentiable.