Skip to content

Conversation

@gwhitney
Copy link
Collaborator

@gwhitney gwhitney commented Nov 5, 2025

By submitting this PR, I am indicating to the Numberscope maintainers that I have read and understood the contributing guidelines and that this PR follows those guidelines to the best of my knowledge. I have also read the pull request checklist and followed the instructions therein.


NOTE: This PR is actually on top of #561 (and so really just has a half-dozen commits or so). Therefore, I am marking it as a work in progress, since it should not be merged into ui2 until the Chaos overhaul has been and it has been rebased on the resulting ui2.

Changes in this PR:

  • No longer posts a popup when the mouse button is down (Mouse-over effects in Factor Histogram can be activated while dragging parameter tabs #480)
  • Correctly positions labels when zooming
  • Performs factoring and bin setup in presketch to initiate this potentially lengthy process as early as possible
  • Posts a warning about the number of terms used for an infinite sequence
  • Avoids blocking the browser when the number of terms is huge
  • Renames the Visualizer to FactorHistogram from just Historgram
  • Minor documentation update

Resolves #296.
(Well, actually that was already resolved, just making sure we close it.)
Resolves #449.
Resolves #480.

@gwhitney gwhitney marked this pull request as draft November 5, 2025 00:36
@gwhitney
Copy link
Collaborator Author

OK, this PR is now rebased on ui2 for easier review, showing the correct number of commits and files changed as compared to ui2. I still need to take care of lint and CI tests, which I will get to as soon as I can but it won't be before Monday afternoon. Nevertheless, Kate/Aaron you should be able to start looking over the files and trying the behavior, let me know if you see things that still need work.

@gwhitney gwhitney marked this pull request as ready for review November 26, 2025 03:54
@gwhitney
Copy link
Collaborator Author

OK, all tests pass and I believe all of the alpha-level concerns I know of for FactorHistogram (including renaming it from Histogram) are resolved. Ready for final review, thanks!

@katestange
Copy link
Member

Bug:

  1. Go to URL http://localhost:5050/?name=Polyfactors&viz=FactorHistogram&binSize=10&seq=Formula&formula=n%5E3-n%5E2&last=999&length=1000
  2. Click in the bin size box and decrease from 10 to 1
  3. The visualization axes update but the actual graph does not.
  4. Refresh with the refresh button in top bar, and you get the actual graph you should.

@katestange
Copy link
Member

With this URL: http://localhost:5050/?name=Formula%3A+n&viz=FactorHistogram&seq=Formula&last=1000000000&length=1000000001
it seems to get stuck at "Collecting values....100000". Leaves me wondering.... Does not block the browser though.

@katestange
Copy link
Member

Where is/is not Factor Histogram changed to Histogram? It's still Factor Histogram in the interface and in the URL.

@katestange
Copy link
Member

Running that last test seems to have "broken" the URL http://localhost:5050/?name=Formula%3A+n&viz=FactorHistogram&seq=Formula&last=1000000000&length=1000000001, which will now not populate the window (on any browser). Did I hang something in the backend?

@gwhitney
Copy link
Collaborator Author

Where is/is not Factor Histogram changed to Histogram? It's still Factor Histogram in the interface and in the URL.

No the change is in the other direction, Histogram -> FactorHistogram, to reflect the specialized nature of this visualizer and leave Histogram open for a general histogrammer.

@Vectornaut
Copy link
Collaborator

In the documentation, I'd recommend changing "hashing a portion" to "hatching a portion".

@Vectornaut
Copy link
Collaborator

Vectornaut commented Nov 26, 2025

To someone who's stumbled into Factor Histogram without carefully reading the settings panel or the documentation, the idea of a column for numbers with zero factors might be a little mystifying. One way to clarify might be to rewrite the tooltips as follows, where k is the number of factors, n is the number of entries, and b is the number of entries to big to factor.

k = 0:

n entries with k factors
b entries too big to factor

k > 0:

n entries with k factors

@gwhitney
Copy link
Collaborator Author

With this URL: http://localhost:5050/?name=Formula%3A+n&viz=FactorHistogram&seq=Formula&last=1000000000&length=1000000001
it seems to get stuck at "Collecting values....100000". Leaves me wondering.... Does not block the browser though.

OK, just pushed a commit that attempts to keep progress updates on a reasonably frequent basis at all stages. Let me know if it improves things. You do of course know that a billion terms is hopeless, I'm sure.

@gwhitney
Copy link
Collaborator Author

In the documentation, I'd recommend changing "hashing a portion" to "hatching a portion".

Oh that's interesting. It somehow got into my vocabulary that's called hashing the region of the graph. But web searching I see that hatching is orders of magnitude more common. Will change.

@gwhitney
Copy link
Collaborator Author

3. The visualization axes update but the actual graph does not.

Yes, I forgot to consult the visualizer life cycle diagram, I was computing the bar heights in presketch(), and I forgot that presketch() is not called again for a parameter change, only setup(). So I moved their computation to draw(), once the factorization is finished (can't do it in setup(), since long factorizations are likely still going on when setup() is called). All should be well now.

@gwhitney gwhitney marked this pull request as draft November 27, 2025 07:48
@gwhitney
Copy link
Collaborator Author

Changed to draft until I have a chance to change the text in the hover boxes and fix the documentation mistaken word choice (hashing/hatching)

@gwhitney
Copy link
Collaborator Author

OK, I just pushed a commit with the modified bar labels. But I have encountered what seems like it might be a more serious issue. I can't quite seem to find a foolproof way to get it to happen, but generally speaking it seems to crop up like this:

  1. Start with a fresh window displaying frontscope.
  2. Open the gallery and select Polyfactors.
  3. Change the bin width to 2.
  4. Press the "Change Sequence" button
  5. Here's typically the first sign of trouble: the sample thumbnails of the different sequence change options come up and display and look ok, but the UI freezes up for a few seconds. I can't scroll the thumbnails or select any.
  6. After the UI unfreezes, select the A000045 Virahanka-Fibonacci numbers.
  7. Try mousing over the various bars.. If that seems to work OK, press change sequence again, and if it's working ok, choose a different sequence. If that displays OK, switch back to A000045. Switch back and forth a few times.
  8. Eventually (sometimes just on the first or second switch) I get bizarre visual behavior: black rectangles appearing in random places on the UI, ghost images of bars or hover boxes, the hover box "erasing" bars as I move the mouse around, and/or weird flickering slightly blurry images.

@katestange @Vectornaut I would be very interested to know if either of you can reproduces such odd behavior. If so and if you have any idea what might be going on, I am all ears. Thanks so much.

@katestange
Copy link
Member

OK, I just pushed a commit with the modified bar labels. But I have encountered what seems like it might be a more serious issue. I can't quite seem to find a foolproof way to get it to happen, but generally speaking it seems to crop up like this:

Did this begin with this commit? What browser? I just tried it in Firefox with the (not new commit) version and haven't been able to get weird fragments. It's a bit laggy while collecting factors, and I do have a suggestion that while it is "Collecting factors...." it should blank out the old histogram from the previous sequence (right now that one sticks around until the new one is computed).

@katestange
Copy link
Member

I'm not even able to get significant lag on Chrome, Edge or Opera -- again before recent commits. (Firefox is really much less performant for Numberscope than other browsers, not sure if it's because I'm also running a pile of tabs with jupyter notebooks and stuff.)

@gwhitney
Copy link
Collaborator Author

I haven't tried earlier commits, I will. And yes, I agree firefox is the worst browser to run numberscope on ( so best for testing ;-)

@gwhitney gwhitney marked this pull request as ready for review November 29, 2025 01:21
@gwhitney
Copy link
Collaborator Author

All right, well, I am not able to reproduce the problem myself now, on any browser. Don't know what was going on. Maybe it was actually something running in a different tab. Anyhow, under the timing circumstances, I propose we move on (hard to debug a problem you can't make happen). I have just pushed a commit that fixes the documentation issue Aaron found, and removes some old crufty code that no longer seems to be needed, and fixes the hover box to be within the (very narrow) frustum that the latest version of zoom controls sets up. So I believe this is ready for final review, and merging once it is deemed OK. Will move on to next turtle items as soon as I am able.

@katestange
Copy link
Member

Zooming out on some examples reveals that there is occasionally one too many tick marks on the vertical axis. The screenshot below and the link http://localhost:5050/?name=OEIS+A000045&viz=FactorHistogram&seq=OEIS+A000045&last=400&length=401 are an example.
Screenshot from 2025-11-28 21-18-15

Copy link
Member

@katestange katestange left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@gwhitney
Copy link
Collaborator Author

OK, I think I have addressed all of your comments, except I could not reproduce the last item...

@katestange
Copy link
Member

All tests pass and I don't see anything else to complain about!

@katestange katestange merged commit a1c88c8 into numberscope:ui2 Nov 29, 2025
2 checks passed
gwhitney added a commit that referenced this pull request Jan 12, 2026
* fix: don't post popup when mouse button is down

* fix: correctly position labels when zooming

* refactor: move factoring/bin setup to presketch to get a jump on it

* fix: post warning about terms used for infinite sequence

* fix: don't block the browser when the number of terms is huge

* doc: explain hashing of first bar

* test: changes to ensure full suite of tests pass

* fix: show finer-grained progress on factoring long sequence

* fix: make sure the factor counts are recomputed when parameter change

* chore: reword hover box caption

* chore: remaining PR feedback, remove now-detrimental hover scaling

* fix: don't draw a y-axis tick mark that will get cut off; revert ci.yaml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants