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. Toughnuke

    Electromotive force (EMF) of a circular loop wire

    Hi, so, I got help from this homework problem by posting it on chegg, but I want clarification. A circular loop of wire of radius 12.0 cm is placed in a magnetic field directed perpendicular to the plane of the loop and into the page. The field is decreasing at a constant rate of 0.050 T per...
  2. E

    The magnetic field induced by a current loop

    A square loop of wire in the x-y plane, centred on the origin, is made up of four straight segments, each of length 2d=10cm. A current I =10A flows in the wire in the direction shown. Find the magnetic field at z=d on the z-axis. (See "Diagram" for the diagram of the problem) Here is the...
  3. TheSodesa

    Mutual inductance of a long wire and a triangular loop?

    I originally posted this to the advanced homework -section, but maybe this isn't advanced enough to warrant being posted there :oops:. If a mod sees this, feel free to delete the original on the other forum. I'd do it myself, but I can't. 1. Homework Statement Calculate the mutual inductance for...
  4. I

    What is the Magnetic Force on the Loop in this Rigid Contour System?

    Homework Statement Rigid contour of an isosceles triangle and a long line cable lie in a plane and are located in vacuum . Determine the intensity of the magnetic force F acting on the loop. Current I = 100 A. free upload image Correct answer: F = 386 mN. I am getting 2 mN. Notice that I...
  5. B

    Gas and liquid flow rates in Gas-liquid flow loop

    Homework Statement I'm working on my research project at uni, running a gas-liquid flow loop for horizontal stratified flow exhibiting wave propagation. The equipment I have however is setup to investigate vertical flow primarily and the flow meters are located on the vertical sections. I need...
  6. M

    Help with magnetic induction and finding induced current

    Homework Statement I have attached a picture that details the problem. This is my practice test and I have no clue what I am doing wrong. Essentially a loop of wire is moving in constant velocity into a magnetic field. The magnetic field lines are pointing into the page. The problem is...
  7. R

    Finding currents using the junction and loop rules

    Homework Statement Homework Equations i1+i2-i3=0 50i1+75i3=1 100i2-75i3=1 The Attempt at a Solution matrix A=1 1 -1 0 100 -75[/B] 50 0 75 matrix B= 0 1 1 i1= -6ma i2= 23ma i3= 17ma My instructor gets i1= 6ma...
  8. A

    Open loop transfer function help

    Homework Statement [/B] I need to work out the open loop transfer function of the above. I've drawn it on word so it's not great; the + and - represent a summing junction. Homework Equations Everywhere I read, I find a different definition of open loop transfer function. I see G*H is an oft...
  9. J

    More Magnetic Fields -- 2 fields through a loop decreasing with time....

    This is a continuation of a previous thread in which I was informed my TA was mistaken on an aspect of magnetism. This thread is just to verify another problem within the homework is correct. Other threads will be posted to continue. 1. Homework Statement A) What is the magnetic flux...
  10. H

    Calculate the EMF induced in the square?

    Homework Statement A square of wire with side length 1.4 m rotates about an axis through one corner that is perpendicular to the plane of the square with an angular speed of 3 rev/s. There is a uniform magnetic field of 1.2 T perpendicular to the square. Calculate the EMF induced in the...
  11. A. Neumaier

    A Loop quantum gravity and diffeomorphism group

    How is loop quantum gravity related to the principle of relativity, in particular to the diffeomorphism invariance of general relativity?
  12. O

    MHB Trouble Printing Out Array Elements with a For Loop

    I am having problems with printing out each elements of the array using a for loop It's suppose to look like this: Enter non-negative numbers (ints) terminated by -99 1 2 3 4 5 6 -99 Original list (6 values): 1, 2, 3, 4, 5, 6. the code's output looks like: Enter non-negative numbers (ints)...
  13. Elvis 123456789

    Magnetic Field at the center of a square loop

    Homework Statement A square wire loop 12.0 cm on each side carries a clockwise current of 15.0 A Find the magnitude of the magnetic field at its center due to the four 1.30 −mm wire segments at the midpoint of each side. Homework Equations B = (μ0*I)/(4π)*(2a)/(x√(x^2+a^2)) The Attempt at a...
  14. Elvis 123456789

    Magnetic Field at center of a Square loop

    Homework Statement A square wire loop 12.0 cm on each side carries a clockwise current of 15.0 A Find the magnitude of the magnetic field at its center due to the four 1.30 −mm wire segments at the midpoint of each side. Homework Equations B = (μ0*I)/(4π)*(2a)/(x√(x^2+a^2)) The Attempt at a...
  15. B

    Rotational Energy, ball on a loop

    Homework Statement Imagine a ball with moment of inertia I_{cm} = \beta MR^2 encountering a circular loop of radius R_0 > R after rolling on a level surface at a speed of v_0. Assume that the ball does not slip. Attached a diagram. A) What is the minimum value of v_0 required for the ball...
  16. JesseJC

    3 loop circuit, 5 resistors, 2 batteries

    Homework Statement Full problem statement and diagram is attached. Homework Equations Kirchhoff's rules, ohm's law The Attempt at a Solution So I presume that what I'll be looking at here is the use of Kirchhoff's Rules and Ohm's Law. I do not know how to approach this as I have never come...
  17. B

    I Exploring the Popularity of Loop Quantum Gravity in Current Physics Research

    is Loop Quantum Gravity as popular as String Theory in current physics research?
  18. E

    Solve Homework 2: Electromotive Force in a Shrinking Loop

    Homework Statement A little stuck on the second question it basically boils down to not quite understanding the question. Was hoping someone here could push me in the right direction. The Question is two part, already completed the first half but wouldn't mind if someone looked over it while...
  19. C

    Computation of non scalar loop integrals

    Consider the following integral that comes out of a loop calculation along with some fermionic propagators (e.g virtual one loop correction to a ##p \gamma^* \rightarrow p'## process such as in DIS): $$ \int \frac{\text{d}^d l}{l^2 (l-p)^2 (p+q-l)^2} \text{Tr}(\not p \gamma^{\nu} (\not p + \not...
  20. F

    Electric current passing through closed loop

    Homework Statement (sorry for possible notation errors, that might arise during the translation) Why an electric current passing through a closed loop, can be defined only in stationary conditions? Homework Equations The Attempt at a Solution I think that the reason is that, if the...
  21. A

    Engineering Solve 2 Loop RC Circuit: Find Q(topen)

    1. Situation and Variables: A circuit is constructed with four resistors, one capacitor, one battery and a switch as shown. The values for the resistors are: R1 = R2 = 30 Ω, R3 = 66 Ω and R4 = 113 Ω. The capacitance is C = 64 μF and the battery voltage is V = 12 V. The positive terminal of the...
  22. N

    C/C++ C++: Using a for loop to print a countdown

    Write code that prints: userNum ... 2 1 Blastoff! Your code should contain a for loop. Print a newline after each number and after Blastoff!. Ex: userNum = 3 outputs: 3 2 1 Blastoff! #include <iostream> using namespace std; int main() { int userNum = 0; int i = 0; userNum = 3; i =...
  23. N

    MHB Using a while loop to print the counting numbers up to a set value

    Write a while loop that prints 1 to userNum, using the variable i. Follow each number (even the last one) by a space. Assume userNum is positive. Ex: userNum = 4 prints: 1 2 3 4 #include <iostream> using namespace std; int main() { int userNum = 0; int i = 0; userNum = 4; //...
  24. Tone L

    MATLAB Solving MATLAB Sum Loop Issue with 2,187 Data Points

    So i want to calculate an r value 5 different times then find the mean of the 5 calculated values. I have 2,187 data points. the first line of code generates 100 random points 1-2187. The code has a bug but my major issue is it calculates r then loops again calculates r, loops again calculates...
  25. K

    MHB Completing DoublePennies(): Solving the Infinite Loop

    Write code to complete DoublePennies()'s base case. Sample output for below program: Number of pennies after 10 days: 1024 The if statement is what I am trying to complete, however this places it in an infinite loop #include <stdio.h> // Returns number of pennies if pennies are doubled...
  26. N

    Kirchoff's Loop Rule Involving 2 Resistors and a Capacitor

    A 5μF capacitor is connected in parallel with a 2MΩ resistor and the combination is then connected in series with a 1MΩ resistor through a switch to a 12V battery. Find the time taken for the voltage across the capacitor to rise from zero initial value to 2V after the switch is closed.From what...
  27. endiewibowo

    I What is Returning Loop of Rogowski Coil?

    I read on a source from a paper from John D. Ramboz that explains: The incremental pitch-advancement of the coil's helical winding sums over its circumferential length to create an undesirable one-turn loop normal to the axis of the coil (the plane of this loop is parallel to the surface of the...
  28. Justice Hunter

    Exploring the Science of Feedback Loops in Social Media and Beyond

    So I'm trying to exploit the idea of audio feedback and applying it to different Sciences, The one I had in particular in mind is social media. But before I go hammering away at how to exploit it, I need a better understanding of how feedback actually works I believe that the way feedback in...
  29. UchihaClan13

    How can symmetry be applied in analyzing electric circuits?

    Okay guys So I was studying up some electric current and doing electric current problems I am clear with kirchhoffs rules And with series-parallel resistor combinations But I am not quite clear with the symmetric distribution of current Or symmetry in circuits, in particular Could you guys...
  30. komarxian

    Rollercoasters and Loops and Normal Forces

    Homework Statement <I will attach a diagram below> In terms of m, g and r. FInd the normal force at the top of the loop. Homework Equations ∑F = Fc = FN+Fg ∴ Fc=FN+Fg ∴FN = Fc - Fg ∴ N=mV2/r - mg The Attempt at a Solution Fc=mV2/r - mg and V2=ra and a=g ∴C=mrg/r ∴C = mg ∴mg-mg=N ∴ N=0 N. BUT...
  31. H

    Exploring Loop Variables: Understanding the Role of Photons in Closed Flux Loops

    Loop variables: A line of force or flux that is closed to form a loop. Can a Photon be a line of force or flux that closes to form a loop?
  32. DuckAmuck

    Why Do Electron, Muon, and Tau Masses Differ in Scale and Correction Effects?

    This is a 3 part question. 1. I've come to understand that the mass values in the mass terms (pole mass) of the standard model don't represent what we actually measure. That there are loop corrections. (I understand the concept: there's screening either adding or subtracting from the true...
  33. K

    SAT II Physics -- Induced current in loop (Faraday's law)

    Homework Statement A loop of wire and a bar magnet are moving relative to one another. Which motion in the diagrams shown below will NOT induce a current in the loop? Homework Equations Lenz's Law: A changing magnetic field can induce a current in a direction that produces its own...
  34. NihalRi

    Circular motion , the loop the loop

    Homework Statement The loop-the-loop machine has radius R of 18m (a) What is the minimum speed at which a cart must travel so that it will safety loop the loop (b) what will the speed at the top be in this case Homework Equations Centipetal force = m*v^2/r Kinetic and potential energies =...
  35. A

    What is the self inductance of a circular loop of wire?

    If current I passes through a circular loop of radius R,then what will be the self inductance of that loop? (calculating flux through the loop leads to calculating magnetic field at every point inside the loop which is an elliptic integral.)
  36. Safinaz

    Loop correction for quartic Higgs coupling

    Hi all, Has anyone an idea about the loop correction for quartic Higss coupling? In [arXiv:1507.03618v2 [hep-ph]], equ. (13) it's pointed out that the perturbativity constrains on the quartic couplings in the Higgs potential is ## \lambda^2 < 16 \pi^2 ## Which means that loop factor is ##...
  37. K

    Loop quantum cosmology vs string cosmology

    which of the two is better supported by observational evidence and is more researched?
  38. David Gin

    Determing flow of a closed loop parallel pumping system

    Hi all, How would one go about determining the flow(GPM) of a closed loop parallel piping system. I believe this has to do with the pressure intake and outlet of the pump as I have a pump in the mentioned system rated at 4350GPM@50Hz but it is pumping at 4500 GPM at 37Hz, Thank you all for...
  39. Safinaz

    Effective operator and allowed loop level interactions

    Hi all, Some processes can not happen at the tree level, but it happen via loops, like for Higgs decay to pair of glouns or pair of photons, (h -> gg), (h -> y y) . For instance, effectively h -> gg written as ##~ h~ G^a_{\mu\nu} G_a^{\mu\nu}~ ## which is Lorentz and gauge invariant .. Now if...
  40. kostoglotov

    Energy dissipated by a loop of muscle in an MRI machine

    edit: turned out to be a calculator typo...mods feel free to delete this thread if you wish, I won't complain. Homework Statement [/B] Having issues with part a) imgur link: http://i.imgur.com/4hzLyhb.jpg Homework Equations Resistivity of muscle (from table in text): \rho \approx 13...
  41. Gbox

    Why the current in a loop is the same

    If for example we have in a loop a DC and 2 resistors connected in series, the current in each resistor is different ##I=\frac{V}{R_i}## but we say that the current is ##I=\frac{V}{R_1+R_2}##? That means we are looking at the average current in a loop?
  42. K

    Does Loop quantum gravity have an effective UV fixed point?

    loop quantum gravity and loop quantum cosmology gravity becomes weaker then repulsive instead of stronger, towards the Planck regime, due to the onset of quantum effects. gravity near Planck energies and densities, LQG/LQC becomes repulsive. at the inflection point where LQG gravity strength...
  43. Q

    Induced Current in Square Loop

    Homework Statement A 21cm×21cm square loop has a resistance of 0.12 Ω . A magnetic field perpendicular to the loop is B=4t−2t^2, where B is in tesla and t is in seconds. (A) What is the current in the loop at t=0.0s? (B) What is the current in the loop at t=1.0s? Homework Equations for a...
  44. S

    Ampere's law with current loop

    Is it possible to find the magnetic field on the axis above a current loop using Ampere's law? I was thinking you could treat an infinitesimal piece of the loop as a straight wire and draw a circle around it with radius sqrt(a^2 + z^2), with a=radius of current loop and z=position of point of...
  45. L

    What is the current in the loop

    Homework Statement A piece of wire slides, without friction, along two similar wires. The resistance per unit length of all wires is 0.350 ohms/m, and a constant magnetic field, B= 1.90T, points up, perpendicular to the loop. The distance between the parallel, fixed wires is 10.0cm. At the...
  46. K

    Recent papers on self-dual loop quantum black holes

    self-dual loop quantum gravity results when the immirizi parameter y=i has been the subject of many recent research papers here is a partial listGravitational axial perturbations and quasinormal modes of loop quantum black holes M.B. Cruz, C.A.S. Silva, F.A. Brito (Submitted on 26 Nov 2015)...
  47. S

    How to Find Magnetic Field Components of a Circular Loop?

    Homework Statement A circular loop of radius R is on the xy plane and the center is at the origin, the current is flowing in a counter-clockwise manner. a) Let Q=(a,0,a) be a point such that a>>R. Find Br and Bθ at Q. b) Let Q=(ha,0,0) be a point on the x-axis such that h<1. Find the vector...
  48. K

    Towards self dual Loop Quantum Gravity Jibril Ben Achour

    interesting new paper on possible new research direction for LQG http://arxiv.org/abs/1511.07332 Towards self dual Loop Quantum Gravity Jibril Ben Achour (Submitted on 23 Nov 2015) In this PhD thesis, we introduced a new strategy to investigate the kinematical and physical predictions of self...
  49. H

    Vacuum diagrams vs. tree diagrams vs. loop diagrams

    Could someone please tell me the difference between tree diagrams and loop diagrams? If I'm thinking correctly tree diagrams are before contracting? Also how do vacuum diagrams fit into the picture? Thanks!
  50. J

    Can We Create an Endless Loop of Energy with Water?

    I have got a question. If we do electrolysis with waterand get : H2 + 02 , and then we make hydrogen explode and make a piston move , for example. Then it would be H2O again? So we could do this forever and get as much energy as we want? That would be super awesome but i am not sure.
Back
Top