Discovering the 3D Mandelbulb

There is some exciting news this week in the world of fractals. Daniel White, on his website, describes what is apparently a completely new type of fractal, and the closest analog so far to a true 3-dimensional Mandelbrot set!

Although White mentions that this is probably not the “true” 3D Mandelbrot, the new fractal is undoubtedly a sight to behold, especially considering the renderings he showcases on his webpage.

Unable to contain my enthusiasm, I quickly wrote up a small program that uses OpenGL to actually display this shape in 3D, in real time, to get a feel for what this beast looks like from all angles. Don’t get too excited; the program does not render the shape in real time, it just displays the points rendered so far in real time. The actual rendering process can take a minute or so.

Download the program using the link below, and read further for instructions and screen shots.

download

The program basically renders the 3D shape by constructing a “point cloud” that approximates the edge of the fractal.

Everything in the program should be relatively self-explanatory, but here’s a brief overview of the features so far:

  • The program lets you click-and drag the rendered shape to rotate it in trackball fashion (left mouse button), as well as zooming in and out (right mouse button).
  • The program lets you select the “power” of the Mandelbulb formula, as well as the number of iterations to perform.
  • The program lets you select the resolution of the point cloud.
  • It gives you a “selection cube” with which you can select a subset of the shape to zoom in on (with the “zoom to cube” button).
  • It has a number of other minor features like fog and anti-aliasing.
  • It uses multiple threads to render the shape, so it will take advantage of multiple cores/processors.

Here are some additional screen shots:

Manipulating the selection cube:

After zooming in on the cube:

Zooming in further:

Looking inside:

Colorized points:

The program was written in C# with WinForms, using the Open Toolkit Library (OpenTK) which provides an excellent OpenGL wrapper.

Of course, this program is very much in its early stages, so don’t expect it to be perfect. As always, suggestions are welcome!

Make your USB flash drive indestructible!

I don’t know about you, but I’m absolutely in love with USB flash drives (thumb drives, jump drives, whatever you want to call them). I’ve been using them since they first became available. The oldest one I still own is a 16MB drive that I bought for $50 in 2001. The one I currently use is 16GB. That’s three orders of magnitude in eight years — remarkable!

The only problem I have with USB flash drives is when I mistakenly leave them in my pants pockets, and subsequently put the pants into the laundry basket. The flash drive will then suffer the grisly fate of being spun around the washing machine soaked in soapy water, and will most likely never work again. This made me think about possible methods of somehow sealing the flash drive to make it more resistant to the elements, or to physical impact.

Background

At the office where I work, I had found a supply of epoxy that the hardware engineers use for various purposes. This epoxy comes in little packets, with each packet composed of two pouches containing different substances that, when mixed together, produce the hardening epoxy. I knew about the supply of epoxy for a while, but I hadn’t made the connection between the epoxy and the flash drives until one day, in a moment of total enlightenment, I held up my flash drive in one hand, and an epoxy packet in the other, and began to laugh uncontrollably.

I wasn’t sure yet how well the epoxy would work, but everything about the epoxy seemed perfect, including the quantity, and what was written on the packet, which is:

  • Work time: 3 to 5 minutes.
  • Will not shrink.

That same day, I took an ordinary USB flash drive, removed the plastic case so that the PC board was completely exposed, mixed up some epoxy, and poured it onto both sides of the board, making sure that all the electronic components were fully covered, and only the USB connector exposed. After about 5 minutes the epoxy hardened, and the result was even better than I hoped. The flash drive became indestructible!

Wanting to buy some of these packets for myself, I searched for a distributor of this stuff online. The brand of the epoxy is Hardman (aptly named!), and the first result is Ellsworth Adhesives, which sells a box of 100 packets for about $120. After looking a little harder, it seems that you can get the same box for a lot cheaper, such as from HMC Electronics which sells it for $80, which is 80 cents per packet — a great deal. Plus, the box includes popsicle sticks for easy mixing and spreading.

After I received the box, I encased two more flash drives in epoxy, with the same great results. The epoxy becomes rock-solid and impenetrable! Since then, I’ve been epoxying pretty much everything that makes logical sense: more flash drives, card readers, MP3 players, etc.

Advantages

The benefits of epoxying a USB flash drive (or any other small USB device) include:

  • It looks freakin’ sweet
  • It becomes virtually indestructible (the only remaining destructible component is the USB connector)
  • It becomes waterproof. My current flash drive has survived five wash cycles! Of course you have to allow the USB connector to dry completely, but after that, it’s as if nothing happened.
  • The epoxy helps dissipate heat from the flash memory and controller chips.
  • If the device has an LED, it will make the surrounding epoxy glow, which also looks cool.

Instructions

Here are some brief instructions for encasing your own USB flash drive in epoxy:

Safety first: Make sure you do this in a well-ventilated room, and don’t get any epoxy on your skin or in your eyes. And of course, make sure any data that’s currently on your flash drive is backed up, in case anything “unexpected” happens.

  • Take apart your USB flash drive. This is usually as simple as pulling apart the plastic cover that encases the PCB (printed circuit board). Be careful not to damage any of the delicate electronic components that are soldered onto the board. Throw the plastic away. All you should have left is the PCB with a USB connector soldered to it. If you like, you can write your initials on the PCB with a felt-tip pen, so that they’ll be visible through the clear epoxy when you’re finished.
  • Mix up some epoxy. I would recommend using two packets of the Hardman epoxy for an average-size USB drive (one for each side of the PCB). I usually mix the epoxy with a popsicle stick, on top of a sheet of aluminum foil. The epoxy must be mixed very thoroughly, or it won’t harden uniformly. However, don’t take too long to mix it, since it will begin to harden very quickly.
  • Hold the flash drive by the USB connector, allowing one side of the PCB to face up (you’ll repeat this for the other side), and spread some epoxy right onto the exposed PCB with a popsicle stick (or your tool of choice)! Keep adding epoxy until all the electronic components are completely covered by it, right up to the connector (don’t put any epoxy on or inside the connector itself). Do your best to keep the epoxy well-contained. It can get messy fast.
  • Keep holding the flash drive with the epoxied side facing up, so that the epoxy settles evenly throughout the surface of the PCB. If some of the epoxy starts to drip off the edge, let it drip, or scrape off the excess with the popsicle stick. The epoxy creates an exothermic reaction while setting, so it might get a little warm, but don’t be alarmed — it won’t get too hot to touch. Don’t let anything come into contact with the epoxy while it’s setting, so that you’ll get a smooth, glossy surface.
  • After holding for a few minutes, the epoxy should harden, at which point you can flip over your flash drive and repeat the procedure on the other side of the PCB.
  • When the epoxy on both sides of the PCB has hardened, you’re done! You might want to wait an additional 24 hours for the epoxy to really harden, though.
  • Enjoy your flash drive, which is now stronger than ever, looks slick, and is completely impervious to the elements!

So, then, aside from USB flash drives, what kind of things are you planning to (or have already) encase in epoxy?

(Thanks to Lifehacker for picking up this story)

The Math Book: Get it Now!

Cliff Pickover, the prolific author of more than forty popular science and mathematics books, has outdone himself with his latest compilation: The Math Book. This is a collection of 250 “milestones” of mathematics throughout history, complete with breathtaking glossy color illustrations for each entry (a first for his books), as well as insightful descriptions that explain the history and the significance of each of these marvels of mathematics.

This book is especially significant in one other way: it contains my artwork! The book’s entry on Knight’s Tours (p. 186) familiarizes the reader with the history of this problem, dating all the way back to Euler in 1759. And, alongside the article, Pickover displays a 30×30 knight’s tour that was solved by my neural network knight’s tour implementation. For the picture in the book, I used a modified version of the program that generated a sufficiently hi-res image. That particular knight’s tour took about 3 days for my computer to generate.

I’m deeply grateful to have one of my creations published in a book by someone as influential as Cliff Pickover. Of course, it’s all of the 250 entries in the book that make it an incredibly fascinating stroll through the history of mathematics. As mentioned elsewhere, this book definitely has bestseller potential, and could easily be one of Pickover’s best works. Buy the book now!

Remembering a dear friend

Today marks the death of one of our most beloved friends, Robin Klauss, at the heartbreaking age of 29. I remember clearly when, during one of our countless karaoke nights which were usually filled with joy and laughter, she revealed the news of her cancer diagnosis. During the previous weeks, she had noticed a small bump on the back of her neck, which she thought might be a spider bite. But the bump wouldn’t go away, and eventually she started noticing a decrease in mobility in her neck and arm. After a visit to the doctor, she was told that it’s not a spider bite, but cancer  – a tumor in her neck that had already begun to invade her vertebrae and spinal cord.

During her experience with cancer, she wrote a few brief posts on her LiveJournal account, which I thought I’d re-post here, since that account is obviously no longer maintained, and will likely be shut down eventually. Here are the posts in chronological order (take note of the startlingly fast progression of the disease):

Jun. 18th, 2008
I’ve been diagnosed with adenocarcinoma of an unknown primary. Being an unknown primary it’s automatically labeled stage IV. Thought you might like to know.

Jun. 19th, 2008
My throat hurts so bad from the radiation. I feel like there’s this giant scab on the back of my throat and that I’m swallowing steel wool. The radiation oncologist that is on-call tried to call in a prescription for some kind of numbing something or-other but the pharmacist doesn’t have the lidocaine or whatever to mix it. 🙁 I tried to use chloroseptic spray but I couldn’t get it far enough back (and it tastes like shit). I so fucking hate this.

Jul. 2nd, 2008
So, today I had my 1 month follow up after the radiation surgery. On the bright side, all three of the docs I saw today were ecstatic about my progress. The neuro-oncologist about fell out of her chair when she was my arm movement was back. She said I am “the poster child for stereo-tactic radio-surgery.” 🙂 No chemo yet. 🙂 I have another follow up in 2 months to see how the tumor is doing. So, if it’s still there, then maybe chemo? No clue. I am having some pain at the top of my head on the right side. My medical oncologist said to keep an eye on it and let him know if it gets worse or if I notice any new pain. The main goal is to keep an eye out for any new metastases. However, the pain I’m having on my left side may be due to how the tumor destroyed the C3 and C4 vertebrae. There may be instability in my neck and the ligaments may have relaxed. Whatever that means. My neuro-oncologist ordered 6 x-rays of my neck and will be presenting my case to a spinal tumor board tomorrow to see if other doctors and neurosurgeons think I should have surgery on my neck to help stabilize it. The last thing I want is surgery and to miss work, however, I am also completely terrified that I will crack my neck because of how fragile it is. I doubt I’ll find out what she has to say tomorrow, hopefully on Monday.

Jul. 15th, 2008
Yesterday I had an appointment with a neurosurgeon regarding strengthening my neck. First, and most importantly, he was really hot. His PA wasn’t bad looking, either. Lucky me! Second, I need to have neck surgery next Friday, July 25. He said the when the cancer invaded my C3 and C4 vertebrae, it replaced bone with cancer. So now my neck is slowly collapsing to the right side and fracturing because there’s nothing there to support it. Surgery doesn’t have to be done ASAP but much sooner rather than later. Basically, if I don’t have the surgery, my neck will break. He said something about putting mesh cages and bone graft or something in the destroyed vertebrae. There will be two incisions, one in the front, then they’ll flip my fat ass over and then another in the back. I don’t know how big the front incision will be but he said the back will be about 4″. I’ll spend 5-6 days in the hospital and about a week in rehab and then recover for 2-4 more weeks. Yup. I’m a lucky girl!

Aug. 1st, 2008
I had the surgery last Friday. The surgery itself was over 11 hours long. They wheeled me away at 7:30am and my parents didn’t get to see me again until around 9:00 that night. My mom said, for some reason, the surgery didn’t start until 9:30ish but I only remember them wheeling me away, asking me a couple of questions and being in the operating room for about 3 minutes and I can’t remember anything else. For some reason hot doc didn’t do the mesh cage thing he was talking about and instead did metal plates and screws. This will make it a blast to travel. I’ll be setting off metal detectors like a freakin’ terrorist. Okay, it won’t be that bad. He did say that the plates are not supposed to set off metal detectors but I will have some card to say that I have this stuff in my neck to get me out of jail. After surgery they checked my breathing and I wasn’t breathing on my own so the intubated me with a different/smaller kind of breathing tube and I was unconscious in ICU until they woke me up to extubate me on Sunday morning. They didn’t move me into a regular room until Monday afternoon and I was finally discharged Wednesday afternoon. I didn’t have to go to rehab because 1.) my pain is negligible and 2.) I’m moving surprisingly well. Hot doc took a bone graft from my right hip and, right now, that’s what hurts and makes life difficult. I freakin’ walk like Frankenstein’s monster because I have to take it easy. My throat is also killing me, not only because of the intubation, but also because of the surgery. Hot doc said he would have to move my esophagus aside to be able to get to the vertebrae and the pain is normal and should go away soon. It definitely is getting better every day but it still hurts like hell. I have to wear a neck brace at all times except when I shower or eat. I can’t bend or twist my head and no lifting anything over 10 pounds. I’m recovering at my parent’s house, where I’ll be for the next 5 weeks. 5 weeks! Agh! And I can’t drive because I can’t turn my head so I am literally depending on them for EVERYTHING! I feel like a 2 year old. My mom makes my food and does my laundry and they’re both there when I go for a walk because they need to be there in case I fall or something. Because the biopsy was so unclear, hot doc removed some of the tumor and sent it off to pathology. Hopefully it will tell us more about what kind of cancer this is and the best way to treat it. He definitely thinks chemo is a good idea, so that will be starting soon. Everyone keeps saying I shouldn’t be so sure that it will be the kind where I’ll lose my hair, but I’m pretty damn sure it will be. I wonder if bald is is this season? Also, I have to renew my driver’s license in September… What will it say under hair color? Bald?

Aug. 24th, 2008
So nothing new has been happening. I was hoping to be back home this weekend but I’m still at my parent’s house. Hopefully I will be back in C-bus next weekend. The incision on the back of my head isn’t healing well. It seems like a couple of stitches popped before it was healed so now I have a hole in the back of my head. My dad said it’s slightly smaller than a dime but it’s not really healing. I saw my hot neurosurgeon on Tuesday because of it not healing. He had us put packing in the hole for a few days and now we’re doing this wet/dry thing where my mom has to clean the hole out with saline and then put dry gauze on it. We’re supposed to do it 4 times a day. He wants to see me again tomorrow and said that he didn’t want me to go back to work yet. I’ll find out tomorrow if he’ll let me go back to work next week. I really don’t mind seeing him again. He’s so freakin’ hot! He called me at my parent’s house yesterday morning to see how it’s healing. He really had to do some searching because I changed all of my phone numbers in my chart to be my cell, house and work numbers. I really have no clue where he got there number. And he said he wants to see me when I have my next oncologist appointment in September. Then I’ll also see him when I have my next follow up with him in October. I think he’s just smitten with me and he’s too shy to make his move. Okay. I’m delusional but it could happen, right?

Sep. 8th, 2008
I went in for my three month follow up today. The tumor has grown 1 cm since the beginning of July and it looks like some new lymph nodes are involved. My oncologist wants me to have a PET scan to see if the lymph nodes are really involved with the cancer or if they’re just inflamed from the surgery. He offered me three options to deal with the cancer: 1) do nothing, which is not an option at this point, 2) some kind of clinical trial that involves one type of chemo, given once every three weeks, and a daily pill that is used to treat TB, 3) a chemo cocktail that is three different kinds of chemo given at once. The clinical trial will waste too much of my FMLA time. I only have about 5 weeks left. The trial is divided into 2 different phases for a total of 37 days straight. Out of those 37 days, I would need to be at the hospital for at least 13 of the days. That’s not including days that I feel too tired or whatever to go to work. Following the 37 days, it would be just chemo once every three weeks until my doc says it’s done. I don’t like the idea of wasting all of those FMLA days. That will leave me with about 12 days for chemo after the first 37 days and for days I don’t feel well or am too tired. My mom thinks I’m choosing work over my health but she fails to remember that it’s because of work that I have health insurance to pay for all of this. If I lose my job, I lose my health insurance. Also the chemo is only given on Mondays. That leave no time for me to recover before I have have to drive 2 1/2 hours back to Columbus. So I’m opting for the third choice, the three chemo cocktail. It’s also once every 3 weeks but it doesn’t require the time commitment the trail does. I am going to wait to get a second opinion. I want to see a doc at the James but I’m having a hell of a time getting in to see someone. I would much rather have chemo here and recoup at my place. My job this week is to be a pain in the ass and call every doc I know at the James to get someone to refer me to a medical oncologist. Hopefully I won’t be dicked around.

Sep. 10th, 2008
I was able to find an oncologist at the James! I called someone, who talked to someone else and said, “Oh, yes, I remember talking to Carrie about you before. You mean no one ever called you to schedule an appointment?” *head desk* So I’m totally not going to go back to see that guy in Cleveland. It works out so much better for me to see the oncologist here. I have to take a whole day off work for a 30 minute appointment, versus just a couple of hours. And I’ve already seen a radiation oncologist and a neurosurgeon at the James who have said in the past that they would take care of my 3 month check-ups, if I want them to. What the Cleveland oncologist said is that this thing will never go away. We can only hope to decrease or maintain the size of it before it spreads further. Fantastic. With my birthday coming up it makes me wonder, how many more birthdays will I have?

Sep. 24th, 2008
I finally got to see the new oncologist at the James today. He wants me to have a PET scan tomorrow and start chemo on Friday. When I told my mom and my co-workers everyone had the same look of “holy crap! so soon!” on their faces (well, in the case of my mom, she said it). It’s about time. I’m in so much pain. The pain killers I have stopped working so well last week. I hate taking them and I’m totally afraid I’m going to get addicted to them but I really do need them to function.

She didn’t do any more writing after that, likely because of the effects of the pain killers or the chemo. And of course we hardly saw her anymore because the medications and the pain kept her virtually immobile at home, and cared for by her family.

In her second-to-last post, Robin asks how many more birthdays she would get to celebrate (she had just turned 29). The answer turned out to be zero. The cancer would claim her life just over a year after the initial diagnosis. That’s the cruel, cold, indiscriminate nature of this disease. Once we get past the bewilderment of contemplating that this could happen to any of us, all we can do is cherish every moment we get with our friends and loved ones, and remember the happiness and warmth that Robin brought to our lives.

Here is Robin during a random night out, expressing what would later become her response to cancer:
(taken from my crappy Motorola phone at the time)

The open-mindedness of skeptics

Today I’d like to briefly discuss the issue of open-mindedness, since I grow more and more alarmed by the rate at which this issue comes up in debates between skeptics and “believers” in alternative medicine, religion, the paranormal, the supernatural, and all sorts of other products of human imagination.

At this point the astute reader might point out, “Aha, you’re already presupposing that these things are products of imagination, so your mind is already closed to other options!” This is not the case. I believe that these things are products of imagination because that’s what they appear to be, based on all available evidence, so they are very probably imaginary. Is it possible that they are real, and not imagined? Of course! Show me evidence that is convincing enough (that is, evidence that’s as grandiose as the claim itself), and you’ll make me a believer (that is, you’ll make me believe that your claim is very probably real)!

I have changed my mind regarding various claims plenty of times in the past, precisely for this reason: I was shown convincing evidence (or found it myself) that made me reverse my views on a particular subject.

A brief analogy. Okay, not so brief.

When I was younger, I used to believe that I exerted some sort of energy that made street lights turn off exactly as I would drive underneath them in my car (this is apparently a common illusion). This didn’t quite sit well in my mind: why me? Am I really that extraordinary? Why doesn’t every driver cause street lights to go out? Then I decided to research the facts: I found out how street lights work, and I read up on some of the workings of human psychology, namely selective memory. And before long, I understood that the light bulbs are on a duty cycle (they periodically turn on and off to prevent overheating), and that my mind was assigning special significance to the times when a street light happened to turn off directly above me!

Did I feel saddened by the notion that I was no longer extraordinary? Maybe for a brief moment, but the reality check was soon overtaken by a feeling of enlightenment. It felt good to understand the real reason behind a phenomenon that was poorly understood (by me, at the time). Instead of living with a superficial pseudo-understanding of how things work (where I am endowed with street light powers), I felt extraordinary because I gained a much more meaningful understanding of the real world.

So what does this have to do with an open mind? Well, consider this. Suppose I meet a person (let’s call her Alice) who absolutely insists that the street light phenomenon is actually genuine — that people do, in fact, emit an energy field that causes street lights to turn off above them.

When I present all the research I did regarding street lights and human psychology, Alice dismisses it as inconclusive and insufficient. When I say that there is a perfectly good natural explanation for the phenomenon, Alice claims that her explanation is better because it feels right to her. She gives me a list of testimonials from her friends who have also experienced the phenomenon, and says, “they can’t all be wrong, can they?” When I show her the mathematics that proves how statistically likely it is to see a street light turn off during any drive, she insists that the number of times that she’s seen it can’t be a coincidence.

When I ask her to show me peer-reviewed publications on the reality of this effect, she says that she doesn’t have access to them at the moment, but assures me that they exist. When I ask her if she would be willing to perform a blinded test of her abilities, she refuses, saying that the street lights turn off only when she doesn’t think about it or least expects it.

When I ask her to explain the physical processes that she thinks are behind the phenomenon, she begins talking about quantum mechanics, saying that all particles are entangled, that our intentions can change the course of quantum reality, and that we, as observers, can choose the outcome of wavefunction collapse.

When I try to correct her naive understanding of quantum mechanics, she says that science doesn’t have all the answers. When I tell her that I used to believe in the same explanation that she does, except I learned better, she proceeds to state that I am hopelessly closed-minded and, with a tone of pity, says that I will never be able to control street lights like she can, because I don’t believe in it enough.

Sound familiar?

While the above analogy is a bit of a straw man (or straw woman in this case), the vast majority of debates between skeptics and “believers” take on exactly the above format. The believer, frustrated by the skeptic’s unwillingness to accept her extraordinary claim without sufficient evidence, resorts to calling the skeptic closed-minded.

Let’s think about the definition of an open mind. I would consider an open-minded person to be someone who is able to objectively evaluate new evidence, and integrate it into his or her framework of theories regarding the world. “Objectively” evaluating evidence means evaluating it regardless of personal interests, emotional appeal, profit motive, or peer pressure.

It is abundantly clear that, in the above scenario, it’s Alice who is closed-minded, because she is either unable or unwilling to honestly evaluate the real reasons for the street light effect.

However, the question remains: Am I closed-minded for being unwilling to consider Alice’s theory that she has psycho-kinetic powers? Well, that’s a bit of a loaded question. First of all, Alice does not have a theory that explains the effect. Saying that the effect is caused by telekinetic powers is a bit like saying, “It’s magic” — it doesn’t constitute an explanation, because it doesn’t explain how the process actually works.

Alice would have to define what exactly her powers are, their range and intensity, and how these powers can be reconciled with currently known laws of physics. If she claims that current physics are insufficient to explain her powers, or that she has tapped into a “new” law of physics, she suddenly has an entire world of physicists to contend with, all of whom agree on well-established physical laws that preclude such powers.

The only thing that would pique the interest of the world’s physicists is a simple test — an experiment that shows, repeatably, that the laws of physics do not apply to Alice. Is that too much to ask? As long as such an experiment does not exist, we have no reason to believe that Alice has any powers except an overly active imagination.

Replace the street light effect with any other extraordinary claim (energy medicine, life-force, zero-point fields, astrology, dowsing, etc), and the conclusions turn out the same: if the claim is real, it would undermine one or more laws of physics. In any case, the evidence for such a claim would have to be at least as spectacular as the claim itself.

In short, I am open-minded to any new evidence, whether it supports my worldview or contradicts it. However, I have some sensible constraints on what passes as “evidence.” As the immortal saying goes, I have an open mind, but not so open that my brain falls out.

If you are making extraordinary claims that are not supported by our current theories about the world, all I ask is that you demonstrate something, anything, that supports your claims, and shows that whatever you’re demonstrating isn’t just in your mind.