is going to be just the opposite of 2px So if you said 2 p x the first time, 2py say 2 p y this time.
就和,我们开始说的那个,如果你第一次说,现在就是。
OK? And in fact, if you look at the code up here, and it's on your handout, the very first one, x 1, right here- if I could ask you to look at it-- is a piece of code to do it. And I'm less interested in the code than how we're going to analyze it, but let's look at it for a second.
实际上,如果你看看,你们课堂发的材料上面的代码,第一页上的,就是那-,大家请看看实现的这一部分代码,我不太关心,我们会怎么解释这个代码,首先让我们先看看。
So let's look at the first case 2px where we have either the 2 p x or 2 p y type of orbitals that we're combining.
让我们看看第一个情形,我们要组合,或者2py轨道。
I first print what X is.
我先打印X是什么。
Let's create a graph here that on the x axis it's going to be time, so time zero will be when you first take in a food and then one hour later, two hours later will be shown as you go from left to right, and then we'll have blood glucose level up on the y axis.
我们在这建立一个曲线图,X轴代表的是时间,所以零时间点是你第一次进食的时间,然后一小时以后,两小时以后,是从左到右呈现在图表上的,在Y轴上是你的血糖值
Notice in the class definition here, is there, this is the first thing that's got called, and I just called with the value for x and the value for y, and it went off and did something for me.
就在这里,这是第一个被调用的东西,我用x的值和y的值调用了它,然后这个方法继续进行,并为了做了一些操作。
I can either look at my flow chart, or I can look at the code. If I look at the flow chart, it says, I'm at this point. Look at ANS squared. Is it less than or equal to-- sorry, first of all, 0 ANS squared is 0, is it less than or equal to x, yes.
我可以看流程图也可以看我的代码,如果我看流程图的话,流程图这么说的,在这一点,看看ANS的平方,看是不是小于等于-对不起,首先,ANS的平方是。
All right, first question. What values of x does it terminate? Again, assume x is an integer.
好,第一个问题,对于x的什么值程序,会最终终止,还是假设x为整数。
The first statement right here, that's just an assignment statement, I'm giving some value to x.
第一个声明在这里,这仅仅是一个赋值声明,我赋值给x一个值。
All right, we're-- well actually, I should say that better, we first check to see, is x 0 greater than or equal to zero, if it's not, then we come down here and we print something out, otherwise we run through a little loop to get the answer, and then we check it and we spit something out.
然后我们运行一个小循环,好了,我们现在来看看,如果x≥0或者x<,我们看这儿,我们会输出一些内容,或者我们运行一个小循环来获取答案,然后我们检验一下,然后得到结果。
OK. And first of all, you say, wait a minute, x and n?
首先,你肯定会想,等等,x和n?首?
But notice what this does. The first thing it does is, it says, let's check and make sure x is greater than or equal to 0. If it isn't, notice what's going to happen. None of that block is going to get executed, and it's going to come down here and print out a useful piece of information, which says, hey, you gave me a negative number. I don't know how to do this.
做的是和以前一样的事情,但是注释它做了什么,第一件做的事情就是,程序说,要去检查并且确信x是大于等于0的,如果不是的话,请注意会发生什么,下面的代码都不会被执行,程序会到这里来然后显示一些有用的信息,信息会说,嘿,你给了我一个负数,我不知道该怎么弄这个了。
应用推荐