Question

This question is on quantum computing where I have to: Write a function createQubit. It takes...

This question is on quantum computing where I have to: Write a function createQubit. It takes two inputs: alpha and beta. These are floating point values. It should return a list [x,y] where: x = alpha / N y = beta / N and: N = sqrt(alpha2 + beta2 ) This makes sure that the list [x,y] is a proper qubit (in that it is normalized: x2 + y2 = 1). (Check this yourself on paper and make sure x2 + y2 = 1)

Homework Answers

Answer #1

Here is the code


import math
import random
def createQubit(alpha, beta):
N = math.sqrt(alpha**2 + beta**2)
x, y = alpha/N, beta/N
return [x,y]
print(createQubit(10,30))

I have provided the screenshot of the output and verify the answer on the paper

If u have any doubt, please comment below. Please like the answer. Tq

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Question 1 Suppose you estimate the following regression function where Y, X1, and X2 are continuous...
Question 1 Suppose you estimate the following regression function where Y, X1, and X2 are continuous variables measured in integers: Yhat=0.5+0.25*X1 −0.01*X2−0.43*X
3 Suppose that X2=X1*X1 The standard error of beta0hat is 0.10. The standard error of beta1hat is 0.05. The standard error of beta2hat is 0.005. The standard error of beta3hat is 0.05. What is the marginal effect of X1 when it increases from 3 to 4? Round to two decimal places. 10 points Question 2 Refer to question...
Arrays, loops, functions: Lotto Element Repeated Function Write a function that that takes as parameters an...
Arrays, loops, functions: Lotto Element Repeated Function Write a function that that takes as parameters an array of ints, an int value named element, and an int value named end. Return a bool based on whether the element appears in the array starting from index 0 and up to but not including the end index. Generate Random Array Write a function that takes as parameters an array of integers and another integer for the size of the array. Create a...
Curve-Fit Function USING MATLAB Using the top-down design approach, develop a MATLAB function A8P2RAlastname.m that reads...
Curve-Fit Function USING MATLAB Using the top-down design approach, develop a MATLAB function A8P2RAlastname.m that reads data from a file and performs regression analysis using polyfit and polyval. The function shall have the following features: The input arguments shall include the file name (string), a vector of integers for the degrees of polynomial fits to be determined, and an optional plot type specifier (‘m’ for multiple plots, ‘s’ for a single plot - default). The data files will be text...
For a C program hangman game: Create the function int setup_game [int setup_game ( Game *g,...
For a C program hangman game: Create the function int setup_game [int setup_game ( Game *g, char wordlist[][MAX_WORD_LENGTH], int numwords)] for a C program hangman game. (The existing code for other functions and the program is below, along with what the function needs to do) What int setup_game needs to do setup_game() does exactly what the name suggests. It sets up a new game of hangman. This means that it picks a random word from the supplied wordlist array and...
I NEED TASK 3 ONLY TASK 1 country.py class Country:     def __init__(self, name, pop, area, continent):...
I NEED TASK 3 ONLY TASK 1 country.py class Country:     def __init__(self, name, pop, area, continent):         self.name = name         self.pop = pop         self.area = area         self.continent = continent     def getName(self):         return self.name     def getPopulation(self):         return self.pop     def getArea(self):         return self.area     def getContinent(self):         return self.continent     def setPopulation(self, pop):         self.pop = pop     def setArea(self, area):         self.area = area     def setContinent(self, continent):         self.continent = continent     def __repr__(self):         return (f'{self.name} (pop:{self.pop}, size: {self.area}) in {self.continent} ') TASK 2 Python Program: File: catalogue.py from Country...
I've posted this question like 3 times now and I can't seem to find someone that...
I've posted this question like 3 times now and I can't seem to find someone that is able to answer it. Please can someone help me code this? Thank you!! Programming Project #4 – Programmer Jones and the Temple of Gloom Part 1 The stack data structure plays a pivotal role in the design of computer games. Any algorithm that requires the user to retrace their steps is a perfect candidate for using a stack. In this simple game you...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT