Loop Definition and 1000 Threads

In computer science, a for-loop (or simply for loop) is a control flow statement for specifying iteration, which allows code to be executed repeatedly. Various keywords are used to specify this statement: descendants of ALGOL use "for", while descendants of Fortran use "do". There are other possibilities, for example COBOL which uses "PERFORM VARYING".
A for-loop has two parts: a header specifying the iteration, and a body which is executed once per iteration. The header often declares an explicit loop counter or loop variable, which allows the body to know which iteration is being executed. For-loops are typically used when the number of iterations is known before entering the loop. For-loops can be thought of as shorthands for while-loops which increment and test a loop variable.
The name for-loop comes from the word for, which is used as the keyword in many programming languages to introduce a for-loop. The term in English dates to ALGOL 58 and was popularized in the influential later ALGOL 60; it is the direct translation of the earlier German für, used in Superplan (1949–1951) by Heinz Rutishauser, who also was involved in defining ALGOL 58 and ALGOL 60. The loop body is executed "for" the given values of the loop variable, though this is more explicit in the ALGOL version of the statement, in which a list of possible values and/or increments can be specified.
In FORTRAN and PL/I, the keyword DO is used for the same thing and it is called a do-loop; this is different from a do-while loop.

View More On Wikipedia.org
  1. astrocytosis

    Induced current in a loop of wire when straight wire is cut

    Homework Statement A square loop, side a, resistance R, lies a distance s from an infinite straight wire that carries current I (pointing to the right). Now someone cuts the wire, so I drops to zero. In what direction does the induced current in the square loop flow, and what total charge...
  2. C

    I Two Loop Beta Function for Strong Coupling in QCD

    A one loop expression for the strong coupling can be calculated with the result $$\alpha_s^{(1)}(\mu^2) = \frac{4\pi}{b_o \ln(\mu^2/\Lambda^2)}\,\,\,\,\,(1), $$see e.g in the first few pages of the attached file, where $$Q^2 \frac{\partial \alpha_s(Q^2)}{\partial Q^2} = \beta(\alpha_s) =...
  3. Z

    The origin of self inductance in a current loop?

    Hi Forum I am trying to get a better grasp of the relation between electric field and the magnetic field. The overall question is "What is The origin of selfinductance in a current loop?" Here are my thourghts: A battery is connected to a say circular wire with some resistance. The current...
  4. N

    Physics Of A Loop Using the Program "Tracker"

    Hi guys, currently trying to figure out part of my lab for Physics I. We used the program Tracker to gather information on a metal ball rolling down a metal track and through a loop. The origin was set at the bottom perpendicular to the top of the angled track where x and y = 0. Here is the data...
  5. R

    Determine electrical power generated by changing B-field through a loop

    Homework Statement A circular loop of radius a and resistance R is placed in a changing magnetic field so that the field is perpendicular to the plane of the loop. The magnetic field varies with time as B(t) = B_0 * e^(-t) where B_0 is a constant. Determine the electrical power in the circuit...
  6. Jamie_Pi

    Starting height of marble rolling around a loop the loop

    Homework Statement The marble rolls down a track and around a loop-the-loop of radius R. The marble has mass m and radius r. What minimum height h must the track have for the marble to make it around the loop-the-loop without falling off? (Use any variable or symbol stated above along with the...
  7. astrocytosis

    Magnetic field above the center of a square current loop

    Homework Statement Find the exact magnetic field a distance z above the center of a square loop of side w, carrying a current I. Verify that it reduces to the field of a dipole, with the appropriate dipole moment, when z >> w. Homework Equations (1) dB = μ0I/4πr2 dl × rhat (2) r =...
  8. J

    Continuous-time loop computer for NP problems?

    In NP problems we can cheaply (polynomial time) test if a given input is satisfying, but the difficulty is that there is an exponential number of possible inputs - the question is if e.g. there is a satisfying input. Imagine there is a simple hardware implementation of verifier (e.g. in form of...
  9. M

    Flux induced in a circular loop

    Homework Statement I have a circular loop with a radius of 1 m. The center of the loop is located 2 m away from a infinitely long current carrying wire, with ac current I. Find the flux in the circular loop Homework Equations Φ = ∫ B ds The Attempt at a Solution I've found a lot of examples...
  10. B

    Determine a cable core diameter for RF current carrying loop

    Basic Question Alert ! (I need to brush up my basics and need your help) Problem Statement: I wish to make a current carring cable loop to generate a controlled magnetic field. http://hyperphysics.phy-astr.gsu.edu/hbase/magnetic/curloo.html As I understand, the magnetic field generated depends...
  11. J

    A Is it possible that a particle is much heavier through a loop correction

    Let's assume, we have standard model singlet particle s that mixes after electroweak symmetry breaking with an exotic, vectorlike neutral lepton N The relevant part of the Lagrangian reads $$ L \supset h^c s N + h s N^c + M N N^c, $$ where h is the standard model higgs and M is a superheavy...
  12. HRubss

    Radius of largest possible loop of an Airplane.

    Homework Statement A 2250 kg airplane makes a loop the loop (vertical circle) at a speed of 320 km/hour. Find (a) the radius of the largest circular loop possible and (b) The force on the plane at the bottom of this loop. Homework Equations F = m*a Centripetal Force = m * (v2)/r "Critical...
  13. N

    Calculating Current in a Wire Loop Inside and Outside a Solenoid

    Homework Statement A 2400-turn solenoid is 2.4 m long and 10 cm in diameter. The solenoid current is increasing at 1.4 kA/s . Find the current in a 5.0-cm-diameter wire loop with resistance 9.0 Ω lying inside the solenoid and perpendicular to the solenoid axis. Repeat for a similarly oriented...
  14. Philosophaie

    Current Density and Charge Density in a loop of Wire

    I am trying to formulate the Current Density for a Loop of wire with a diameter,d, current,I, and an cross-sectional Area of the wire ##\pi(d/2)^2##. With spherical coordinates (radial, azimuthal, polar) ##\bar j## = ##\frac{I}{\pi(d/2)^2}*cos \theta *sin \phi \hat x##...
  15. L

    A Integration along a loop in the base space of U(1) bundles

    Let ##P## be a ##U(1)## principal bundle over base space ##M##. In physics there are phenomenons related to a loop integration in ##M##, such as the Berry's phase ##\gamma = \oint_C A ## where ##C(t)## is a loop in ##M##, and ##A## is the gauge potential (pull back of connection one-form of...
  16. T

    Faraday's law -- circular loop with a triangle

    Homework Statement A circular coil with radius a is connected with an equilateral triangle on the inside as shown in the figure below. The resistance for each section of the wire is labeled. A uniform magnetic field B(t) is pointing into the paper, perpendicular to the plane of the coil. B(t)...
  17. Urs Schreiber

    A Highest loop order of experimental relevance?

    What is the highest loop order in standard model scattering computations that still contributes a measurable effect seen in past and present particle collider experiments? In other words, to which order are loop corrections necessary for accounting for observed high energy physics? I expect it...
  18. R

    Kalman filter unstable in closed loop application

    I have implemented the closed-loop motor control system as above in a Matlab simulation (pic Kalman.png). Here, the Kalman filter estimates the torque disturbance and angular speed of the motor and those are feed to the RLS algorithm for parameter identification, here it estimates the combined...
  19. P

    Voltage due to relative motion of a charge and conductive loop

    Consider an electric charge Q with rest frame R and a closed conductive loop L with rest frame R'. Q is moving relative to L, and vice versa. In R, the loop is moving and receives no magnetic flux from Q thus no voltage according the integral form of Faraday's law. In R', the loop receives...
  20. Pushoam

    EMF in bigger loops kept on both sides of a small loop

    Homework Statement Modification: Take two big loops kept on both sides of the small loop at a distance a from the corresponding end of the small loop. Homework EquationsThe Attempt at a Solution The flux through the bigger loop is equal to the flux through the smaller loop, provided that the...
  21. Pushoam

    EMF across a loop with one end in a parallel plate capacitor

    Homework Statement Homework EquationsThe Attempt at a Solution Assuming the current is steady, I = JA, where J is the current density and A is the cross- sectional area ##E = J/\sigma## Can I take ##\sigma ## uniform here ?
  22. S

    What EMF is induced in the loop at t=0?

    Homework Statement A current of 10A is switched off at time t = 0 in a long cable (picture in attachments). It powers a device, with the current return wire having 5 mm separation. A wire loop of dimension 5 by 5 cm is located at a distance 3 cm from the cable. 1) What Emf is induced in the...
  23. K

    I Implications of validating loop quantum cosmology

    suppose, for example, Pre-inflationary universe in loop quantum cosmology Tao Zhu, Anzhong Wang, Gerald Cleaver, Klaus Kirsten, Qin Sheng (Submitted on 22 May 2017 (v1), last revised 4 Jun 2017 (this version, v2)) The evolutions of the flat FLRW universe and its linear perturbations are studied...
  24. L

    Can a 2500 Gallon Water Tank Sufficiently Cool a Condenser Without a Chiller?

    Hello! Hopefully someone here can help with this problem: I have a condenser that holds 35 gallons of water to cool the copper coil on my still. I need to know if I can create a closed loop system of cooling water that allows me to avoid running a chiller. I know that there is probably an...
  25. J

    Jet fighter flying in a vertical loop

    Homework Statement A jet fighter flies in a vertical circle of diameter 1000 m. The speed of the aeroplane at the bottom of this circle is 185 m s-1. For the aeroplane at this point, calculate: Apparent weight Homework Equations Fc = mv^2/r Ac = v^2/r Fn = Fg + Fc The Attempt at a Solution...
  26. J6204

    What is the correct magnetic force on the rectangular loop in this figure?

    Homework Statement A rectangular loop of wire, L = 28.8 cm and W = 15.2 cm, carries a I1 = 2.02 A current and lies in a plane (d = 11.0 cm), which also contains a very long straight wire carrying a I2 = 12.7 A current as shown in the figure below. Homework Equations F=uo*i1*i2*l/perpindicular...
  27. A

    Minimum h for Car to Remain on Track Around Loop

    Homework Statement A car of mass m is initially stationary on a smooth track at distance h above the ground. What would be the minimum value of h required in order for the car to remain on the track throughout its journey around the loop of radius r? Homework Equations KE(bottom)>PE (top)...
  28. peroAlex

    Induced Voltage of Rotating Circular Loop

    HI! I'm a student, this question appeared in one of the old tests. I though I had it solved but apparently I must have missed somewhere. Could someone please at least hint me where I went wrong? Homework Statement Thin wire is wound into circular frame with radius ## r = 0.05m ## which...
  29. K

    I M-theory and loop quantization of higher dimensional SUGRA

    A new duality between Topological M-theory and Loop Quantum Gravity Andrea Addazi, Antonino Marciano (Submitted on 17 Jul 2017) Inspired by the long wave-length limit of topological M-theory, which re-constructs the theory of 3+1D gravity in the self-dual variables' formulation, we conjecture...
  30. J

    I How to calculate the area under a curve

    I was doing some integral exercises for getting area under the function. I was doing only more simple stuff, like functions that don't go over the same "x area" multiple times, like a quadratic function. My question is how to calculate area of a loop in an equation x^3+y^3-3axy=0 if let's say...
  31. O

    Why isn't my for loop triggering?

    Homework Statement First of all, this ISN'T homework. This is independent study. I am in a CS program, but I am going through PPP by Bjarne Stroustrup to keep the language fresh. I'm working on one of the last assignment in chapter 4 which is this: Write a program where you first enter a set...
  32. chopnhack

    KVL/KCL with two sources - can a loop have both sources?

    Homework Statement In the circuit shown, find (a) the current in each resistors (b)The power dissipated in each resistor. Homework Equations V=IR, P=VI, KVL and KCL The Attempt at a Solution See attached. I was going to post this in the main section as its really a question about whether you...
  33. R

    Vibrating a loop with current - will it radiate?

    Hi, I am new here so hopefully this is the right place to ask a question like this. Forgive me if I have trampled a rule. If I have, please let me know what I should do to ask this question. If you take a wire with a flowing DC current and vibrate it, can it radiate as a radio transmission...
  34. T

    Torque on current carrying loop/Diploe moment of loop

    Homework Statement The current loop of the radius b as shown in figure is mounted rigidly on the axle,midway between the two supporting cords.In the absence of the external magnetic field,the tension in the two cords are equal and are T.What will be the tension when a vertical magnetic field B...
  35. T

    How Does Magnet Position Affect EMF in a Coiled Wire System?

    Homework Statement A bar magnet is attached to the end of a non-magnetic spring, with spring constant 484−1, as shown in the diagram. The other end of the spring is attached to a fixed force sensor which was zeroed when the magnet was at its equilibrium position, before being zeroed, the force...
  36. JaredC

    Calculating Pump Rate for Open Loop Cooling System: Basic Model

    Homework Statement I am trying to find out the rate at which I need to pump water into a device generating a specific amount of heat to keep it at a low temperature. I have not taken thermodynamics yet, and so I am trying to use a very basic model. The water is pumped through a copper pipe. I...
  37. C

    I Correct Feynman rules for one loop diagram?

    Consider the diagram attached for the process quark + quark -> photon + quark + quark. I want to check I have the correct expression for the amplitude for this process by using the Feynman rules. ##i,j,m,n,l,p## are colour indices. ##k## is the loop momentum. I don't care about overall factors...
  38. C

    Critical Velocity in a roller coaster cart

    1. The problem statement, all variables, and given/known data I was just wondering if a roller coaster can still pass through a loop with less than critical velocity/energy (Also if I'm assuming critical energy correctly). The loop can be of any size yet it must not exceed 5.7g at the entry...
  39. B

    Magnetic Dipole Field from a Loop of Wire

    I am trying to understand the magnetic dipole field via loop of wire. The above pictures show how this problem is typically setup and how the field lines are typically shown. The math is messy but every textbook yields the following: β = ∇xA = (m / (4⋅π⋅R3)) ⋅ (2⋅cos(θ) r + sin(θ) θ) The...
  40. PhysicsCollegeGirl

    Conservation of Energy -- Object around a loop

    Hello! I am having problems with this exercise if someone can please help me. Homework Statement In order to go all the way around a frictionless circular loop of R=2.5 m , how fast must a mass be moving as it exits at the bottom of the loop. 2. The attempt at a solution I am doing this...
  41. Saracen Rue

    Forces on a Car in a Vertical Loop

    Homework Statement Homework Equations ##E_{\operatorname{total}}=E_{kin}+E_g## ##F_{net}=F_N+F_g## ##a=\frac{v^2}{r}## The Attempt at a Solution I've already technically completed question 4 part c, getting an answer of 8168 N downwards (which is what the answers say). However, this is...
  42. patrykh18

    B Understanding the Physics of a Loop de Loop on a Level Track

    Imagine you have a level track with a loop de loop on it. The loop de loop is shaped like a perfect circle. You are inside the cart and approaching the loop de loop. I know that gravity and the normal force both act to produce the centripetal force. However at the very bottom of the track the...
  43. StudentOfScience

    Displacement Function of an Idealized Circular Loop Coaster

    Homework Statement Suppose we have a roller coaster cart of mass m, which may be approximated as a point mass for our purposes. Ignoring friction and air-drag, what is the displacement of the cart as a function of time? It enters the loop with an initial velocity $$ v_0 \hat i $$ and the radius...
  44. dykuma

    I Can Warping Spacetime Create a "Warp Bubble" in GR?

    First of all, I would like to admit that my understanding of general relativity is limited, though this will hopefully be remedied this summer when I take a GR class. I think we have all seen a sci-fi movie where the characters are stuck in a space where they are trapped in a sort of "warp...
  45. whatphysics

    Finding closed loop gain and Ip and In current in op amp

    Homework Statement Finding closed loop gain and Ip and In current in op amp Homework Equations - The Attempt at a Solution I started by trying getting voltage divider for points between R1 and R2 as (R2/(R2+R1))Vs and between R4 and R5 similarly. And I'm not sure how to continue on. Any help...
  46. A

    Why is this loop pushed downwards by the magnetic field?

    Homework Statement 2. Homework Equations FB = ∫I ds×B The Attempt at a Solution My first guess was that it would not move at all. I understand that there is an induced magnetic field in the opposite direction but wouldn't the induced field produce a current counterclockwise, which, since...
  47. D

    Magnetic flux through a rectangular loop inside a wire

    Homework Statement Homework Equations Magnetic flux = integral(B dot dA) line integral(B dot ds) = (u_o)(i_enc) (Ampere's Law) The Attempt at a Solution I can't see how Ampere's law applies because all of the magnetic field vectors along the loop will be perpendicular to that stretch of...
  48. stephen8686

    B VIR Chart for Circuit Analysis: A Quicker & Intuitive Alternative to Loop Rule

    Hello guys, I'm reviewing for the AP physics C exam and in one of my review books I came across this trick called a VIR chart for circuit analysis. It's a sort of weird alternative to the usual Loop Rule. If you haven't heard of it before here it is...
  49. M

    Why can I print C-Strings without a Loop?

    Hey all, I have a question regarding C-Strings. Say I have the following function #include <iostream> using namespace std; int main() { const int SIZE = 5; char cstr1[SIZE] = "Hi"; cout << cstr1; return 0; } This will actually print out the string literal. I'm confused because...
  50. P

    Mathematica How to Use If Statements Inside a Do Loop with Complex Numbers?

    I have a Do loop running which, for some values will become complex, and I want to make it so for these situations, we take the negative root and for others the positive root. In this scenario, I've simplified what I actually have and chose to look at the case where I need it to take the...
Back
Top