While working on How to make the digits of π go around in a spiral like this? I encountered a problem that Mathematica would crash at regular intervals with an internal self-test error, either NoteFont2 or winFont. After lots of trial and error (and restarting Mathematica dozens of times) I have managed to break it down to a minimal (not-)working example:

    FontSize -> 20.1*0.999^(#2[[1]])
    ] &,
  RandomInteger[9, 4000]

My theory is that Mathematica crashes once it had to use too many different font sizes in the same session. This is because you can also provoke the crash by reducing the 4000 to a smaller number and running the code multiple times with different values for 20.1, whereas if you run it over and over for 1000 samples say but without changing the 20.1, the error will not occur. Interestingly, when you use 20 instead of 20.1, 4000 samples won't suffice for a crash (but increasing the 4000 will).

I'm fairly confident this is a bug, and I doubt much can be done about it except waiting for the devs to fix it. But my question is, how can I work around this? I'd love to provide a complete answer for the linked question, but it will need many different font sizes to fill in the spiral completely. Can I accomplish that without provoking this crash? I tried using ScalingTransform instead of Style[..., FontSize->...] but that doesn't seem to affect the size of the characters at all (but only their position instead).

  • $\begingroup$ Personally, I would wrap the rhs of FontSize with Round. There is probably not going to be a huge visual difference between FontSize specs of 20.0799 and 20. $\endgroup$ – ihojnicki Mar 14 '16 at 15:28
  • $\begingroup$ @ihojnicki Unfortunately for my use case (the linked question) it is actually quite noticeable, even with Scaled[Round[..., 0.01]] because you're expecting a very smooth gradient of font sizes (and when I round to 0.001 I get the error again). $\endgroup$ – Martin Ender Mar 14 '16 at 15:31
  • $\begingroup$ How much RAM do you have? MMA 10.0.2 on Linux doesn't crash in my computer when running your code even with 100000 random numbers, it just gets slow. For the Pi-question I can complete the circle with more than 2000 digits without crashing. $\endgroup$ – Gypaets Mar 14 '16 at 15:33
  • $\begingroup$ 10.1 runs 4000 but hangs at 10k. (32GB windows). Its throwing internal self test error in the message window (flashing by too fast for me to capture the exact message ) $\endgroup$ – george2079 Mar 14 '16 at 15:39
  • $\begingroup$ @MartinBüttner Ah Scaled[], that is especially hard on the Windows FrontEnd. In that case, you are probably better off importing the text as primitives and transforming them as needed. $\endgroup$ – ihojnicki Mar 14 '16 at 15:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.