What is Loop: Definition and 1000 Discussions

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. 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...
  2. 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...
  3. 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...
  4. 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...
  5. 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 =...
  6. 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...
  7. 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...
  8. 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...
  9. 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...
  10. 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...
  11. 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...
  12. 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##...
  13. 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...
  14. 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)...
  15. 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...
  16. 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...
  17. 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...
  18. 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...
  19. 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 ?
  20. 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...
  21. 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...
  22. 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...
  23. 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...
  24. 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...
  25. 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)...
  26. 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...
  27. 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...
  28. 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...
  29. 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...
  30. 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...
  31. 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...
  32. 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...
  33. 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...
  34. 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...
  35. 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...
  36. 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...
  37. 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...
  38. 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...
  39. 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...
  40. 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...
  41. 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...
  42. 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...
  43. 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...
  44. 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...
  45. 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...
  46. 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...
  47. 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...
  48. 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...
  49. S

    Magnetic flux through a loop at two orientations

    Homework Statement A circular loop of radius 0.10 m is rotating in a uniform external magnetic field of 0.20 T. Find the magnetic flux through the loop due to the external field when the plane of the loop and the magnetic field vector are (a) parallel. (b) perpendicular.Homework Equations...
  50. R

    Magnetic force on triangular loop of wire

    Homework Statement Find the force on the triangular loop in the figure: I am trying to do this in cylindrical polar coordinates, because it builds character. Homework Equations $$\vec{B}(\vec{r}) = \frac{\mu _0}{4\pi} \int \frac{I(d\vec{l} \times \hat{\alpha})}{|\vec{\alpha}|^2}$$ Where alpha...
Back
Top