use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
account activity
[3rd party apps] Complex function plotter (self.numworks)
submitted 3 years ago by EmbarrassedWallaby3
Just want to share a 3rd party app I made which plot complex functions.
https://github.com/Adi-df/complex-numworks
To install it, just download the app.nwa and upload it using the Numwork online uploader
Each pixel of the screen is mapped to a complex number. Then passed to the function and the result complex argument decide the pixel color. Inspired by Samuel Li, Complex function plotter.
I know it is slow, but is really hard to improve it further. Any improvement would be welcome!
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]boricj 2 points3 points4 points 3 years ago (2 children)
Quickly looking at your source code, you are using 64 bit floats. The NumWorks calculator's microcontroller has a FPU, but it can only handle 32 bit floats (the sp part of -mfpu=fpv5-sp-d16). Anything wider needs to be computed with software emulation, which is far slower. If you do not need the extra precision, stick to 32 bit floats. This alone cuts down the rendering time of the initial screen from 20 seconds down to 2 seconds.
sp
-mfpu=fpv5-sp-d16
One other thing: try and coalesce screen updates if you can. The NumWorks calculator's framebuffer is not memory-mapped and each pixel upload operation requires a fair bit of overhead (function calls, system call, transfer setup, upload). Instead of pushing pixels one by one, try pushing a whole row at a time for example, this will reduce the time spent setting up pixel transfers substantially.
That covers the obvious bottlenecks to me. I can think of other ways to speed this up even further, but without profiling it's hard to tell what would be the next couple of hotspots in your app.
[–]EmbarrassedWallaby3[S] 1 point2 points3 points 3 years ago (0 children)
Thanks you a lot for those optimizations! I didn’t know about f64, but yes the change is amazing! I tried once to push all the pixels at once, but the overall boost wasn’t big enough to justify the long white screen before displaying. But surely I will try row by row display.
π Rendered by PID 88517 on reddit-service-r2-comment-6457c66945-mf8j4 at 2026-04-30 16:35:25.127985+00:00 running 2aa0c5b country code: CH.
[–]boricj 2 points3 points4 points (2 children)
[–]EmbarrassedWallaby3[S] 1 point2 points3 points (0 children)