Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quantum simulation effect #23

Merged
merged 7 commits into from
Jan 17, 2021
Merged

Quantum simulation effect #23

merged 7 commits into from
Jan 17, 2021

Conversation

quantumjim
Copy link
Contributor

@quantumjim quantumjim commented Dec 28, 2020

Each coordinate is assigned a bit string such that the Hamming distance can only be large between two bit strings if the Euclidean distance between the coordinates is large. That's something that's tricky even on a grid, and worse on a Christmas tree!

The lights are then controlled by a simulation of a quantum computer. I basically use the same effect as I once wrote a blog about here.

The script uses the actual board and neopixel when available, and otherwise tries to use sim.py from #5.

@quantumjim
Copy link
Contributor Author

I just thought I'd add a better summary of the effect.

Basically, the (almost) 512 light are associated with the 512 vertices of a 9-dimensional hypercube. The 'classical' version of the effect just does a random walk around this hypercube

  • initially assigning each light with a 9-bit string
  • starting off by lighting up the '000000000' string
  • moving by choosing a random bit and flipping it

Of course, the tree is not a hypercube. If the bit strings were randomly assigned, this process would have the light randomly flitting around. So instead I tried to assign them in the most sensible way I could, trying to have neighbouring vertices on the hypercube correspond to neighbouring lights on the tree. This is not entirely possible, so some flitting around through will happen. But it hopefully ends up like a random walk on a tree, but with a few added wormholes!

The quantum effect uses the same bit strings, but it does quantum interference stuff instead of just randomly applying bit flips.

@oliverdunk
Copy link
Member

Hey @quantumjim! Love your PR - really fascinating idea behind the effect and a very thorough description.

Matt asked if I could help with maintaining this repository, so I've been thinking about how best to do that. I've decided to create an examples folder where we can add contributions like this one - you can find some more information in the README.

Would you be up for updating your PR, to move your effect in to the examples folder?

@quantumjim
Copy link
Contributor Author

Thanks @oliverdunk! I moved it, and made a few other improvements while I was at it

Copy link
Member

@oliverdunk oliverdunk left a comment

Choose a reason for hiding this comment

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

Left a few extra comments! Thanks for the changes you've made already.

examples/quantum.py Outdated Show resolved Hide resolved
examples/quantum.py Outdated Show resolved Hide resolved
@oliverdunk
Copy link
Member

Thanks for all of your work on this @quantumjim! Time to get this merged.

P.S: I read your blog post a few days ago which was a good read!

@oliverdunk oliverdunk merged commit d824656 into standupmaths:main Jan 17, 2021
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.

2 participants