When Hartree's method is extended to a slater-determinate wave function, the result is the Hartree-Fauch equations. These were derived by Vladimir Fauch and presented in 1929. As a shorthand for a slater-determinate, we'll write a Hartree product inside a Dirac ket symbol. Fauch started with the assumption that the wave function of a many electron system has the form of a slater-determinate of one electron orbitals. He then sought those orbitals which minimized the expected value of the ground state energy. According to the variational method we discussed previously, this will then be the optimal wave function of this form. Let's sketch out the resulting Hartree-Fauch equation for one of the electrons in a hydrogen molecule, which has two electrons and two protons. We'll arbitrarily label this electron one. For reference, recall that the Schrodinger equation for a single electron has the form of a kinetic energy term plus a potential energy term equals a total energy term. The kinetic energy of electron one is the normal kinetic energy operator applied to the first orbital. The attractive forces of the two nuclei each resulted in a negative potential energy term. In an exact treatment, the repulsion between the two electrons would be represented by a positive potential energy term that depends on the positions of both electrons. This is the primary source of overwhelming complexity in trying to exactly solve the Schrodinger equation for a multi-electron molecule. Hartree's intuitive approximation was to treat electron repulsion in an average sense. This same idea rises rigorously in the Hartree-Fauch equations. We treat electron two as a cloud of electric charge with a charge density given by the magnitude squared of the second orbital wave function. Summing or integrating this overall space gives us the bracketed term shown here, which serves as an effective potential energy term for electron repulsion. Now the terms we've written so far are those we'd expect from Hartree's method. But Fauch found that the exclusion principle, as enforced by using a slater determinant wave function, requires an additional term. This is called the exchange term because it's identical to the electron repulsion term with an exchange of orbitals. This is a strange expression and there's no classical analog in terms of a cloud of electric charge. This maybe isn't surprising given that it arises from the exclusion principle which is a purely quantum mechanical effect with no classical analog. With these equations in place, we can now outline the Hartree-Fauch method for obtaining an approximate wave function for an an electron molecule. We start with a guess for the n orbitals. We then repeatedly solve for each of the n orbitals in terms of the others until we converge to a self-consistent field. For the kth orbital, we solve the corresponding Hartree-Fauch equation. This has a kinetic energy term and a potential energy term for the attraction of electron k to each of the m nuclei. Here, z sub j is the number of protons in the jth nucleus. There are other terms for the repulsion between electron k and each of the other n-1 electrons and the corresponding exchange terms. These correspond to the sum of kinetic and potential energy terms in the Schrodinger equation. This is said to be equal to a total energy term ek times psi k. Ek is the energy that would be required to remove an electron from the kth orbital assuming the other orbitals do not change, that is, they remain frozen. These equations, especially due to the exchange terms, are very challenging. No practical procedures were available at the time nor are any available today to directly solve these for molecules. So, although there were some successful applications to atoms, the Hartree-Fauch method remained of mostly theoretical interest. And with the outbreak of World War II, almost all research efforts were directed elsewhere. After World War II, not only were peacetime research programs revived, but digital computer technology was becoming available. This meant that it was now possible to solve types and sizes of problems that could not be attacked with pencil and paper. Around 1950, Clemens-Ruten reformulated the Hartree-Fauch equations as the Ruten equations. The idea was to represent electron orbitals in terms of so-called basis functions. This converted the Hartree-Fauch equations into algebraic equations that were ideally suited for computer solution. For example, we can represent an orbital as a linear combination of atomic orbitals on different atomic centers. In fact, we've already applied a simple version of this to the hydrogen molecule ion. Suppose we're solving for the orbital of the water molecule. Basis function U1 might be an S orbital centered on the oxygen nucleus. Basis function U2 could be an S orbital centered on one of the hydrogen nuclei and U3 the same but centered on the other hydrogen nucleus. We could have more basis functions representing p-type orbitals centered on the various nuclei and so on. We then represent an unknown orbital as a linear combination of these known basis functions. Our problem then is to solve for the coefficients C1, C2, and so on by solving the Ruten equations. A great advantage is that the sums or integrals over all space that appear in the Hartree-Fauch equations are now in terms of the known basis functions instead of the unknown orbitals. So they can, in principle, be done once and for all rather than having to be repeated at each step of the self-consistent field method. Unfortunately, the logical choice of basis functions, hydrogen atom-type orbitals, generally lead to intractable calculations that keep us from even setting up the Ruten equations. Fortunately, around the same time it was pointed out that so-called Gaussian basis functions produce tractable equations. This insight was due to Francis Boyce and was the last key piece of the puzzle. So-called Slater-type orbitals, such as we find in the hydrogen atom, are characterized by an exponential decrease with distance from the nucleus. That distance is given by the square root of this expression. These have the form e to the minus alpha r, where alpha is some constant, and r is the distance of the electron from the nucleus. It's the square root that creates the mathematical difficulties. Boyce suggested the use of Gaussian-type orbitals, which lack the square root and have the form of e to the minus alpha r squared. He showed that the mathematical calculations needed to set up the Ruten equations can then readily be done, leading to a practical method for implementation on a digital computer. Although Gaussian-type orbitals have convenient mathematical properties, they aren't a good approximation to the types of orbitals that actually form in atoms. Here we plot as blue dots the Slater-type orbital e to the minus r, which is the exact solution of the hydrogen atom ground state. The best Gaussian-type orbital approximation to this is the solid red curve. The agreement is not good. These 3D scans illustrate the Slater-type orbital on top and the Gaussian-type orbital on the bottom. The Slater-type orbital has a much more peak density near the nucleus, while the Gaussian-type orbital is more diffuse. However, a linear combination of two Gaussian-type orbitals gives a better approximation, and a combination of three Gaussians does better still. So given enough Gaussian-type orbitals, it should be possible to accurately represent the types of orbitals that actually arise in atoms and molecules. To go beyond the spherical symmetry of S orbitals, we can combine Gaussians, offset from one another and with coefficients of different signs. The result is a two-lobed P-type orbital. A combination of four Gaussians can be used to create a four-lobed D-type orbital. More complicated spatial variations become possible as we add more primitive Gaussians. For example, here's an orbital with a fairly complicated three-dimensional structure that's built from a linear combination of simple primitive Gaussian-type orbitals. With the Hartree-Fock equations, as reformulated by Routen, and using Boyd's idea of Gaussian basis functions, it became possible to perform so-called ab initio quantum chemistry calculations, or calculations from the beginning or from first principles. Given enough basis functions and enough computing power, a computer can solve any chemistry problem we throw at it. Let's do an ab initio calculation for the only molecule we've solved for so far, the hydrogen molecule ion. This chemical bond is due to two protons being surrounded by a single electron, whose exact orbital is shown here. A calculation using a single Gaussian gives a poor representation of this. But as we increase the number of Gaussians to two, four, six, eight, ten, and twelve, our result more and more closely approaches the exact wave function. So, with a finite number of simple Gaussians, we can construct a highly accurate approximation to the true molecular wave function. Now, we'll use the open-source program Ergo SCF to do Hartree-Fock calculations on a few different molecules. We'll also use the open-source package GAB added to visualize the results. Quantum chemistry not only has to explain why certain molecules form, but also why others do not. Imagine we have four protons, four electrons, and four neutrons, and we want to build a molecule. Two protons and two neutrons form a helium nucleus. Adding two electrons, we have a helium atom. We can make two of these with our twelve particles. We could also take a proton and an electron to form a hydrogen atom, and from the remaining particles form a lithium atom, in this case lithium-7, which is the most common isotope. Here we plot the interactions between lithium and hydrogen atoms as predicted by the Hartree-Fock method. The contours correspond to different constant values of electron density. When far apart, we have isolated atoms. But as they come closer, molecular orbitals are able to form. Plotting the total energy versus nuclear separation, we find a minimum near three Bohr radii. This predicts the existence of the lithium-hydride molecule and gives us a good approximation to its bond length and dissociation energy. Repeating the process for two helium atoms, we obtain an energy curve without a minimum. Therefore, Hartree-Fock theory predicts that a chemical bond between two helium atoms will not form, which is true under normal conditions. With three or more atoms, the geometry gets more complicated. Consider the water molecule H2O. At the upper left, we have a top-down view of the molecule. In the lower middle, a view at 45 degrees, and in the upper right, an end-on view at 90 degrees. Water has ten electrons. Assuming two electrons can fit into an orbital, one spin up and the other spin down, water should have five occupied orbitals. The lowest energy orbital is essentially a spherical cloud around the oxygen nucleus. These so-called core electrons don't contribute significantly to the chemical bonds. The next highest energy orbital is a slightly triangular-shaped cloud that engulfs all three nuclei. The next orbital is a two-lobed structure. The wave function is positive in the red region and negative in the blue, with one hydrogen nucleus in each lobe. The next orbital is also two-lobed, but with a different orientation. Both hydrogen nuclei are in the red lobe while the oxygen nucleus is in the blue lobe. The highest energy occupied orbital is a p-type orbital centered on the oxygen nucleus that does not envelop the hydrogen nuclei and contributes little to the chemical bonds. Having solved for the five occupied orbitals, we can now calculate the total electron density due to all ten electrons. Here we show a red and white stick model of the water molecule on which we impose a surface of constant electron density. The highest densities are near the oxygen nucleus. For decreasing densities, the surface grows and eventually envelops the hydrogen nuclei. By repeating this process for various positions of the hydrogen nuclei until we find an energy minimum, we can determine the molecular geometry. Here again is the highest energy occupied molecular orbital. Just as for the hydrogen atom, we can calculate orbitals corresponding to excited states. The next highest energy state, the lowest energy unoccupied molecular orbital, is shown here. Now, we might adopt a seeing is believing attitude and remain skeptical about the extent to which the results of these mathematical calculations represent something physically real. The scanning tunneling microscope, which won its designers Nobel Prizes in 1986, has enabled imaging at atomic scale resolution. Recently, a team of researchers has used this technique to image a single water molecule. By adjusting the tunneling voltage, they were able to couple the probe to both the highest energy occupied and lowest energy unoccupied molecular orbitals and obtain images of these. The agreement between experiment, shown at center, and theory, shown at right, is stunning. We're able to actually see single molecular orbitals. The size of molecules that can be analyzed using the Hartree-Fock method is limited only by our computing power. Here's a diagram of pentascene, a flat molecule with 36 nuclei, 22 carbon nuclei arranged in five linked rings, surrounded by 14 hydrogen nuclei. An animation of total electron density, as predicted by Hartree-Fock theory, shows how the electrons effectively glue the components of this molecule into place. Using atomic force microscopy, researchers at IBM Zurich have imaged a single pentascene molecule. In this image, the carbon rings and even the hydrogen atom bonds are clearly visible. Pentascene's molecular orbitals have also been imaged. Here is its highest occupied molecular orbital, as predicted by Hartree-Fock theory. And here is the Hartree-Fock lowest energy unoccupied molecular orbital. Scanning tunneling microscope images verify the multi-lobed structure of these orbitals. We can literally see that although the Hartree-Fock method provides only an approximate solution to a molecular wave function, it can be a very good and therefore very useful approximation indeed. And other methods continue being developed to obtain even better approximations. Here's a recent paper in which a supercomputer was used to perform Hartree-Fock calculations on components of protein molecules having almost 3,000 atoms. So with this theory, it's even possible to apply quantum mechanics to aspects of the chemistry of living organisms. Returning to Dirac's 1929 quote, In the decade since then, there has been impressive progress towards overcoming the difficulties he noted in implying the laws of quantum chemistry. Today, quantum chemistry stands as one of the tremendous achievements of quantum theory, of immense practical as well as theoretical importance.


Hello everyone, welcome back to another session in dentistry and more. So today we have a very important but a very small topic in human anatomy that is carotid sheath which is a frequently asked shop not in university exam. So let us learn about carotid sheath. Carotid sheath it is an anatomical term for the fibrous connective tissue that surrounds the vascular compartment of the neck. So it is a part of the deep cervical fascia of the neck. So deep cervical fascia of the neck which includes four layers that is the first layer superficial to deeper layer. So this is a superficial layer and this is the deepest layer. So superficial and deepest layer. The superficial layer is a first layer is a investing layer. The first layer is known as investing layer which surrounds the sternocleidomastoid and trapezius muscle. So it is sternocleidomastoid and trapezius that is the investing layer. The second layer is the current topic that is a carotid sheath. So which encompasses the vascular region of the neck. So this is the vascular region of neck. The second or our current topic that is carotid sheath. The third layer is known as pretracheal fascia which encloses the visceral regions. So the third layer is visceral region of neck. And the lastly the fourth facial layer is pre vertebral fascia which surrounds the vertebral regions of the neck. So the first layer investing layer which surrounds the sternocleidomastoid and trapezius muscle. So it is a superficial layer. The second layer is vascular component that is carotid sheath. The third layer is pretracheal which encloses the visceral regions of neck. And the fourth layer is pre vertebral fascia which surrounds the vertebral region of the neck. So the carotid sheath itself is an accumulation of three of the layers of deep cervical fascia. These layers includes the investing fascia, then the pretracheal fascia and the pre vertebral fascia. So carotid sheath has basically four major structures. Four structures in the carotid sheath. So which are the structures? The first one is common carotid artery and internal carotid artery. This is common carotid artery and internal carotid artery. Then there is internal jugular vein and there is vagus nerve which is a tenth cranial nerve and also deep cervical lymph nodes. So these are the four structures which is present in carotid sheath. And the carotid artery which lies, this is a medial site, this is lateral site anterior and posterior site. So the carotid artery lies medial to the internal jugular vein. And the vagus nerve which is posterior to these two vessels that is carotid artery and internal jugular vein. So this is at a posterior position, this is a medial position and lateral position. And in the upper part, this carotid sheath also contains glosopharyngeal nerve, glosopharyngeal nerve, the accessory nerve and hypoglasal nerve which pairs the fascia of carotid sheath. So these are at the upper part, at the upper part that is 9, 11 and 12. So these three nerves facing the carotid sheath at a upper position. So the carotid sheath basically fuses with pretracheal fascia and investing fascia under sternocleidomastoid. So it fuses with pretracheal and investing layer underneath sternocleidomastoid. And the answer cervicalis is present in carotid sheath over the internal jugular vein. So that was about carotid sheath, it is a very small topic. Only thing we need to learn the four basic layers of cervical fascia of neck. Investing layer, carotid sheath, the pretracheal fascia and pre-vertebral fascia. The first layer is enclosing sternocleidomastoid entropiesis, then the vascular component, visceral component and vertebral component from superficial to deep layer. And the main point is the four structures which is presented carotid sheath that is common and internal carotid artery, common carotid artery and internal carotid artery, then internal jugular vein, vagus nerve and deep cervical lymph nodes. And it fuses with pretracheal fascia and investing fascia under sternocleidomastoid. And also ancestral vagalis is present in carotid sheath over internal jugular vein. So that is about carotid sheath, I will come up with in your topic in the industry and more. Thank you.


Yuma, I'm Brian Schmidt, Vice-Chancellor and President of the Australian National University. I am standing on our beautiful campus on the lands of the Nunawal-Nambri people, which has been a meeting place for more than 25 millennia. 2021 is a year of action and reflection, and I'm delighted to be launching our new reconciliation action plan, better known as the RAP, on behalf of our community. This plan is about embedding our First Nations people, culture and history into everything we do. As Australia's National University, this is part of the DNA of our institution, and we all need to be part of the solution. And commit to all Australians, including our First Australians people, that we are focused on finding the solutions so that we all have the same life chances, opportunities and choices. This plan helps chart that pathway. We are Australia's National University, so we are in a unique position. In fact, we have a responsibility, a moral obligation to show leadership, on First Nation policy and recognition, promoting a meaningful and lasting change. We are at the forefront of research and teaching globally. This empowers us to influence and inspire the nation. We have a responsibility to use that power to provide opportunities for First Nations communities. Across the country, our work is integral to the reconciliation process, a process that aims to remove the barriers that have divided Australians since colonisation. Removing those barriers is everyone's responsibility. We all have a part to play in building a better future for all Australians. Reconciliation Week is an important time in our annual calendar, as it's an opportunity to reflect on issues and experiences of First Nations people. It's about learning, listening and evaluating past actions in closing the gap and how those efforts can be more effective. Reconciliation is a journey. It's about a new way of working together and making it part of our daily lives. As the National University, it's our responsibility to demonstrate leadership in driving change. We each need to understand and be accountable for reconciliation. We need to feel empowered to achieve our goals as a community and empower each other to make a positive difference. Your commitment starts with engaging with our new reconciliation action plan. I encourage everyone to please take the time to read our new action plan. We can make a bigger difference if we work together and this is our time for action.


Do you know what a JWT is? JWT, also pronounced as Jot, stands for JSON Web Token. It's a compact way to securely transmit information between two parties in a JSON object. A JWT has three parts. It has the header, the payload, and the signature. The header includes two parts, the token type, and the signing algorithm that was used. The payload has claims. Claims typically include information about the user. To create the signature, take a base 64 encoded version of the header, and the payload, a secret, and the algorithm specified in the header, and then sign all of that. The output will have each section separated by three dots. The signature verifies the message was in chains along the way, and if you sign it with the private key, it also verifies the sender of the JWT is who they say they are. If you wanna learn more about JWTs, check out JWT.IO. This was Identity in a Minute.


I would like to share my personal story. Back in 2008, when I was in Iraq, where I came into a realization or pretty much of conclusions of my sexuality. And of course, during that time, that was during the Don't Ask, Don't Tell policy. And so for me to accept this from what I've considered a bad thing based on my religion, and I figured that if I end my life, I would see it as my mother would not have to be ashamed at the fact that she had a gay daughter.  And if my chain of command at the time knew that I was gay, they would have, I'm sure they would have done everything to kick me out. When I was a second lieutenant, I was told by a captain that officers are not to share any motions because it shows weakness to soldiers. So for 10 years of active duty, I've kept my emotions to myself, even though I've always been told that I wear my emotions on my sleeve. And of course, I did not seek help, which is always the bad thing. In a way, when I was a commander, it was very hypocritical for me to tell my soldiers, go get, go seek help, go to behavior health. And it wasn't until 2014 when I was separated from active duty, 2015 was followed by a divorce that somehow those moments that I lived before in 2008 and 2009, they all came back again. And that was the times that I started thinking once again that I should end my life. But I was not thinking about the pain that I would bring upon my mother, my brother, my family, my friends.  While I was in Kuwait, I talked to a therapist about my divorce and active duty. And I found my passion and crossed it at the time. I'm talking specifically to officers who think that getting help will ruin your career. I'm a major and I'm hoping to be promoted to Lieutenant Colonel in the future. I will be open that I, even to this day now, I am talking to a therapist and I have no shame about it. Because there shouldn't be any shame about getting help. It feels so good to just let one by one, those skeletons out the closet in a way. And it's actually very rewarding. We as officers, as leaders, need to reinforce that there is no shame in seeking behavioral health. Because you never know when you open up, you could actually be saving somebody else's lives. Me opening up to right now at this moment, I do hope that I am touching someone. This is important. It is okay to ask for help. It is okay to talk to somebody. Just hope that we don't have to be going through this over and over again, where it's just, there's no stigma. Where soldiers of every rank is open to talk to somebody and get into assistance that they need.


During Fleet Week San Francisco, Marines and sailors show the Golden Gate City expeditionary capabilities. But these local firemen are showing the Marines a few things about proper urban surge and rescue techniques. Today's objective was to train the Marines and sailors in our time of need, in case there's ever an earthquake or a disaster in San Francisco sitting in County proper. Sergeant Ryan Shirami says the specific training they receive makes all the difference. A lot of the training that we do, we don't cover these little things, and the fire department gave us some insight on if there is a disaster, if somebody's life needs to get saved or actually have those techniques to support that. Exercises like this show the dedication of both the Corps and their civilian counterparts. From Washington, I'm PFC John Tucker.


Now, then we were looking at some general representations of linear circuits, which can be used more widely ok. So, we were in the middle of sort of generating an equivalent circuit for a complicated circuit ok. So, in the meanwhile if you have any questions about what we did in the previous class or anything before that please go ahead. Any questions about things we were discussing in the previous class? Ok. So, let me get back to what we were doing. What we were looking to do was to take a circuit of this sort which consists of linear elements and linear controlled sources, which are controlled by quantities inside. This is this network N and then it is loaded by current source Ix, which could be a current source or it could be the equivalent of any other load or complicated network that is connected. We know from substitution theorem that if we had some other network here, we could replace it by the current source that it is drawing ok. So, now what we did was this is a linear network. So, superposition applies and we can analyze this in two steps ok, which is what I have shown here. Let me copy this stuff over. So, I will do a two step analysis of this. I have a number of independent sources inside and I also have this independent current source Ix which could be a current source or it could be a substitution for some other element. So, some other load ok. So, first I will deactivate the current source that is I will set Ix equal to 0 and analyze this circuit that is at these terminals 1 1 prime I will find the voltage Vx1 ok. Next I will set all the sources inside all the independent sources inside to 0. So, that is known as nulling the circuit then I will analyze the circuit with Ix alone ok. So, Ix is active in this case. So, clearly by superposition in this case when everything is acting that is when you have the load that is represented by Ix plus when you have all the independent sources inside the circuit you will get a certain value of Vx and this Vx which is the solution you are looking for is nothing but Vx1 plus Vx2 ok. What you calculate from this step by setting this Ix to 0 and then this step by setting all the independent sources in the circuit to 0 and that is nulling the circuit and finding the voltage ok. Is this part clear? I am splitting up the circuit like this. Any questions about splitting up the circuit in this manner that is first I will activate all the current sources inside deactivate the Ix then I will null the circuit and have only Ix active. So, let me just imagine that I have only one source inside ok one independent source outside which is Ix. So, clearly by superposition what is the meaning of superposition? If you have a number of independent sources in a circuit we can and then let us say you want to find a certain quantity let us say this Vx ok at these terminals 1 1 prime then what you can do is analyze the circuit with each independent source I have activated at a time ok. So, if you have a number of independent sources you have set all the independent sources to 0 except one of them you find the value of Vx from that one and next you take the next source and set that one to a nonzero value and everything else to 0 then find the Vx from that. Do this for all independent sources you will get a number of different values of Vx and you add all of them up that will be the value of Vx with all the sources active ok. So, now you do not have to do it one by one let us say you had the five independent sources you could take three of them once and then two of them the other time or four of them once and one of them the other time and so on ok. So, here what I am doing is I will first deactivate this Ix which corresponds to the load which can be substituting for the load and find this voltage and then I will null everything else that is null the circuit and find the value of Vx 2 from this ok. I hope that is clear. Now the question is that is it possible to find the current instead of the voltage yeah it is very much possible ok it is not a problem at all later you will see that ok. First of all let me call this Vx and then there is certain branch and then that is a y or something ok. Now if this circuit is linear then this Vx and Iy any of these quantities can be found from superposition ok that is any branch voltage or any branch current can be found from superposition ok. So, that applies to any quantity that you would like to find. Now let me look at the first part of this that is Vx 1. Now you see that Vx 1 is nothing but the voltage that appears across 1 1 prime when it is open circuited ok it is the open circuit voltage or the voltage that appears across 1 1 prime when it is externally open circuited ok that is no load is connected ok that is the idea ok. So, one part of this is the open circuit voltage. Now remember what we are trying to do is we have a very complicated circuit and only these terminals 1 1 prime are accessible to us and this might be connected to yet another circuit. Now what we would like to do is to have instead of analyzing this complicated circuit n every time we would like an equivalent representation of n that is simple ok. So, that is our goal that is what we are driving at because we are not interested in the internal details of n we have only this 1 1 prime and this will be driving the other circuit. So, we are only interested in what happens to this terminals 1 1 prime and in the other circuit we do not need to analyze all of n every time ok that is the idea. Now that is the first piece of the puzzle the open circuit voltage. Now the next part is with n being null that is all independent sources inside n are set to 0 ok and we have only a single independent source in the circuit. We have a single independent source ix in the circuit ok. So, now we will have this vx2. So, my question is please try to answer this. What is the general form of vx2? What is the general form of vx2? That is we are now talking about a circuit which has only linear components and all the independent sources are set to 0. So, we have a single independent source ix. What I would like you to answer is what will be the general form of vx2 ok in term meaning how would it be related to ix? Yeah I think many of you are able to answer it vx2 will be proportional to ix and if the polarity is given it will be of the form minus ix times some r ok where r is a property of the circuit r is basically the resistance looking into the terminals 1 1 prime ok. Because we have a single independent source here ix and then all the other sources are nulled and all the other components are linear. So, any quantity in this every branch voltage and current will be just proportional to ix and that will apply to vx2 also ok. And with the sign that I have taken ok because the ix is flowing outwards I will say vx2 is minus ix times r ok because the passive sign convention 1 1 prime if ix would be flowing that way then I would so if i were flowing that way I would take v in that polarity in this case i and v are in the opposite polarity to this convention. So, I will say it is minus ix r ok and what is this r? It is the resistance I will say looking into 1 1 prime with all independent sources set to 0 ok. So, that is the resistance of the network m looking into the terminals 1 1 prime ok. And this voltage vx1 is the open circuit voltage I could also call it boc ok or let me call it vth ok the reason for this will become clear. The open circuit voltage is called vth what I do is I simply measure the voltage across 1 1 prime with nothing connected to 1 1 prime ok. And this r I will call as rth again the region will become very clear ok. So, now so this quantity is called what I called vth ok the open circuit voltage and then here this quantity will be minus ix rth where rth is the resistance looking into 1 1 prime. So, the total voltage vx will be equal to vth minus ix rth ok where vth is the open circuit voltage and rth is the resistance looking into 1 1 prime with all the independent sources set to 0 ok. So, this is the voltage that will be present when this network is connected to a load current of ix ok. So, this is vx in the complete circuit now the network is active and the load current is connected to it this ix ok. Now, because vx is in this form it is very easy to see that this can be generated by having a voltage vth and a resistance rth in series with it. So, if I connect a resistance ix the current source ix here you are very easily see that all of this ix will flow through rth. So, the voltage drop across this is ix rth ok and the voltage between these two terminals will be vth minus ix rth ok. So, the voltage here will be exactly the same as that one ok. So, this entire thing here this is terminal 1 1 prime the whatever is inside this red box is equivalent to the original complicated circuit N between the terminals 1 1 prime ok. So, it is only that that is equivalent internal details of this we do not know the internally here we have only a single voltage source and a single resistance. But as far as the terminals 1 1 prime are concerned the voltage across this and the current through this will be exactly same as in the original network N ok. Now, this is regardless of what is connected to it because we did not make any assumptions about ix ok. So, ix is some current which could be a current source or which could be a substitution for some other load. But whatever it is this entire thing which is a set of independent sources and linear elements can be replaced by a voltage source vth in series with the resistance rth. And this particular representation probably many some of you know this already this is known as the Thevenin circuit or the Thevenin equivalent circuit of this part ok. So, now as I said earlier if you are not interested in the internal details of this. So, let us say you design a very complicated circuit with hundreds of resistors and control sources and many independent sources and you want somebody else to use it. But you have only two terminals that are brought out which is what they are going to use. So, in that case they do not need to know all the internal details of this all you have to do is to give the Thevenin equivalent. You give the value of vth and rth because you know the internal details you can calculate these things. But once this is done as far as the terminals 1 1 prime are concerned this very simple representation and whatever stuff you have inside this are completely equivalent ok. And this the idea that any circuit can be reduced to this is known as Thevenin's theorem ok. So, any questions about this what we did was we just use the linearity of the circuit n and proved that it can be represented by a voltage source in series with the resistance ok. Essentially we proved what is known as Thevenin's theorem ok. So, any questions about the proof or the idea of Thevenin's theorem? There is a question on when we cascade two networks is there any chance to change the voltage between the two networks? Actually this question is not clear to me which voltage or what is being referred to ok. So, I have to either draw a figure and email it to me then I will discuss that ok. So, I am not clear about what is meant by cascading of two networks and what is the voltage between the two networks. So, any other questions about this Thevenin's theorem and its proof? Actually the proof is quite simple how we use was linearity ok. And any questions that you have if you want to send something in detail please use the forum discussion forum for given for this course ok on the NPTEL website ok. So, the voltage Vth is open circuit voltage across the terminals and Rth is resistance between the two terminals. So, looking into the two terminals with independent voltage sources nulled ok. It appeared that because of some network problem the connection broke and also the audio and video went away for a while I hope it is solved now. Are you able to hear me if there is no audio then again let me know. So, as I will repeat what I had said I was just saying that Thevenin's theorem says that if you have a two terminal network with independent sources and linear elements inside at the two terminals it can be equally represented by a series combination of a voltage source and a resistance. The voltage source is formed by determining the voltage across the two terminals with nothing connected to them and the resistance is formed by nulling all the independent sources in the network and finding the resistance looking into the two terminals ok. So, as I said we will work out an example and the example circuit I took was this very simple circuit I have a 10 volt source 3 kilo ohm resistance series with 7 kilo ohms and these are the two terminals at which I want to find the Thevenin equivalent. This is very important I mean what is equivalent when you say it is the Thevenin equivalent of a circuit. The Thevenin equivalent applies only to some two terminals specified in this case it is just one and one prime ok. So, now my question is what will be the Thevenin voltage across one one prime in this circuit please try to answer this ok I think all of you are able to immediately recognize that it is this resistive divider 7 kilo ohm divided by 7 plus 3 kilo ohms times 10 volts so it is 7 volts that is the right answer ok. So, again there are some complaints that audio is not ok but it seems that many other people are able to hear so the problem may be with your setup you please try it again ok. So, now the next thing is what is the value of RDH what is the value of RDH looking into these terminals again what you should do is you should take the independent circuit independent voltage source in this circuit make it 0 and find the resistance looking back into the circuit ok. So, I have to make this 0 volts or a short circuit I have to look at the resistance here again the answer is very simple this is a short circuit and you will be able to easily see that the 3 kilo ohm and 7 kilo ohm are in parallel. So, the answer is 2.1 kilo ohm again I got some answers like 2.1 and so on please do not do this always specify the units for any quantity that has dimensions ok. Now, somebody said 7 k parallel 3 k that is correct so I was looking for the numerical value ok. So, what it means is that this entire circuit can be replaced by a 7 volt voltage source in series with a 2.1 kilo ohm resistance ok. Is this part clear make the circuit more complicated I will add a 10 milliamp current source as shown in red ok. So, now we have to find there are now of course according to Thevenin's theorem at 1 1 prime I should have marked the terminals here this is 1 and 1 prime at 1 1 prime I can represent this new circuit also with a single voltage source and a resistance ok. Now, my first question is what will be the value of the resistance in this new circuit what is the value of RTH again as many of you are able to recognize it is exactly the same because when you know the voltage and the current source you short circuit this and you open circuit the current source you are left with exactly what you had before. So, value of RTH does not change at all ok. Now, what will be the value of VTH the Thevenin voltage source what is the value going to be what will be the value of the VTH voltage source VTH with the new with the current source added ok what is the value of VTH. So, we already say there are many ways of doing it you can redo the circuit analysis with the voltage and the current source together you can also use superposition here to calculate VTH as well because after all it is a linear circuit with independent sources and superposition means you have to find the voltage VTH due to 10 volts and the voltage VTH due to the 10 milliamp current source the voltage due to 10 volts have already found previously ok. So, the only thing you have to do is to find the voltage due to the 10 milliamp current source and add it to the voltage due to the 10 volt voltage source ok. So, the question is about the VTH value with this new circuit which has the 10 volt voltage source 10 milliamp current source and the two resistors ok. Now, also given some choices. So, please do the calculation and let me know what the voltage value VTH is or indicate it on the pole or just give me the value ok. I think again many of you are able to do it correctly although one person said 0 volts I am not sure why that is the case. So, let me do it and show it although this also is quite simple to do this with superposition which means that first I will set the 10 milliamp source to 0 which is an open circuit and then I will set the 10 volt source to 0 which is a short circuit ok. Now, this one we have already done before. So, I am simply going to write down the answer. So, the answer here is 7 volts and this other one you should be able to see that this 3 kilo ohm and 7 kilo ohm are in parallel and they are in parallel across this current source ok. So, we have an equivalent picture like this. This is the 10 milliamp current source and this is 3 kilo ohm and 7 kilo ohm in parallel which is 2.1 kilo ohm ok. Now, by the way this is 1 and 1 prime. So, the voltage across this from 1 to 1 prime that is with 1 being positive is minus 10 milliamps times 2.1 kilo ohms because of this polarity of the 10 milliamp current source. So, 10 milliamp is being drawn like this. So, this voltage is minus 10 milliamp times 2.1 kilo ohm which is minus 21 volts ok. So, again if you have got some different answers please look at this and then figure out where you are going wrong. So, the total voltage is the sum of this due to 10 volt source and this due to the 10 milliamp source. So, clearly minus 21 plus 7 is minus 14 volts and this is the correct answer ok. So, with the current source added what we have is minus 21 volts and sorry minus 14 volts and 2.1 kilo ohm in series ok 1, 1 prime. So, what I try to demonstrate is that even if you make the circuit more complicated you can represent it equivalently ok. Now, this will be equivalent circuit regardless of what you connect to 1 and 1 prime ok. This hopefully you understood this point that I connected some I X here and that I X can be either a current source or a representation for any kind of load. So, whatever you connect between 1 and 1 prime that does not matter. This part what we are replacing is this part here that can be represented by this minus 14 volts and 2.1 kilo ohms in series. In fact, what you connect to this can be non-linear. The part that we are converting to thermally equivalent that has to have only linear elements and linear elements and independent voltage and current sources ok. Now, there is a question about the polarity of the current source I think you got the answer right anyway. So, what I am saying is that if you have a current like this and then you have a resistance ok. So, the voltage measured with this polarity will be minus I times R ok. So, if the current was flowing like that the current I is flowing like that the voltage in this polarity will be I R ok. Now, if the current is in the opposite direction which it is if I is like that it will be minus I R that is all I said ok. Is that clear? Ok. So, now just for we will take it just a small step further ok. Let me add another resistance like this which is 1.9 kilo ohms ok. I will take some value and again at 1 1 prime I have to find Vth and Rth ok. Now, please tell me how will Vth and Rth change for this new circuit with this 1.9 kilo ohm resistance what will be the value of Vth? Previously when we did not have this this was the value of Vth ok. So, what is the value of Vth when we have that 1.9 kilo ohms? I think many of you recognize that Vth will be the same because when this is open circuited that is how you find Vth there is 1.9 kilo ohm is floating and no current is flowing through it. So, whatever voltage appears here will be the same as or what appears there ok. So, this is a special case with the way I have connected this 1.9 kilo ohms, but when I open circuit this no current is flowing through that. So, whether you have this 1.9 kilo ohm or not you will get the same voltage ok. What will be the value of Rth? Again this is simple because we have the 3 kilo ohm and 7 kilo ohm in series and this 1.9 kilo ohm like that. So, we know that looking here between these terminals we had 2.1 kilo ohms and this 1.9 kilo ohm is simply in series with that. So, looking this way it is 4 kilo ohm that is 2.1 plus 1.9 ok. So, the equivalent circuit for this including that would be minus 14 volts and 4 kilo ohms ok. So, this is just to illustrate the point that you can make the circuits more complicated, but the representation can remain exactly the same and you can find the representation ok. Now, this circuit is still too simple even if you had 100 resistors and then control sources and so on you can still find the Thevenin equivalent circuit ok. So, any questions so far on any of these calculations or proof of Thevenin's theorem ok. So, that seems pretty clear. There is another theorem which I will not prove you can try to prove it yourself by following another methods and if you get stuck somewhere you can ask me later. So, instead of using a voltage source and a resistance in series ok, any network of the same type, any network with linear and independent sources can be represented by a current source I n and a resistance R n in parallel ok. So, instead of a voltage source Vth and a resistance Rth in series we can represent the same by a current source I n and a resistance R n in parallel ok. So, now it turns out that this I n is now what is known as the short circuit current and the R n is what is known as the Norton resistance ok. So, we have the short circuit current and the Norton resistance. Now, what is the short circuit current? The short circuit current is you take this terminals 1 1 prime short circuit and measure the current ok. So, you short circuit this one and measure the current flowing from 1 to 1 prime that is the short circuit current I n ok. And R n is the same as the resistance looking into the circuit with all the independent sources nulled which will be the same as R dh ok. So, the Norton equivalent the resistance in the Norton equivalent circuit and the Thornian equivalent circuit will be exactly the same because they are nothing but the resistance looking into the circuit N with all the independent sources set to 0. And this I m is the short circuit current that is when you are short circuit 1 1 prime you will have a current I m and this Vth is the open circuit voltage that is if you have an open circuit across 1 1 then the voltage that appears at 1 1 is Vth ok. Now, this I n is of course related to Vth in a very simple way and the very easy way to see that is first of all this is the Norton equivalent circuit of this and this is the Thornian equivalent circuit of the same circuit. So, clearly these two also have to be equivalent to each other and if you look at the open circuit voltage between 1 1 prime what we have is Vth itself because by definition there is the open circuit voltage and here also you see that no current flows through R dh. Now, in this case if you open circuit 1 1 prime all of this I n will flow into R n and the voltage that appears is I n times R n and these two have to be equal to each other ok. So, I n times R n equals Vth or I n times Rth equals Vth and R n and Rth are the same thing ok. So, I hope this is clear as well. So, instead of using a voltage source and resistance in series you can also use a current source and resistance in parallel as an equivalent to any two terminal circuit which has independent sources and linear elements ok. And this idea of using a current source and resistance in parallel is known as Norton's theorem. Just for completeness let me write out the statement R dh and R n of the same and I n is short circuit current between the two terminals when you short circuit it that is the current that flows there ok. So, again I hope this is clear. So, very quickly we will evaluate this what would be the Norton equivalent this has to be represented by a current source I n and the resistance R n in parallel what will be the value of R n in this case what is the value of R n. So, clearly it is the same as R dh we already calculated. So, this is 2.1 kilo ohms and what is the value of I n and also we are able to recognize that it is 10 by 3 milliamps or 3.33 milliamps you can either get it from the previously calculated thermion equivalent circuit that is we had 7 volts and 2.1 kilo ohms and we know that I n times R dh equals V dh from this you can calculate or even in this case looking at the circuit if you short circuit this what happens is that we have this 10 volts and 3 kilo ohms and a circuit like this no current flows through 7 kilo ohms because it has 0 volts across it and the current that flows this way is 10 volts divided by 3 kilo ohms or 3.33 milliamps okay. So, now you can also try it with all these other things added when I added the 10 milliamp etcetera okay you can figure out what happens okay. So, that is the story with Newton's theorem and you can prove it in exactly the same way that we proved the thermion theorem to prove the thermion theorem what we did was we use the current source here and then use superposition in some way. Now instead of a current source you can use a voltage source like any load can be substituted either by a voltage or a current source. So, let us say you substitute with a voltage source here and then you apply superposition and then you can try proving Newton's theorem okay there was a question which I think was regarding this circuit saying if there is yet another current source here 3 milliamp bond happens. So, this is quite simple there is 3 milliamp and 10 milliamp are in parallel it is like having just a 7 milliamp current pointing downwards okay. So, instead of 10 milliamps you have 7 milliamps now the contribution of the current source so this was minus 21 volts. So, instead of that it will be in proportion okay minus 21 volts times 7 by 10 that is the meaning of linearity right. So, you can calculate how much this is this will be minus 14.7 volts I believe. So, instead of adding minus 21 to 7 you have to add minus 14.7 to 7. So, the net voltage will be minus 7.7 volts okay this is fine any questions. So, now we have discussed the 7.7's and Newton's theorems they are very very useful and they are used very frequently for representing circuits of two terminals okay and this happens all the time you design some circuit it is very complicated but it has two terminals available to the outside world and what you have to do is to give an equivalent picture to the user and this will do exactly that you will get with the Thevenin or Norton equivalent circuit which is very simple you will get the equivalence of the circuit at those two terminals okay you will not get an internal picture of what is happening but at those two terminals the behavior of voltage and current will be equivalent to that of the original circuit okay. There is a question on where to use Norton's theorem I guess the question probably is no one to use Thevenin or Norton and that is entirely based on convenience okay sometimes we use Thevenin's theorem and sometimes we use Norton's theorem. In fact there is an interesting thing here that we can discuss briefly. So, now like I said any circuit so there is also another question what is the proper condition for Thevenin and Norton I guess what is meant is that what kind of circuits can be represented by Thevenin and Norton and that I wrote out here so this is exactly the condition any two terminal network with linear elements and independent voltage and current sources if you have a circuit that is like this then it can be represented with either Thevenin or Norton equivalent circuit okay. So, if you have nonlinear elements you cannot do this okay and also one thing which I mentioned last week as well that if you do have dependent sources in this that is okay but it should be dependent only on quantities inside N okay you cannot have them externally controlled. Now like I said any two terminal any circuit with only two terminals available can be equivalently represented at the two terminals using either Thevenin or Norton equivalent circuit okay. So, now let me say this is my circuit okay this is now an extremely simple circuit I have a voltage source okay. Now what is the Thevenin equivalent of this and what is the Norton equivalent of this voltage source please try to reason out and answer this question this is not so much of calculation but reasoning out I have only a voltage source connected to terminals 1 and 1 prime okay. So, what is the Thevenin equivalent of this and what is the Norton equivalent of this and answer for Thevenin equivalent is very clear it is the same as the circuit okay with RTH equal to 0 VTH will be 10 volts and RTH will be 0 okay but what is the Norton equivalent of this circuit yeah again I have got some answers saying either the current will be infinite or it does not exist all these are correct. First of all there is also a question why the RTH of this is 0 and that is quite simple so in this you have a single independent source and that you set to 0 okay. So, you make it 0 volt which is a short circuit and then you are looking at the 1 1 prime so what you see is a 0 ohm resistance okay. So, RTH equal to 0 for this that is pretty clear okay. Now, the Norton equivalent does not exist because IN is VTH by RTH and if RTH is exactly 0 if it is non-zero then you can find it if RTH is very small you can find this IN which will become very large but if RTH is 0 this will tend to infinity okay that is you have an infinite current and across it you will have 0 resistance because RN which is RTH is 0 okay. Now and this infinite current through the 0 resistance can give you some voltage in this case 10 volts but this is really a useless representation okay when you have infinities in the circuit you cannot calculate anything but I am just making the equivalence here. The way to imagine it is you imagine some resistance in series with this voltage source and take the limit as it goes to 0 okay. So, my point here is that while in general any circuit can be represented by either traveling or mountain it is possible that one of them does not exist okay. So, one or the other will surely exist but if you have a pure voltage source between terminals 1 and 1 prime the Norton equivalent does not exist because we cannot short-circuit and find the current or in other words if you short-circuit an infinite current will flow okay. Similarly, if you have a pure current source between the terminals 1 milliamp 1 and 1 prime this again the Thevenin equivalent does not exist and the Norton equivalent is the same as this it is just a current source okay. Now there are a couple of questions first of all if we reverse the case we can get any voltage that is exactly the point here it is indeterminate okay so when you have infinity here it is indeterminate. Now the other question is if you have a voltage source and a current source do you have a Norton's equivalent? If you have a voltage source and a current source then in parallel the result is just a voltage source okay. Just mentioned a few times before if you have a voltage source in parallel with anything okay whether it is a current source or whatever else it is the same as the voltage source itself okay but I have a current source or not it does not matter the only thing that it will change is the current through the voltage source otherwise nothing will change okay. So clearly if there is a voltage source and there is no legitimate Norton equivalent circuit for this one okay. So I hope that part is clear as well. So there can be degenerate cases where one of the other equivalent circuit does not exist but at least one of them will surely exist okay and again somebody asked about the application of this theorem as I said it is widely applicable. The basic point is to abstract out all the details of a very complicated circuit. You have a very complicated circuit with lots of components instead of using all of that in every circuit analysis if you are interested in the behavior only at two terminals you can use either the Thevenin or Norton equivalent circuit okay. Any other questions? So again there is some confusion regarding the load. This equivalence is independent of the load whatever you load you connect to it the behavior at one and one prime will remain the same as in the original circuit okay. So if you want to find the effect of the load on the original circuit if you instead connect the load across the Thevenin equivalent circuit and you will find exactly the same behavior okay. So now that we have discussed Thevenin and Norton theorem let us move on to another very powerful theorem which is also used widely. It is mainly used to get more theorems out of circuit behavior okay. Now let us say we have some circuit. I will show arbitrary branches I do not really care what the branches are okay. There can be any elements and I will number the branches let us say 1, 2, 3, 4, 5, 6 and I will label the voltage of every branch be 6 and then I will also label the currents consistent with the passive same convention I1, I2, I3, I4, I5 and I6 okay. So now basically I have a circuit but I mean this I have shown that 6 branches but any number of branches is okay right. So now let us say we compute the sum of power in all the elements that is sum of vkik over all branches. What do you think this is going to be? Please give me a guess. Actually many people are still asking questions. I will deal with them soon after I deal with this particular thing. That is in this particular case I sum the power in all the branches I1 plus v2I2 plus v3I3 plus v6I6. What is it going to be? It turns out that this number will be 0 okay and this is known as conservation of okay. Now this conservation of power what it means is that if you have a circuit and if some sources are dissipating power and some others will be generating power okay. Whatever power is dissipated has to be generated in some part of the circuit okay. So there is no other external source of power right. So we have only electrical variables here and electrical connections between elements. So whatever power is generated in some elements will be dissipated in other elements or whatever power is dissipated in certain elements has to be generated in some other elements of the same circuit okay. So that is what this statement means that power is conserved in a circuit okay. Now this also can be proved and this can be proved basically using only Kirchhoff's voltage law and Kirchhoff's current law okay. Now this is completely unrelated to what kind of elements we have. It could be linear, non-linear or whatever. But as long as our elements obey KVL and KCL which is basically a fundamental property of the circuit this conservation of power holds good okay. So in fact I would strongly encourage you to try and prove this using only KVL and KCL okay. And I will give you a hint. So let me not name them N12. I will label these nodes N0 which is the reference node. You can consider this to be the reference node. It does not matter which one it is. And NA node NA node ND and node NC okay. So you can try to prove this by making these products VKIK that is V1, I1, V2, I2 etc. And this V1, I1, V2 and so on are the branch voltages okay. Now you try to represent these branch voltages in terms of the node voltages that is VA, VB, VC with respect to the reference node okay. And then you group all the terms containing VA and VB and VC together and then you use Kirchhoff's current law you will be able to prove this okay. So please take it as an exercise and do that. Hopefully you will be able to do it otherwise we will discuss it later. So for this you have to represent branch voltages in terms of node voltages and group the coefficients of each node voltage. And then you will be able to pretty much immediately see the answer okay. So I will stop with this discussion here. I will continue with this in the next lecture. But there were a few questions regarding Ternian equivalent circuit. The first one is what do we do when we have dependent sources? Now dependent sources you find it in exactly the same way as we did with resistors okay. Now with resistors what we did was to use the resistor formula to calculate the resistance but in general if you have any network with two terminals let's say one and one prime. The way to find the resistance looking into one and one prime is to apply a test voltage V test and analyze the circuit in case of Ternian's theorem whatever is inside will be nulled. All the independent sources will be nulled and you find I test. Now because you have a single independent source V test the I test will be proportional to V test. So the Ternian equivalent circuit will be Ternian resistance sorry will be V test by I test okay. Now this is true whether you have dependent sources or not. Now when you have resistors only sometimes you may be able to use the formula for series of parallel combination of resistors. But in general even with resistors this is the method to use okay. So let me take a very simple example again this is a voltage controlled current source whose value is let me call this Vy and the value of this is Vy divided by 2 kilo ohms or basically 0.5 millisiemens times Vy okay. Let us say this is 10 volts. So how would you go about doing this? You have to find the open circuit voltage which of course you do by in the normal way one one prime. You do circuit analysis to find out the voltage across this okay. And you have to also find the Ternian resistance for that you set the 10 volt to 0 so that becomes a short circuit. We have 5 kilo ohms here and we have Vy and this all these things will remain exactly the same okay. You do not change anything in the dependent source. Then you apply this V test and find I test. The ratio of the two will give you RTH looking into this. Now this is a very simple circuit but whatever arbitrary connection of dependent sources you have you can still follow exactly the same procedure okay. I hope this is clear. So procedure is exactly the same. You have to find the resistance between one and one prime. If you are given a black box let us say in the lab and ask to find out the resistance between one and one prime what will you do? You will apply some voltage across one and one prime. Find the current that flows through it take the ratio or you will post a current from one prime to one. Or see the voltage that is developed across it and take the ratio okay. So that is how you do it for any circuit. Now it just happens that if you have only resistors you may be able to take some shortcuts okay. Now the other question was somebody said how do we give the direction? I am not sure what is meant by this. Maybe what is meant is the direction of the current source okay. So when you find the not an equivalent circuit you will short circuit the output from one to one prime. And you measure the current flowing from one to one prime okay. So that gives you the direction right. So if the current is actually flowing from one to one prime then inside you will have a current source like this okay. If in the short circuit current is flowing that way then inside ion will be like that. If it is in opposite direction then ion will also be in the opposite direction okay. So there is no confusion here. Now other question is can source transformation be applied if the network contains non-linear elements? Now like I said before the part that you are transforming has to contain linear elements. So what I mean by this is the following. So I have taken the example of this network N with independent sources and linear elements. And linear elements includes the resistances and controlled sources. The only condition that the controlled sources have to be controlled by something inside N. Some branch voltage or branch current okay. And you have one one prime. Now the part that you are transforming this has to be linear. Now if you have non-linear elements elsewhere in the circuit something like this then that is okay. This is not what you are transforming. So whatever I have shown inside the red box that is linear and that can be represented by this Thevenin or Morton Equivalent Circuit. And the source transformation means that you either represent I mean you go from voltage to current source representation which means that that is also applicable only to linear circuits okay. Any other questions? Okay so if there are no more questions please try to do some of the things that I indicated that is trying to prove the Morton's representation that it is valid for any circuit. That is one thing you can do and you can follow the lines of what we did for Thevenin representation. And you can also try to do the other one that is try to prove conservation of power for any circuit using KCLN KVL okay. Okay there is another question again I am not clear of where this question is. It says across a single element if there are two voltage sources of same magnitude superposition fails and finding the current in the resistor. The question is are there voltage sources in series? Is that what is meant here? Now see if you have two voltage sources of same value in parallel okay. Now this is the same as a single voltage source. So that is one thing. Now if you insist on using superposition you will get a digital rate answer. Because if this is V and this is V and you have to set this to 0 then you have to short circuit it okay. So you will have infinite current here and some voltage across the resistor and so on okay. So this is basically a digital rate condition and you cannot represent things like this okay.


My name is Jordan Reign, I work at a company called Clio, I'm a developer there, and I've been writing Ruby code and been a Rails developer for about nine years. Our company's based in Vancouver, Canada, and over that nine years I've had the chance to upgrade apps from Rails two to three and three to four and four to five. And I can still remember the Rails two upgrades, or Rails two to three upgrades rather, and how many breaking changes there were. And it was painful, but thankfully things have gotten better and there's fewer breaking changes for every version as we get them. On top of that, we have deprecation warnings now that are getting better and better and in a lot of cases they're telling you exactly what to do to make sure that your app will work with the next version of Rails. On top of that, we now have beta periods that can go for months where we can test out the newest version of Rails or we can run master and all of these ways in which the upgrade path has become better. And yesterday when Eileen in our keynote mentioned that Rails isn't dying, it's maturing, looking at the upgrade path, this sure seems to be the case. At least on paper. In practice though, it still can be really, really hard. And it's hard for us at Clio, and when I got a chance to talk with some other companies about this, it's been hard for them as well. And I was chatting with somebody this week and I learned that there is a lot of consultants who will actually go in and do this for companies because some companies just can't afford to do it. They don't know how to do it. I don't know how to get out of the code base that they built for themselves. And it had me asking this question, with all of the improvements that the Rails core team has done, why is it still so tough to upgrade Rails? I wanna dig into this over four parts, starting with a story of two Rails upgrades. The first one is a small startup and one day, one of the developers is scrolling through Twitter and sees a tweet from GHH. Rails 5.2 is out. She has been meaning to try out active storage and she doesn't have much on her plate so she decides to upgrade. She spends the rest of the day upgrading gems, running the tests, making them green, and sends it off for code review. The next day, her and another developer work through all the major flows in the app and get it running. And then the end of the day, they ship it. 24 hours later, they're running the latest version of Rails. The next story is a different company. It's a bigger company. It's been around for many years and they have a larger team of developers. They also have thousands of customers who pay them for a service. When they see the tweet from GHH, in their Slack team channel, they don't get excited. They actually feel dread because now they are two major versions, two minor versions and one major version behind and they're now running out of maintenance. So they can't defer any longer and they put together a team and they start the project. Bit by bit, they upgrade their code base and if they can ship any of the changes, they will do that but it takes them still three months to finish. Once they're done, they haven't done this for a long time. They haven't deployed a new Rails for many years and so they're a bit uncomfortable with the idea so they schedule some downtime just to make sure. They push out the deploy and it sticks. They're now running the latest version of Rails. It may not seem fair to compare these two upgrades. The startup only had a couple gems. They didn't have much in their code base and so they didn't have to change very much code. And they didn't have that many tests and so they had very few failures as well. And when they came time to deploy, their app wasn't mission critical so they could take bigger risks than just ship it. The other company on the other hand had many gems to upgrade some of which were no longer in maintenance. They had thousands of lines of code to go through and figure out if they were working or not and they had many, many tests that would pass or that would be failing but they didn't actually realize that right at the start because their test suite wouldn't even boot. And when it came time to deploy because they had many people rely on them, the deploy was very scary and they couldn't take any risks. But both of these companies fundamentally did the same thing. They upgraded their gems, they changed their code, they tested it and they deployed. There's no question that one of these companies had a lot more to do at each of these steps. But the end result was the same. They were now running a new version of Rails. The question that I had was, is this inevitable? Is this inevitable part of a growing company and an aging code base? And that brings us to Clio. Our upgrade paths look a lot like that second company, right? And we've been around since 2008 building a product for lawyers to help them run their business and help them do their job. And when I started to look at our next Rails upgrade earlier this year, I started to ask this question, why is it so difficult? What have we done in the past and what can we do to make it better? And to do that, I went back in history and looked at what we did. And to bring you up to speed, I'm gonna give you a quick look at our upgrade path and timeline. This timeline starts with Rails 2.0 in 2007 because that's the version of Rails we ship with when the product first launched. The very same day that 2.0 came out, our founder upgraded the app to 2.0. Halfway through 2008 when 2.1 came out, again the very same day we were up on 2.1. 2.2 comes out a couple months later and we lag a little bit three months behind but we're back on top. And then 2.3 comes out and we lag a little bit more nine months this time. And then 3.0 comes out and then 3.1 and then 3.2. And then I guess we feel some pressure because in 2012 we upgraded to 3.0, 3.1 and 3.2 over a five month period. And then 4.0 comes out and then 4.1 and then 4.2. And again, 2015 we go 4.0, 4.1, 4.2 over a six month period this time. And then 5.0 comes out. And then 5.1, 5.2, too fast. And when you look at this timeline there's an obvious pattern, right? And the interesting part to me when I look back I was surprised to find that the part that was interesting was not 2012 and 2015 when we were actually doing the Rails upgrade. It was the space in between. It was these gaps. And I found myself asking what were we doing during these gaps? Like why didn't we upgrade the app? What were we thinking, right? When you look at it like this it seems obvious. But then when I look back and thought about the business and thought about what we were doing during that time it turns out we were doing quite a lot of stuff, right? We were growing as a company. We were hiring developers. We were building features and functionality. We were adding customers and we finally started making money. So we made a lot of good business choices during this time. But we also made some questionable technical ones. And that's what I wanna dig into because I think the key to making Rails upgrades easy is in these gaps.  When you upgrade your framework it has this amazing impact where you have to pay off some technical debt that you've been accruing over the years. When you open your gem file or when you open a file that hasn't been touched in a couple years you find some pretty crazy stuff. So when we look at the gem file and we start to think about what the problem is for us what we found is there was a lot of old gems. And I think it's very tempting to add a gem to your gem file when you need some piece of functionality and be content to leave it there and ignore it for the rest of your company's history if you can get away with it. But there's a problem with that, right? Code decays. Code has this way of browning and shrinking and withering to the point where it's going to cause you problems. And even though those gems aren't directly in your Git history that code is still running on your production servers. And if you leave it it will cost you. And this comes down to the idea that dependencies are not free. And this is not a new idea, we know this but sometimes it's easy to forget. There's a really interesting blog post on the Joel on Software blog from 2001 where he talks about the Excel development team's approach to dependencies. Finally, dependencies and eliminate them. And they took this to an extreme where they built their own C compiler for the Excel project. This seems ridiculous if you think about it now especially for us in web apps. But he went on. Oh, got to stop doing that. The Excel team's ruggedly independent mentality also meant that they always shipped on time and their code was of uniformly high quality. So they acknowledged the cost of their dependencies and they decided that they could build it better and cheaper themselves. Now this isn't to say that we should open our gem file and empty our dependencies. Empty it every gem we have. But we need to acknowledge that cost. It doesn't make sense for me to build my own web framework. I'd rather use Rails. But I need to commit to updating it. And this applies for all our dependencies. And if you don't do this, if you neglect to do this, the problems compound on themselves. I'll give you an example from our code base. We integrate with QuickBooks Online. And to do that we use a gem called QuickBooks Ruby. It relies on another gem, OAuth. And we've been using OAuth in production for many years before we started using QuickBooks Ruby. For reasons we also pinned it to an older version of OAuth. And so the gem hadn't been upgraded in many years. This was fine because QuickBooks Ruby worked with it. Until six months later we needed to get a bug fix into our app and needed to upgrade QuickBooks Ruby. Unfortunately the new version of QuickBooks Ruby upgraded the OAuth version. And so it didn't work until we upgraded that gem. So we were faced with this decision. We could not upgrade either gem, leave the bug in our app, or we could upgrade both gems and it would entirely blow out the scope of this otherwise simple fix for a bug. So when faced with this choice, we chose option C. Let's fork the gem and downgrade the version of OAuth it uses. And at the time this may have seemed like a good idea because we got the bug fixed and we didn't blow out our timeline. It looks something like this in your gem file. And we deferred the cost but it ended up coming back to bite us because every single time we had to upgrade this gem somebody had to go in, find the fork, merge in all the codes from upstream, make sure that it still worked with our version of OAuth and then upgrade the SHA in our gem file and ship it. So when a developer is faced with this kind of upgrade it's much less likely that they're gonna do it. So we would only upgrade this gem when we absolutely needed to. And this comes down to a simple idea that the more rigid your dependencies are the more difficult they will be to maintain and the more resistance developers will feel when they need to upgrade them. So they'll punt. Another thing that we did while during those gaps was that we merged a lot of code. And then we merged more code and then we hired more developers and merged more code. And a funny thing happens when you ask a developer to do something. They look through the code base and pattern match to find something that does something similar. Like copy it, tweak it and put it in the next place.  And the minute you copy and paste that you now have created a new task for yourself. And it's not such a big deal with changes like this. You can simply find and replace a for filter with before action. But some changes are more difficult to get out. Adder accessible and Adder protected Adder protected were notoriously difficult to get out of your Rails app. They hadn't impact across any controller who used these models. And when faced with this option upgrading from Rails three to Rails four we chose to add protected attributes because it gave us a little bit more runway to get it out of our app. But deferring this choice just made the problem worse because we kept propagating it around the app. And even when we pulled it out of our models we found that this gem added functionality across the whole application when we tried to mass assign things. So pulling it out became a huge hassle. And I know that we weren't the only ones because this gem has been downloaded five million times since it came out. And to put that into perspective active record since 5.0 has been downloaded 15 million times. So I think this is probably a pretty common pattern that we've done. And it makes me feel like we must like protected attributes at least one third as much as active record. The other thing that happened during these gaps is that we started to disconnect from the Rails community. We started to solve problems that had already been solved by Rails. And in some cases been solved by Rails in a better way. This happened when active record enum came out in Rails 4.1. When we needed to upgrade, when we needed to map an integer in the database to a string in the app we built our own version of it. And we didn't just build one version of it we built two or maybe three people all over the app doing a similar thing. And they behave similarly and they offer the same functionality but they were a little bit different. So when we finally got up to Rails 4.1 and could use it we still had these different patterns peppered throughout. And when active job came out in 4.2 we were already heavily invested in another solution. So we skipped it. And it's okay to build something yourself if it's core to what you do but if you're doing it because you're behind you're just wasting effort. And on top of wasting effort and energy you're also making it harder for new developers to come to your company. When they start to onboard and they try to do the things that they're used to doing at other companies they may find that they won't work. That they have to check what your Rails way is. So after looking into it I found that these gaps they make me feel like this. They demoralize you and discourage you from doing the things that you maybe ought to. So let's close those gaps. So the good news here is that most of the things that you need to do to upgrade Rails you can do at any time and you can do them in very tiny steps. There doesn't need to be a long-lived branch and it doesn't need to be a special group of people. And for us we did this in three specific ways. The first was to keep the gem file healthy. If we go back to that rigid gem file from earlier there are a couple things we can do to make it easier to work with. The first thing to do is to drop version constraints. There are reasons that you might want a version constraint but make sure that you have truly a good reason for it and if it's a specific reason that you can get rid of do so. If you have to upgrade open your gem file to upgrade a gem, it's probably too rigid. The other thing is to kill your forks. If version constraints make your gem file rigid forks are in order of magnitude worse. They make it difficult to go back and upgrade the gem the developer needs to think about why did we fork this in the first place? What changes did we make? Are they still applicable? And that will look like this. It feels so much better. And then the other thing and this is the hardest thing is to create a habit and create a culture of updating gems eagerly. Not waiting until you need a feature from that gem. Not waiting until there's a bug fix that you absolutely need to add. Because you won't always know when there's a bug you're experiencing. There are some tools to help with this. Bundle outdated is one. When you run it, it looks something like this. It will give you one line explaining a gem that has been outdated. Now, unfortunately, when I ran this, I got something, sorry, let me zoom in on one of those lines and explain it a little bit more. The first thing you get is a gem name. Then you get the newest version available. The version you have installed and then the version you requested if you've got a version constraint. And then the group it's in. The problem is when I ran this on our code base, the output was overwhelming. Now, this is from discourse and this is about 100 gems that are out of date. And when I ran it against ours, I got up 250 that were out of date. So where do I start? What's the most important thing? What's unmaintained? What's old? To help with this and inspired by bundle outdated, we wrote a script called bundle report. And it uses the functionality provided by bundler and Ruby gems to kind of introspect your gem file. It's got two modes, the first mode is outdated. And as you might imagine, it outputs something really similar to bundle outdated. But with a few differences. The first one is that it'll output the gems from oldest to newest. And here we're pulling off the top five oldest. So you can immediately see that these gems probably need to be updated. If we zoom out on one of those lines, you get some slightly different information. You get the name of the gem, the version that was installed on your local host. You get how old it is. And then you get the newest version available and how old that is. And this slightly different set of information lets you tell what is oldest and what is unmaintained. In this case, it's a seven-year-old gem, probably should update that. And the newest version available hasn't been updated for four years. So you could probably guess this is an out-of-date, unmaintained gem. You probably want to get off of it. And if you really need it, maybe you should take over maintenance of it. The second is focused specifically on Rails upgrades. And you use it like this. You set a Rails version that you want to upgrade to, and it outputs something like this with three sections. The first section tells you what gems will not work with Rails 5.2 and tells you what version you need to upgrade it to to get it to work. The second section gives you a list of gems that do not work with Rails 5.2 and also do not have a newer version that works with Rails 5.2. So these are gems that you either need to ask the maintainer to update or drop them from your app. And then the final section just tells you how many gems you have to go before you can run that version. So let's keep the gem file healthy. The next section is to outlaw deprecations. And as I mentioned earlier, deprecations have gotten better and better. And any most major changes you can catch if you're running the latest patch version of the previous version of Rails. In this example, it's telling us that we shouldn't pass an active record model to find. These will typically be printed to your logs, but you can send them elsewhere. One thing you can do is raise. And if you're anything like us, this is not an option because if you did this, your tests would fail and your app would break in many, many ways. So this was never an option on the table for us. And so to get ourselves to a place where we could turn this on, we wrote a small deprecation tracker. And with what's available with the active support, this is actually really small and simple. You could do this in-house. It's about 150 lines of code. And this ties into RSpec and it will track what deprecations come out of each test file. You use it like this, run your whole specs in save mode and it'll generate a list of deprecations. And then when you're on CI or local, you can run it in compare mode. So if any of those deprecations change or they're added or they're removed, it'll raise an error. And this was really important for us because we had thousands of places in the code that called deprecated methods. But by doing this, we instantly stopped anyone from inadvertently or intentionally adding new deprecations. So immediately, you've planted a flag that says things will not get worse. This is what it looks like on CI when it fails. It'll give you a diff of what changed. And people can fix this on their own. They don't need to be told. They don't need to be, you don't need to check people's PRs for this. And this had another effect, which was we now have a to-do list of all the test files and what deprecations come out of them. So everything is broken down by test file and the messages you get. And with this list, we can do other cool things like display the most commonly occurring deprecations. So you know where to put your energy to have the biggest impact. Or you can run all the tests that have deprecation warnings. Or if there's too many tests, you can filter it by a certain red jacks. So if you wanna fix one type of deprecation across your whole app, if that's, you're in that mind, the headspace, you can just run those specs again and again. And once you've fixed those tests, you can save them to the whitelist.  There are no deprecations left in your app. So that's a lot of deprecations. The last one is to dual boot Rails Next. Rails Next was, I first heard about this from Shopify Post on their Rails 5.0 upgrade. And I immediately fell in love with this concept of Rails Next. And it means whatever version of Rails you're gonna go to, whatever version of Rails is next for you. If you're on 4.2, it's 5.0. If you're on 5.0, it's 5.1. And if you're on 5.2, it's master or a beta or an RC. And this is a really powerful idea. The idea that your developers can very easily boot up the app into the next version of Rails. This is how we do it. And it means that our developers can take commands and the commands they know already and run them. So here we could start the server. We could run our tests. We could save a white list of all the deprecations in the next version of Rails. And this lets people go in, find a problem, and change it. And ideally this means they're taking an old deprecated thing and they're replacing it with a new thing that works in both versions of Rails. You can merge that and you can just ship that. And the code base just got better. One of those patterns, those bad patterns, is now gone. This doesn't work in all cases, so when it doesn't, you can branch.  There are a couple different ways to do a boot. The way that we do it is this. Create a sim link of our gem file. We add this method to the top of our gem file that basically checks what gem file name we're using. And when we're using gem file next, we can return true and choose different gems based on what version we're in. This feeds two different gem file locks so that you never have any churn between when you run bundle install on the old version and the new version. And the vendor cache is also separate. This is how you set it up if you don't want to manually run those commands. And this is what that script looks like. It's really simple. This is a little bit broken down for the slide, but it does two primary things. It sets environment variables for bundler and then it runs a command. If the command starts with bundle, it just runs it, otherwise it'll wrap it. And so your developers now can take commands they already know and prepend them with bin next and they can run it in the new version of Rails. So it's no longer a daunting thing to get this going. And so when you see something like this, when you see an RC come out, you can in five minutes try to boot your app up and maybe tweak a couple of things and try to see if it works. And on top of that, once you have this in place, you can run this on CI. You can run it on every pull request so you can even just run it nightly. And you can see how far you are from the next version of Rails. How much work do you have to do? Does your app boot? How many tests are broken? And if you check this periodically, you can catch bad patterns as they come into the app. And actually Eduardo yesterday had a great talk on Rails upgrades where he talks about ways that you can actually mark tests as failing in the new version of Rails. And I think that's a really great way to do this where you can perhaps actually block pull requests when somebody introduced a new failure on Rails. So these three ideas, these three strategies, they kind of break down to one thing. Make it easy to do the right thing. Make the path of least resistance for developers in your company, the path that they ought to do, that they feel drawn to, but sometimes can't do if it's too much work. The examples in this talk are available in a gem. It's called 10 years RailsConf 2018. It is intentionally a mouthful because this is not a kind of gem that you wanna put in your gem file and commit. This is our internal scripts that I put into a gem on the way over here. But I wanted to have something that people could run, that people could try, and take it and tweak it and use it internally. So to close, what happens if we apply these ideas to that other company? The next time they come to upgrade their Rails version, instead of many gems, they're only gonna have a few because they've been keeping up to date on their gems. And because they have held the ground and have zero deprecations, they're gonna have a lot fewer code changes. And because they've been running it on CI with the next version of Rails, not only will their test suite run, but there will also be far fewer failures because they've been able to nip problems in the bud before they become and propagate throughout the app. And the deploy, there will be less code, but it's still gonna be terrifying. There are ways to make this easier, but I didn't have time to get into it in this talk. So the more you apply these ideas, and there are other strategies as well that you can do, the more you blur the line between Rails upgrade time and every other time. It becomes a persistent gradual process. And I think this is worth our effort because the things that make your code base better and make your code base a better place to work and the things that prepare it for Rails upgrades looks less like this and more like this. The things that make your app easy to upgrade also make it a better place to work. So what has this meant for us at Clio? Well, this is still a new shift for us, but over the past month or so that we've been applying these ideas, we've been able to remove 33 gems, update 27 other ones. We have reduced our deprecations to zero and we have fixed almost, well, about 90% of the failing tests that are in the next version of Rails for us. But it's an ongoing process. We're not on the final version of Rails yet, but we're committed to this idea. And I think the most exciting thing for me has been that this process has now shifted from a team of a couple of developers every couple of years to something that everyone can take a part in on your team. So as you hire people and as you grow as a company, your Rails upgrade team grows with you. So every Rails upgrade is hundreds of tiny changes that you can do any time. You don't have to wait. I have been, my brain has been in Rails upgrades for a couple months now. I am super excited to talk with anybody about the troubles they've had or the things that helped them. So please come chat with me afterwards. Thank you for listening.


Alright guys I'm hanging out with Super actress Anstela Hai girl Hi Santisana Karebu, Karebu no Lemi ask you What are you expecting from Muvi the series? Um ofkos ikona A-list actors Bughi, Faiz Shiko Ikona so many actors that I know but I'm expecting so much I love upia, I can't wait to listen to the music because I know the soundtrack is unique, the way they'll be writing, I can't wait to see everything come together. Now you know with Tosh Gitonga, waba ha tishi when it comes to like color and pictures, I can't wait. Now you see we see you on TV today, first of all congratulations on getting on TV but also let me ask you know we've known you to be on TV for years on acting you know did you take a break what happened? Oh yes I did after Kina I've been on long-term projects for a very long time so right now um I've just taken a break so maybe next year next year about 2025 maybe I'll come back yes. How come was it tedious or what's what's what's up? I was exhausted, I was exhausted yes and at least I wanted to do something that's quite challenging and presenting Sirayisi what you guys do the interviews Aki salut, mi wu jipata ni kiwa blank kusababu I'm so used to being the one who's being asked the questions I don't do the question is Sirayisi But how has been life you know just out now not waking up early in the mornings going on set? I still wake up early on TV At least you live the office early now Yes at least yeah I live the office early I have enough time to do other projects so yeah so siya tini mi take break from acting completely I can come back but it's a at least nzinga set from 11am What is it that you've been able to do now that you want able to do when you are on set all the time? Sleep I know I knew I said I've been able to sleep Yes and yeah na feel ni meza kuru di at least I've added so much weight Yes You know ni ki tu at least nkupu asai mentally I can remember and still because you know I've been in character for eight years So right now I can focus on just Anstella what Anstella likes Yes and I love it Yeah I know Boogie and Shiko are close to you They are one of the main characters in this series please tell them something I'm proud of you guys All right Anstella Karebusana and have a good evening Okay you too please enjoy the show as well Asante I wish you kwa seku ingi handani Kwa seku ingi handani please Kwa tu aksha ingi asho kianza tunaketi sisiwati Right you're perfect All right karebusana