Skip to content

aditya19200/quantum-coin-flip

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

Quantum Coin Flip Simulation

Overview

This Python project demonstrates the difference between quantum and classical coin flipping using Qiskit, a quantum computing library. It provides a fascinating comparison between quantum probabilistic behavior and classical random number generation.

Features

  • Quantum coin flip simulation using Qiskit
  • Classical coin flip simulation using Python's random module
  • Comparative visualization of results
  • Probability analysis of coin flip outcomes

Prerequisites

  • Python 3.7+
  • Qiskit
  • Qiskit-aer
  • Matplotlib

Installation

  1. Clone the repository:
git clone https://github.com/aditya19200/quantum-coin-flip.git
  1. Install required dependencies:
pip install qiskit qiskit-aer matplotlib

How It Works

The script does two things:

  1. Performs a quantum coin flip using a Hadamard gate to create a superposition
  2. Performs a classical coin flip using Python's random number generator

It then compares and visualizes the results, showing the probabilistic nature of quantum systems.

Running the Script

python quantum_coin_flip.py

Key Quantum Mechanics Concept

The Hadamard gate used in this simulation puts a qubit into an equal superposition of |0⟩ and |1⟩ states, analogous to a coin spinning in the air before landing.

Visualization

The script generates two types of plots:

  • Histogram of quantum coin flip results
  • Histogram of classical coin flip results
  • Comparative bar graph of both methods

Contributing

Contributions, issues, and feature requests are welcome! Feel free to check issues page.

License

MIT

Contact

image image

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages