« first day (2236 days earlier)      last day (2989 days later) » 

22:00
it looks like there's still a fair bit of stuff you can cut
why are you asking the user for input in that section?
okay, I cut some more out, let me update the question
oh, I can just define fstgat, let me fix that
@heather it looks like you've got some more editing to do
you're still describing the code as if the user needs to put in a state
what state are you feeding it, what output are you expecting, what is it giving you instead?
be concrete
okay
@EmilioPisanty, okay, I updated it, and it is now significantly shorter.
and it does work, I tested it.
@heather you still seem to have the outdated description
22:15
I added a more detailed description, I'll make one more edit
okay, how is it now?
@heather I think it's a fair bit better than you started with
i think i minimized it even further, and there is still the problem, so I'll update it again
short enough now that you no longer need to scroll =D
@heather yeah, it's a suspicious sign if the MWE needs scrolling
a good rule of thumb, I will keep that in mind
I imagine you tried adding print(qubitnum) to see that it's going through everything it needs to?
it's either a looping problem or something else
if it's a looping problem you should be able to pretty much gut the calculation and still get errors
22:28
i think the problem may actually be the way the results are printed
let me try something
well, something funky is going on for sure
now I don't know how it's printing the first qubit correctly
ok, try this
    qstat = qstats[index+1]
    print("debugging 1:",qstat)
    qstat = singates[gate](qstat)
    print("debugging 2:",qstat)
    qstats[index+1] = qstat
that looks pretty wonky to me
 debugging 1: [0 1]
 debugging 2: [ 0.70710678+0.j -0.70710678+0.j]
then
 debugging 1: [ 0.70710678+0.j -0.70710678+0.j]
 debugging 2: [ 0.+0.j  1.+0.j]
It looks like the second time around only re-operates on the first qubit
oh, do that in the loop, I thought you meant at the end, in which case it gives
debugging 1: [ 0.+0.j 1.+0.j]
debugging 2: [ 0.70710678+0.j -0.70710678+0.j]
either way it's funky
no, the first go-round looks fine
i.e. you ask it for qstat before it operates
gives you [0 1], it's fine
then you ask it for qubit 1 after the hadamard
gives you your sqrt(1/2)s, it's fine
then you loop into the second qubit
you ask it for qstat before you operate
and it says it's [ 0.70710678+0.j -0.70710678+0.j] ?
I have no idea what's going on.
@heather try this for the loop
while qubitnum <= qubits:
    for index,gate in enumerate(commands[qubitnum]):
        print("index is ",index)
        qstat = qstats[index+1]
        qstat = singates[gate](qstat)
        qstats[index+1] = qstat
        if index+1 == len(commands[qubitnum]):
            print(" ")
            print("your result is", qstats[qubitnum], "qubit #", qubitnum)
            print("probability of |0> state is", probability(qstats[qubitnum],0))
            print("probability of |1> state is", probability(qstats[qubitnum],1))
only change is the addition of
print("index is ",index)
22:38
index is  0

your result is [ 0.70710678+0.j -0.70710678+0.j] qubit # 1
probability of |0> state is 0.5
probability of |1> state is 0.5
index is  0

your result is [0 1] qubit # 2
probability of |0> state is 0
probability of |1> state is 1
was the output
@heather precisely
would you expect it to give you index is 0 the second time around?
Now, I don't know python, so I can't tell what
for index,gate in enumerate(commands[qubitnum]):
is doing
but it looks like that's where you need to focus
well...actually maybe I do expect it to give 0, because that's where it is in the list of commands.
i think that's right.
so what is index meant to be doing?
because later on you do
qstat = qstats[index+1]
and that bit is meant to be selecting the state you want to work with from the full list of states
or maybe I don't understand what you're looping over
anyone have a tachyon or two? I need to smack my week-ago self in the head.
@heather you got it?
22:43
i think i'm mixing up index and qubitnum and a bunch of other variables.
i have a couple things to try...
@heather yeah, maybe set qstat = qstats[qubitnum] or something
either way, don't beat yourself up
bugs happen
yup, I fixed it
the important thing is learning to recognize them and fix them
i put in qubitnum for index+1 and it worked
wow
thanks @EmilioPisanty
and, eventually, building a coding process that makes it harder for bugs to slip by unnoticed
@heather no worries, happy to help
OK, hang on
22:45
@EmilioPisanty, I think I might need to rename index =)
renamed to commandnum
i think that'll make much more sense
0
A: Logic error - incorrect answer given

E.P.I'm not completely sure what you mean to be doing with index. However, it looks to me like your line qstat = qstats[index+1] should really read qstat = qstats[qubitnum]

Thanks again.
answer accepted.
hah! finally! after five years on SE, an answer on SO that actually helps somebody!
that can't be the first time.
@heather on StackOverflow?
I suspect it is
SO is scary
22:50
i tried to give an answer, ended up having to delete it even though it answered the question, though really i shouldn't have answered because it was homework like. but I edited the question and everything to a what I thought was a good state.
@heather frankly, I think you can just leave it as-is
I got multiple downvotes however
and not a single upvote
wait, what?
it shows score 1 to me
oh
22:52
oh, no on a different question
you're talking about a separe question?
yeah
as I said, SO is a scary place
momentarily undeleting it:
-2
A: How do I check if the enter key is pressed?

heatherHere's a starter program: correct = 'n' while correct == 'n': answer = raw_input("Type your name here: ") correct = raw_input("Is your name "+answer+"? If so, type y. If not, type n: ") if correct == 'y': print "Great!" Why does this work? Well, let's look at this carefully...

you can delete it now
okay
so yeah, I saved the text/solution elsewhere because I thought the information might be useful, and deleted it. =/
@heather ah, well
live and learn
SO is learnable
(obviously)
but you'll bump into a number of corners on your way in
acknowledge them and move on
22:55
i'm used to the python chatroom, but not SO itself.
it is, indeed, a scary place.
just ran the full program, and it worked! =D
now for the more complex stuff.
i'm afraid I don't know who that is.
though i've certainly heard "wat" many a time
@EmilioPisanty, it's broken again =P
I'll keep working on it.
@heather yeah, it happens
22:59
because now I'm trying to use two-qubit gates
don't be afraid to put in print()s to debug
delete them later
but learn to make your code talk to you about what it's doing
and I <3 MWEs
that was useful as well
23:26
So, what would you use a rank 3 tensor for? Like, what does it do?
@heather a three-qubit state?
just for starters
@heather Like most other elements of mathematics, tensors were developed with the intent of making students lives more difficult.
@BernardoMeurer, it sure seems like it =P
After that duty was fulfilled they found other, less practical uses for it :P
@EmilioPisanty perhaps I phrased that poorly. A matrix (rank 2 tensor) represents a linear transformation; a vector (rank 1 tensor) represents an arrow in space, what does a rank 3 tensor represent?
23:30
@heather a vector-valued bilinear form, maybe?
Oooh, a chance to pontificate about tensors?
a what now?
what is a bilinear form, let alone a vector valued one?
@ACuriousMind No. Go back to your hole
@ACuriousMind, sure.
@BernardoMeurer agreed
23:30
Last time we had him talking about tensors thousands died
okay, I retract my meaningless permission
@heather a bilinear form is a function $f:V\times V\to W$ that takes two vector inputs, $f(v_1,v_2)$, from a vector space $V$
@heather Well, let me first ask why you want to know about tensors?
Tensor: linear function of vectors and covectors.
Done.
@EmilioPisanty Hey!
23:31
Everyone go home.
normally $W$ is the field, $\mathbb R$ or $\mathbb C$
Sigh, I'll go get the bulletproof vest
but you can also set it to $W=V$
@EmilioPisanty Apparently only I can be pointlessly rude to ACM :P
@ACuriousMind, because practically every single one of my books/websites mentions them and I had (?) no clue what they were.
23:32
@DanielSank You're a god
2
PHYSICS GOLF: Define a Tensor in the least number of bytes, go!
3
what's a covector?
^ Actually a pretty cool idea imho
goodness, and down the rollercoaster we go
@BernardoMeurer, actually, yeah, physics golf sounds cool
@heather Yeah, but the flavour of them that you need to understand in, say, general relativity, is different from the flavour you need in, say, quantum mechanics.
23:33
@heather There are several ways to think about it, but essentially, think of it as a row vector.
@ACuriousMind, the quantum mechanics/quantum computing flavor then (which is chocolate, I assume)
@heather Once we finish this you'll have grown a beard and find out that you're 45
More abstractly, a co-vector is a linear function which takes a vector as an argument and returns a number.
@DanielSank, oh, wait, each vector has a covector, right?
23:34
@heather Yes... but slow down.
Lol
Shortest explanation ever
Every time things get interesting, heather says brb.
@heather Okay. So, in this context, we need to first think about what it means to "combine" two quantum systems.
23:34
@DanielSank Maybe she's been talking to my German neighbour...
2
^ Funniest comment ever posted on hbar.
@BernardoMeurer you're a god.
@DanielSank <3
@BernardoMeurer I'm writing my own event loop to see if I can do it.
What are my odds of success?
@DanielSank 0.5
^ Generous!
23:37
@DanielSank 30% on an average day, 60% if you're an average Russian athlete
(Hope someone gets the joke)
@DanielSank in the spirit of cc.com/video-clips/hzqmb9/…
@EmilioPisanty I don't run flash.
:|
Walter Wagner: You slam two atoms together, some theories suggest they might collapse into a micro black hole. Eventually it will convert the Earth into a black hole.

Interviewer: [what are the chances the world will be destroyed?]

Wagner: Well, the best we can say right now is about a 1 in 2 chance.

Interviewer: [50/50 ?]

Wagner: Yeah, fifty-fifty.
Wagner: There's a chance, a fifty-fifty chance.
Wagner: If you have something that can happen and if you have something that won't necessarilly happen, it's either going to happen or it's going to not happen. And best guess is about 1 in 2
That's absurd.
I ran flash once, later that day I got hit by a car. Flash, not even once
2
23:41
@DanielSank well, it happened
@DanielSank @EmilioPisanty @ACuriousMind Come on, I want to see who wins the Physics golf
I already said:
Tensor: Function taking vectors and covectors as arguments, and returning a scalar, and is linear in all arguments.
Done.
@DanielSank 115 bytes!
You want me to gzip that and get less bytes?
That's cheating
23:51
I would argue that assuming that covectors are already defined is cheating
but then there's no established ground floor on the golf question, which makes it ill defined
Covector: Linear function $V \rightarrow \mathbb{R}$.
where $V$ is a vector space.
Covector is pretty standard, I don't see why one would have to define it in the answer
well, when heather comes back, ask her to define covector, and see what she says
23:53
She doesn't know.
↑ precisely
But why is heather the litmus test for the code gold problem?
I get your point though: if you need to explain tensors to someone, you probably need to explain covectors first.
@EmilioPisanty The criteria isn't whether she can understand it or not, it's whether it's a description of the concept at hand, by itself, assuming all standard previous knowledge is known by the reader. Unless you define something new entirely it doesn't need to be contained in the golf

« first day (2236 days earlier)      last day (2989 days later) »