-
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
Smooth shows large biases when numberOfPoints is low #293
Comments
I understand what is going on. This is the result of the interplay between the discretization of weighted sum average and the discretization of the curve itself. This phenomenon becomes only apparent then when we reduced the number of points, such that the number of points on the left and on the right becomes unequal. To remedy to this, we can explicitly fold our sum, such that we guarantee by construct that for every point that is pick to the left, we pick one to the right. This is easy do to. Unfortunately, this makes the code less readable but I'll add more comments/documentation to compensate for that. |
Signed-off-by: Martin Veillette <[email protected]>
This was added in the commit above. In summary, we folded a sum of f(x) that would go from -x' to x' into a sum from that goes from 0 to x', but summing f(x') and f(-x). Special care is taken that we don't double count f(0) in this process. I have added a lot of documentation to it, which is useful anyway as the code review mentioned that our documentation of these mathematical processes were scant.. I tested that it is working properly and that the smoothing does not show a bias. |
I'm inclined to close this, but I'll use it as example in #292 to point to the usefulness of the query parameters to detect faulty logic. |
The blue and pink curve started the same, but I applied the smooth button to the blue curve.
Below, this looks right for 400 points
http://localhost:63342/phetsims/calculus-grapher/calculus-grapher_en.html?brand=phet&ea&debugger&dev&numberOfPoints=400
The smoothing process, should be a weighted average, but should not biased the curve.
Notice that the centers don't match anymore below (Below numberOfPoints=100).
http://localhost:63342/phetsims/calculus-grapher/calculus-grapher_en.html?brand=phet&ea&debugger&dev&numberOfPoints=100
This becomes very apparent when the number of points is ~100. It looks fine for 400 points.
We should investigate what is going, and if it is worth fixing.
The text was updated successfully, but these errors were encountered: