Can ChatGPT Prove I Was an Idiot in 1989?
Yes. (And so can Google and GitHub CoPilot.)
To elaborate, in 1989 I was in my senior year of college and the new hotness was Chaos Theory, Fractals and especially the Mandelbrot Set. Articles, books, TV shows, all claimed this would revolutionize the world--sound familiar? Anyway, I decided to write an honors thesis on the mathematics as I was a math major and thought I knew some stuff. I did not.
I recall one book I "read" about the Geometry of Fractal Sets. It was 177 pages in a pocket sized format. I literally spent hours with my advisor puzzling over a page, no a line, no, a single symbol. (Google happily provides me with post-traumatic flashback stress by producing the whole book here: https://mate.dm.uba.ar/~umolter/materias/referencias/1.pdf)
So I hand-waved my way through the real math of an isomorphism diagram, which my adviser told me it would be the first of many in my career--it was my last. And instead focused on some of those pretty pictures of fractals that I had seen in the book The Beauty of Fractals.
This is where ChatGPT comes in. I wrote some abysmal BASIC code and ran it on the fastest computer available to me, and the only one with color graphics: an Epson Equity III with a 286 processor and EGA graphics (16 colors!) located behind the locked door of the Computer Lab. I would fire up the machine, run my code, hang on sign saying "Don't Touch" on it, and come back 8+ hours later for the, hopefully successful, result.
And then I printed it on the only color printer--dot matrix color mind you. That also took hours.
But why did I use BASIC? I did know other computer languages: Pascal I used, and had heard of C. Both would probably be faster, but I never thought to try. I didn't know how to do graphics in either one, so I just took the easy route.
I said ChatGPT, right? In 2023, here's my prompt: could you translate the my BASIC code into Pascal suitable for Turbo Pascal made by Borland in 1989 and also for Turbo C.
And it worked! Had I had ChatGPT back in the day, I could have saved a lot of time. (And possibly burned as a witch.)
领英推荐
So I went a little, um, crazy on a Sunday afternoon. I asked ChatGPT to rewrite it in C++, Julia, Rust, Python, and x86 Assembly. And then to make parallelized versions of some of them. If you really want to know, the code is here: https://github.com/dsagman/mandelbrots
So how fast could we go if we use my Framework laptop in 2023 instead of a PC in 1989. A lot fast.
Instead of nearly 9 hours, or best case of 8 minutes in 1989, we can have the same image in 3 hundredths of a second.
Here's some interesting facts:
; z = z * z + c, where z is (cx, dx), c is (ax, bx) in complex numbers
; You have to implement the multiplication and addition for fixed points.
; Below are stubs representing the concept.
; Calculate z * z for both parts (real and imaginary).
; Stub: zreal = cx cx - dx dx, zimag = 2 cx dx
; ... (implement fixed-point multiplication and subtraction)
; Add c to the result.
; Stub: zreal += ax, zimag += bx
; ... (implement fixed-point addition)
Anyone want to try some other languages?
Adjunct Faculty Department of Mathematics at Western Michigan University
1 年What are you up to over the holidays?
Adjunct Faculty Department of Mathematics at Western Michigan University
1 年Who was your advisor?