Question

|<+y|-y>l^2 = 0.9999999999999996 ||<+y|-x>l^2 = 0.4999999999999998 -4 print(*Exercise 30.5\n), -5 #function defination for

def plusThetaeigenket(theta):

return np.array([np.cos(theta/2),np.sin(theta/2)])

print("|+theta> = ",plusThetaeigenket,"\n")

def minusThetaeigenket(theta):

return np.array([-np.sin(theta/2),np.cos(theta/2)])

print("|-theta> = ",minusThetaeigenket,"\n")

Can you please help to solve where this python code went wrong for display the correct eigen ket value for theta? Thank you

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Hello,

In function call we need to pass the arguments through which it is calling
Since you have not passed any argument during the function call, It is just printing the address of the function rather than calling and processing it

In this

first you need to initiate or take input from the user

for now i am initiating the value by 30.5

t1=30.5

t2=30.5

import numpy as np

def plusThetaeigenket(theta):
    return np.array([np.cos(theta/2),np.sin(theta/2)])

print("|+theta> = ",plusThetaeigenket(t1),"\n")

def minusThetaeigenket(theta):
    return np.array([-np.sin(theta/2),np.cos(theta/2)])

print("|-theta> = ",minusThetaeigenket(t2),"\n")

You will get output:

('|+theta> = ', array([-0.89695484,  0.44212217]), '\n')
('|-theta> = ', array([-0.44212217, -0.89695484]), '\n')

Comment for any doubt

thanks

Add a comment
Know the answer?
Add Answer to:
def plusThetaeigenket(theta): return np.array([np.cos(theta/2),np.sin(theta/2)]) print("|+theta> = ",plusThetaeigenket,"\n") def minusThetaeigenket(theta): return np.array([-np.sin(theta/2),np.cos(theta/2)]) print("|-theta> = ",minusThetaeigenket,"\
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT