CyberIntel ⬡ News
★ Saved ◆ Cyber Reads
← Back ◌ Quantum Computing May 20, 2019

Is there any online Bloch sphere simulator?

Quantum Computing SE Archived Mar 16, 2026 ✓ Full text saved

While writing this answer I realized it would be really helpful if I could show the OP a video or .gif of how qubit states in Bloch spheres transform under certain unitary operations. I googled up a bit and could find only these two simulators: Bloch Sphere Simulation (Stephen Shary and Dr. Marc Cahay) Wolfram Demonstration Project: Qubits on the Poincaré (Bloch) Sphere Both involve some messy software installations and I don't really want to do that. The second one apparently doesn't even allow

Full text archived locally
✦ AI Summary · Claude Sonnet


    Is there any online Bloch sphere simulator? Ask Question Asked 6 years, 10 months ago Modified 5 days ago Viewed 10k times 17 While writing this answer I realized it would be really helpful if I could show the OP a video or .gif of how qubit states in Bloch spheres transform under certain unitary operations. I googled up a bit and could find only these two simulators: Bloch Sphere Simulation (Stephen Shary and Dr. Marc Cahay) Wolfram Demonstration Project: Qubits on the Poincaré (Bloch) Sphere Both involve some messy software installations and I don't really want to do that. The second one apparently doesn't even allow the user to input arbitrary 2×2 operators! P.S: It would be great if Craig Gidney could add a full-fledged Bloch sphere simulator within Quirk at some point (ideally, by making the already existing Bloch sphere views of the qubit states clickable and enlargeable). :) resource-requestsimulationbloch-sphere Share Improve this question Follow edited May 20, 2019 at 19:23 asked May 20, 2019 at 13:21 Sanchayan Dutta 18.2k9 9 gold badges 56 56 silver badges 118 118 bronze badges Add a comment 7 Answers Sorted by: Highest score (default) Date modified (newest first) Date created (oldest first) 10 This doesn't really answer the question as it's not an online simulator. It might still be relevant though as it is a way to produce this sort of gifs if one has access to the software. It is relatively easy to do this sort of things using Wolfram Mathematica. As a quick and dirty example, if we just define a couple of relevant helper functions: pauliX = PauliMatrix[1]; pauliY = PauliMatrix[2]; pauliZ = PauliMatrix[3]; ClearAll@decomposeInPauliBasis; decomposeInPauliBasis[matrix_?MatrixQ] := { Tr[matrix.pauliX], Tr[matrix.pauliY], Tr[matrix.pauliZ] }/2; decomposeInPauliBasis[vec_?VectorQ] := Re@{ Dot[Conjugate@vec, pauliX, vec], Dot[Conjugate@vec, pauliY, vec], Dot[Conjugate@vec, pauliZ, vec] }; ClearAll[simulateStateEvolution, smallestEigenvectors]; smallestEigenvectors[matrix_, howmany_Integer] := With[ {nn = Norm@Flatten@matrix}, Eigenvalues[matrix - nn IdentityMatrix[Dimensions@matrix], howmany] + nn ]; simulateStateEvolution[H : (_Symbol | _Function | _CompiledFunction), time_: 1., initialState_: None] := Module[{t}, Module[{\[DiamondSuit]initialState, \[DiamondSuit]H}, If[initialState === None, \[DiamondSuit]initialState = First@smallestEigenvectors[H[0], 1], \[DiamondSuit]initialState = initialState ]; (* protect from symbolic evaluation *) \[DiamondSuit]H[ t_?NumericQ] := H[t]; NDSolveValue[{ \[Psi][0] == \[DiamondSuit]initialState, \[Psi]'[t] == -I \[DiamondSuit]H[t].\[Psi][t] }, \[Psi], {t, 0, time} ][time] ] ]; we can then visualise the evolution in the Bloch sphere with hamiltonian[t_] := pauliZ + 2 pauliX; initialState = {1, 0}; With[{points = Table[ decomposeInPauliBasis@ simulateStateEvolution[hamiltonian, t, initialState], {t, 0, 1, 0.01} ]}, Graphics3D[{ {Orange, Opacity@0.2, Sphere[{0, 0, 0}, 1]}, {Red, PointSize@0.02, Point@points[[1]]}, {Blue, PointSize@0.02, Point@points[[-1]]}, Dashed, Thickness@0.005, Arrow@points }, Axes -> True, AxesOrigin -> {0, 0, 0}, AxesStyle -> Black, Ticks -> None, Boxed -> False] ] which gives We can also use a time-dependent Hamiltonian, for example: hamiltonian[t_] := pauliZ + t pauliX; initialState = {1, 0}; With[{points = Table[ decomposeInPauliBasis@ simulateStateEvolution[hamiltonian, t, initialState], {t, 0, 4, 0.01} ]}, Graphics3D[{ {Orange, Opacity@0.2, Sphere[{0, 0, 0}, 1]}, {Red, PointSize@0.02, Point@points[[1]]}, {Blue, PointSize@0.02, Point@points[[-1]]}, Dashed, Thickness@0.005, Arrow@points }, Axes -> True, AxesOrigin -> {0, 0, 0}, AxesStyle -> Black, Ticks -> None, Boxed -> False] ] If you want something a bit more fancy, you can take the code I used in this answer to draw a better looking Bloch sphere, which would give something like the following: Finally, if you want some animation, you can try something like the following (where I'm also adding the green line to denote the instantaneous eigenvector of the Hamiltonian): hamiltonian[t_] := pauliZ + t pauliX; initialState = {1, 0}; timesList = Range[0, 4, 0.01]; With[{points = Table[ decomposeInPauliBasis@ simulateStateEvolution[hamiltonian, t, initialState], {t, timesList} ]}, Animate[ Graphics3D[{ {Orange, Opacity@0.2, Sphere[{0, 0, 0}, 1]}, {Red, PointSize@0.02, Point@points[[1]]}, {Purple, PointSize@0.02, Point@points[[idx]]}, {Darker@Green, Thickness@0.01, InfiniteLine@{-#, #} &@ decomposeInPauliBasis@ First@Eigenvectors@hamiltonian@timesList[[idx]]}, {Dashed, Thickness@0.005, Tube@points[[;; idx]]} }, Axes -> True, AxesOrigin -> {0, 0, 0}, AxesStyle -> Black, Ticks -> None, Boxed -> False], {idx, 1, Length@points, 1} ] ] (quality and smoothness can definitely be improved here) Share Improve this answer Follow edited May 23, 2019 at 14:08 answered May 22, 2019 at 14:09 glS♦ 28k7 7 gold badges 43 43 silver badges 139 139 bronze badges Add a comment 7 Have you tried the Bloch Sphere Playground Application? It just might be what you are looking for. Bloch Sphere Playground Application https://javafxpert.github.io/grok-bloch/ Share Improve this answer Follow answered Jan 15, 2020 at 1:34 ProfVersaggi 2132 2 silver badges 5 5 bronze badges This link, unlike the other Block sphere simulator's google was giving me, finally helped me to understand what I missing about phase. (Well there are tonnes and tonnes of other things I'm still missing, but at least I'm over one hump thanks to you. –  Joel Roberts Commented Jun 10, 2024 at 0:58 Add a comment 7 Let me plug my pet project: https://attilakun.net/bloch It allows you to enter arbitrary 2x2 matrices and visualize how the quantum state is affected by them. In the below example the red arc shows how the H matrix transforms the |0⟩ | 0 ⟩ state (yellow arrow) into |+⟩ | + ⟩ : Also, it's open source if you want to play around with the code: https://github.com/attila-kun/bloch Share Improve this answer Follow answered Jan 23, 2021 at 22:23 Attila Kun 5995 5 silver badges 10 10 bronze badges Add a comment 6 I used this last time I needed to look up something about Bloch sphere. It's not perfect, since it doesn't allow entering the exact values of angles, let alone 2x2 matrices, but it has the benefit of being available online. This one looks promising in that it allows to enter matrices (and is also online), but I haven't tried it. Share Improve this answer Follow edited May 20, 2019 at 17:08 Sanchayan Dutta 18.2k9 9 gold badges 56 56 silver badges 118 118 bronze badges answered May 20, 2019 at 16:00 Mariia Mykhailova 9,3451 1 gold badge 14 14 silver badges 41 41 bronze badges Erm, tried the second one. Not sure how it works. Ticked "active" for Ψ 1 Ψ 1 , entered 0,0 corresponding to θ 𝜃 and ϕ 𝜙 and tried with the pre-defined unitaries. The top display shows an empty Bloch sphere. –  Sanchayan Dutta Commented May 20, 2019 at 16:13 None of the links worked for me. Up-to-date Firefox (67.0) on Linux. I don't know if Chrome users or Mac/Windows users had more chance. –  Adrien Suau Commented May 23, 2019 at 12:13 @Nelimee Odd, the first one worked for me (Firefox on Ubuntu). –  Mariia Mykhailova Commented May 23, 2019 at 15:58 Add a comment 4 I see this thread is a little old but if folks are still looking, here's my pet project showing 2 Bloch spheres. In addition to the full array of standard gates (1 and 2 qubit), the simulation also generates Q# code (and output) on the fly which you can paste and run directly into a Q# program. Given there are 2 qubits, you can also see when they get entangled. It's all written in Javascript and a link to the code is provided. Enjoy! https://renniedatascience.com/Bloch Share Improve this answer Follow answered Oct 10, 2022 at 22:23 Rob Rennie 412 2 bronze badges Add a comment 2 I am the developer of unbloched.xyz, it is an open source project I've been working on for the last year while studying quantum related topics. The website is a Bloch sphere simulator with a lot of features and a nice user interface. It has L A T E X 𝐿 𝐴 𝑇 𝐸 𝑋 support to input arbitrary density matrices and gates. It supports noise simulation and can export nice images for hand-outs and similar (I put and example below). With the help of other students we also built an interactive tutorial that introduces the general concepts of quantum information. Share Improve this answer Follow edited Mar 11 at 9:31 answered Mar 3 at 11:50 gamberoillecito 212 2 bronze badges Add a comment 1 I use very regularly this site: https://bloch.kherb.io It is useful to understand and engineer quantum control sequences as well as to generate plots for talks. Share Improve this answer Follow answered Aug 19, 2023 at 10:12 P. Egli 1111 1 bronze badge Very good tool, +1. –  Martin Vesely Commented Aug 19, 2023 at 20:09 Add a comment Your Answer Sign up or log in Sign up using Google Sign up using Email and Password Post as a guest Name Email Required, but never shown Post Your Answer By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy. Start asking to get answers Find the answer to your question by asking. Ask question Explore related questions resource-requestsimulationbloch-sphere See similar questions with these tags. The Overflow Blog Open source for awkward robots Domain expertise still wanted: the latest trends in AI-assisted knowledge for... Featured on Meta Logo updates to Stack Overflow's visual identity Linked 5 What applications does the quantum gate [(i,1),(1,i)] have? Related 33 Can the Bloch sphere be generalized to two qubits? 4 Plotting Bloch sphere in QuTiP 6 Why is the Bloch sphere three-dimensional? 1 Why is there no angle for the z 𝑧 axis in the Bloch sphere? 2 Solving a Bloch sphere where alpha is imaginary 5 Is there any quantum annealer simulator offered by DWave? Hot Network Questions How can I stack multiple headphone jacks vertically? Pi Day: estimating pi using probability Why are dialetheias sometimes described as “nondualisms”? Determine the analogous Euler-Lagrange equation for a given functional My basic budget tracker How can I avoid having to delete the .aux file every time I add a new question? how to re-enable an ejected thumbdrive SAT Solver Using Rubik's Cube LTSpice model of IRF520 body diode Use the main font in math mode (Roboto serif) What is the process for transiting from LAX terminal 4 to the International terminal? ATTiny816 - How are these two code fragments different? Is there a real function whose graph intersects every circle, no matter how big or small? Understanding notations on a 1939 register entry Negative form of imperative nasai form Does this article misapply a result in mathematical logic? Relation between sign of electrode potential and oxidising/reducing nature of species How to measure a year without relying on the Earth's tilted axis? Why is Trinity Necessary After Jesus' Death? Can't God Exist As One? AI overview in normal Firefox window but not in Private Window Is what I did in the picture "legal"? How to fish ethernet through ~1 ft run, instead of stapled coax? In 1 Corinthians 7:8, does ἀγάμοις (agamois) refer to all unmarried people or specifically to widowers? Which Elder Scrolls location is this? Question feed By continuing to use this website, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy. By exiting this window, default cookies will be accepted. To reject cookies, select an option from below. Customize settings Cookie Consent Preference Center When you visit any of our websites, it may store or retrieve information on your browser, mostly in the form of cookies. This information might be about you, your preferences, or your device and is mostly used to make the site work as you expect it to. The information does not usually directly identify you, but it can give you a more personalized experience. Because we respect your right to privacy, you can choose not to allow some types of cookies. Click on the different category headings to find out more and manage your preferences. Please note, blocking some types of cookies may impact your experience of the site and the services we are able to offer. Cookie Policy Accept all cookies Manage Consent Preferences Strictly Necessary Cookies Always Active These cookies are necessary for the website to function and cannot be switched off in our systems. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms. You can set your browser to block or alert you about these cookies, but some parts of the site will not then work. These cookies do not store any personally identifiable information. Targeting Cookies Targeting Cookies These cookies are used to make advertising messages more relevant to you and may be set through our site by us or by our advertising partners. They may be used to build a profile of your interests and show you relevant advertising on our site or on other sites. They do not store directly personal information, but are based on uniquely identifying your browser and internet device. Performance Cookies Performance Cookies These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us to know which pages are the most and least popular and see how visitors move around the site. All information these cookies collect is aggregated and therefore anonymous. If you do not allow these cookies we will not know when you have visited our site, and will not be able to monitor its performance. Functional Cookies Functional Cookies These cookies enable the website to provide enhanced functionality and personalisation. They may be set by us or by third party providers whose services we have added to our pages. If you do not allow these cookies then some or all of these services may not function properly. Cookie List Clear checkbox label label Apply Cancel Consent Leg.Interest checkbox label label checkbox label label checkbox label label Necessary cookies only Confirm My Choices
    💬 Team Notes
    Article Info
    Source
    Quantum Computing SE
    Category
    ◌ Quantum Computing
    Published
    May 20, 2019
    Archived
    Mar 16, 2026
    Full Text
    ✓ Saved locally
    Open Original ↗