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. 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...
  2. 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...
  3. S

    How Do You Calculate the Magnetic Moment and Torque of a Rectangular Loop?

    Homework Statement A 15-turn rectangular loop of wire of width 10 cm and length 20 cm has a current of 2.5 A flowing through it. Two sides of the loop are oriented parallel to a uniform magnetic field of strength 0.037 T, and the other two sides are perpendicular to the magnetic field. (a) What...
  4. cheapstrike

    Tension in a flexible circular loop

    Homework Statement A small circular flexible loop of wire of radius R carries a current I. It is placed in a uniform magnetic field B. The tension in the loop will be double if A) I is doubled B) B is halved C) r is doubled D) both B and I are doubled. Homework Equations The Attempt at a...
  5. O

    Understanding the PLL Block Diagram & Stable Point of Operation

    I have some trouble fully understanding the PLL block diagram shown below in the figure. The PLL circuit is used to generate currents (i alpha and i beta) which are in phase with the positive fundamental sequence of the voltage. I am using the book "Instantaneous Power Theory and Applications...
  6. jlmccart03

    Find loop radius and current via magnetic field?

    Homework Statement A single-turn wire loop produces a magnetic field of 41.2 μT at its center, and 5.15 nT on its axis, at 20.0 cm from the loop center. Find loop raidus and current. Homework Equations F = qv x BThe Attempt at a Solution I tried to use the above equation, but could not figure...
  7. M

    Loop Antennas vs. B-Probes: Similarities and Differences

    Hi the difference between a loop antenna and a magnetic probe (B-Probe) is only that the loop antenna works in far field and B-Probe works in near field? The standard features of magnetic antenna (antenna factor, impedance matching, radiation patterns, efficiency, ecc) have the same definition...
  8. J

    ControlSystems - Easy way to simplify Closed Loop Equation?

    Homework Statement ##G_{OL} = \frac{5}{s}## ##G_{CL} = \frac{KG_{OL}}{1+KG_{OL}}## Homework EquationsThe Attempt at a Solution It's pretty easy when the equation is so simple ##G_{CL} = \frac{K\frac{5}{s}}{1+K\frac{5}{s}}## ##G_{CL} = \frac{5K}{s+5K}## If the open loop equation is really...
  9. ikihi

    10 cm diameter loop in magnetic field

    Homework Statement The figure shows a 10-cm diameter loop in three different magnetic fields. The loop's resistance is 0.10 Ω. For each case, determine the induced emf, the induced current, and the direction of the current. Homework Equations Faraday's Law: εinduced= - (ΔΦb/Δt) = - A ⋅ ΔB...
  10. B

    Question about Magnetic induction of circular loop

    Homework Statement Homework EquationsThe Attempt at a Solution This is what i did about (a) but i don't know how to approach (b), it doesn't have x,y components, only Bz component.
  11. D

    Engineering Finding the Total Force on the Circuit Loop

    Homework Statement The problem asks to find the Total Force on the Circuit Loop. I have a circuit loop with length 30.0 cm and width 10.0 cm with a current I2= 30.0 A that is flowing counter-clockwise. There is a wire that has the current I1=15.0 A flowing from left to right and is 7.50 cm from...
  12. X

    Why does induction in a loop depend on the contained flux?

    Hiya, I'm struggling to find/figure out some kind of intuitive explanation why it is the changing flux of the contained area that matters for Faraday's law of induction. It appears odd to me that it is the change of flux through the contained area that matters, rather than the flux that goes...
  13. Anatalbo

    Normal forces for small car performing a vertical loop

    Homework Statement A small car with mass .800 kg travels at a constant speed of 12m/s on the inside of a track that is a vertical circle with radius 5.0m. If the normal force exerted by the track on the car when it is at the top of the track is 6.00N, what is the normal force at the bottom of...
  14. qnach

    Small Loop Antenna: Understanding Its Design as a Dipole or Monopole

    Is a small-loop antenna a dipole or a monopole? Is a (small) 8-shape antenna a dipole or a monopole? Is a 8-shape antenna a dipole antenna?
  15. I

    Magnetic Flux Through a Square Loop

    Homework Statement A loop of wire in the form of a square 1.50 m on each side, its plane makes an angle of 40.0° with a uniform magnetic field of 0.95 T. What is the magnetic flux through the loop? Homework Equations Φ = BAcosθ A = s^2 The Attempt at a Solution I found the area of the square...
  16. D

    Calculating load factor for airplane

    Hello! When calculating the load factor in a loop the formula is n=V^2/(g*R)+cos(teta) during pull-up of a loop and another formula is n=1/cos(phi) during a level-flight banked turn. How does one combine these to calculate the load factor during a twisted loop?
  17. M

    How to Calculate the X-Component of the Magnetic Moment in a Rectangular Loop?

    Homework Statement A rectangular loop of wire with sides H = 22 cm and W = 77 cm is located in a region containing a constant magnetic field B = 0.82 T that is aligned with the positive y-axis as shown. The loop carries current I = 334 mA. The plane of the loop is inclined at an angle θ = 30°...
  18. Cocoleia

    Electric field above a charged square loop

    Homework Statement Homework EquationsThe Attempt at a Solution I have the complete solutions for this problem, I just don't understand them: This is the first part. I don't understand what r' is, or how we found it. Otherwise I understand the concept of the problem just not the details...
  19. Jared C

    Toy car executing a vertical loop

    Homework Statement A small toy car slides down an elaborate track. At one point during this trip, the car will go around a vertical loop with radius 15cm as shown. What is the minimum speed the car must have at the bottom of the loop in order to make it all the way around the loop without...
  20. J

    Calculating Capacitance in Closed Loop Circuits

    Homework Statement Homework Equations C=Δq/VThe Attempt at a Solution So part a: The capacitance of 3 should be the difference in charge of b and a divided by the voltage of the circuit? C3=(14μC-6μC)/12V =6.67*10-7 F This was wrong...
  21. Adriano25

    How Do You Calculate Terminal Voltage and Potential Difference in a Circuit?

    Homework Statement I = 0.47 A ε1 = 16.0 V ε2 = 8.0 V R1 = 5.0 Ω R2 = 9.0 Ω r1 = 1.6 Ω r2 = 1.4 Ω a) Find the terminal voltage Vab of the 16.0 V Battery b) Find the potential difference Vac of point a with respect to point c Homework Equations Vab = Va - Vb = ε1 - Ir1 Vac = Va - Vc = IR1 + ε2...
  22. S

    A Feynman rule for closed fermion loop in QED

    One of the Feynman rules of QED is the following: For a closed fermionic loop, the Feynman rule is to start at an arbitrary vertex or propagator, follow the line until we get back to the starting point, multiply all the vertices and the propagators in the order of the line, then take the trace...
  23. whatphysics

    Finding closed loop gain in ideal op amp

    Hello there, this isn't necessarily a homework question. I came across this qn during revision and didn't know how to solve it. Any help would be greatyly appreciated. The answer is 0.97 1. Homework Statement For the ideal OP-Amp in negative feedback configuration shown in Figure Q30...
  24. M

    What is the potential at the top of R2 in this circuit?

    Homework Statement A circuit is constructed with four resistors, one capacitor, one battery and a switch as shown. The values for the resistors are: R1 = R2 = 41 Ω, R3 = 68 Ω and R4 = 154 Ω. The capacitance is C = 49 μF and the battery voltage is V = 12 V. The positive terminal of the battery...
  25. L

    MHB Solving 'Simon Says': Debugging a For Loop Problem

    I have tried a bunch of different ways to edit this problem. The user input is 4 and I keep getting a output of 8 or 0. I appreciate the help! The problem is: "Simon Says" is a memory game where "Simon" outputs a sequence of 10 characters (R, G, B, Y) and the user must repeat the sequence...
  26. P

    B How can a glider or an airplane do a loop without thrust

    I have to admit I am not good on physics but I am willing to try to understand how is possible for a plane or a glide that's falling without thrust applied downward to make a loop (by changing direction or using the elevators on the tail of plane, like in this picture. I am try to write a...
  27. R

    Understanding Recycle Loop Systems: Purpose & Uses

    I have a recycle loop system: Please could someone give me a place to understand the theory behind it? What would be its purpose? Where would it be used? I've googled recycle loop systems but I can't find anything relevant, is it the same as a pressurized water reactor...
  28. T

    Fortran Why Won't My Fortran 90 Loop Output to a File?

    Hi, guys I am very new to programming in fortran90 and I am just experimenting with stuff. I have been trying to get my output of my loop program to a text file. But for some reason it will not work. Could someone please advise. Code displayed below: PROGRAM loop IMPLICIT NONE integer ...
  29. mamadou

    What Is the Minimum Height for a Ball to Complete a Loop in Physics?

    Homework Statement An empty ball , of mass m moment of inertia I = (2m.r²)/3, is rolling across the path shown below : there is friction fr from A to C . r is the radius of the ball , and R is the radius of the circular part within the path . what would be the minimal height h , so...
  30. FallenApple

    Python How to reset counter to 0 inside loop

    Here is the code. I have binary list of ones and zeros and I want to see the values of the consequtive ones. For example, 111=3 and 11=2 So I created a count loop and increment the count when A is not 0. Then I tried to update the count to 0 once the for loop got to 0 again, but for some...
  31. C

    Ball Doing a Loop Min Kin Energy: Find Angle θ

    Homework Statement A ball with radius ##r## is inside a hollow cylinder with radius ##r+R##. In the first part of the assignment, one has to calculate the minimum kinetic energy the ball has to have at the bottom in order to complete a full loop in the cylinder. It turns out to be...
  32. A

    Magnetic flux through a triangular loop?

    Homework Statement Determine the mutual inductance between a very long, straight wire and a conducting equilateral triangular loop Homework Equations I know how to do it but I'm stuck at the step of finding the total inductance through the triange. The Attempt at a Solution we know that the...
  33. A

    How Can We Optimize a For Loop to Find Characters Around a Word in a String?

    Homework Statement Given a string and a non-empty word string, return a string made of each char just before and just after every appearance of the word in the string. Ignore cases where there is no char before or after the word, and a char may be included twice if it is between two words...
  34. K

    I Asymptotic safety and loop quantum gravity

    this paper https://arxiv.org/abs/1701.02311 Hypercuboidal renormalization in spin foam quantum gravity Benjamin Bahr, Sebastian Steinhaus (Submitted on 9 Jan 2017) In this article we apply background-independent renormalization group methods to spin foam quantum gravity. It is aimed at...
  35. N

    A Loop Quantum Gravity proven wrong?

    https://arxiv.org/abs/1411.1935 This paper says LQG does not produce the Unruh effect effect, and therefore must be wrong. What do you guys think. You can click into the PDF to see the entire paper.
  36. K. Doc Holiday

    I Been out of the loop -- Progress on Unifying Equation?

    Unifying Equation Albert Einstein searched unsuccessfully for the unifying equation of physics (30 years). Has anyone found it yet? Did I miss the memo? If not, did everyone give up? With all our super computers and millions of scientists on the planet it surprises me someone hasn't figured...
  37. A

    What is the Magnetic Flux through a Loop with Opposite Magnetic Fields?

    Homework Statement Homework Equations Flux = DeltaB * Area The Attempt at a Solution : Since the magnetic fields are going in opposite directions through the loop, I assumed that they would have different signs, so I chose 2.0 T to be positive and 1.0 to be negative, so when calculating the...
  38. H

    Magnetic field in a circular loop

    Homework Statement A conductor consists of a circular loop of radius R and two long, straight sections as shown in the figure. The wire lies in the plane of the page and carries a current I. (a) What is the direction of the magnetic field at the center of the loop? (b) Find an expression for...
  39. D

    Floating Launch Loop: Is It Worth Exploring? - roboticsolutions.tech

    im writing a 2d space simulator and in it i want to simulate rockets as well as things like space elevators and spaceguns to allow players to compare how each system works and compare pros and cons. one idea i want to include in that simulator is my own that i want to promote to the new...
  40. Daniel Abramow

    AP Physics: Designing a Loop to Pull 4 G's

    Homework Statement In my AP Physics class we need to design a loop that pulls around 4 G's. From what I understand, the diameter of the loop must be 2/5 times the initial drop. I cannot seems to get the G forces around 4. Any help? I found that the Clothoid loop reduces G forces but I can't...
  41. D

    Current induced in loop as magnetic monopole passes

    Homework Statement Suppose a magnetic monopole q_m passes through a resistanceless loop of wire with self-inductance L. What current is induced in the loop? Homework Equations \nabla \times \textbf{E} = - \mu_0 \textbf{J}_m - \frac{\partial \textbf{B}}{\partial t} \nabla \cdot \textbf{B} =...
  42. D

    I Exploring PN Junction Loop: Fermi Level and Work Function

    Hi. So we have all seen the band diagram of a PN junction. In order for the fermi level to be the same on both sides, the P bands are shifted up or the N bands are shifted down. Now that the fermi levels are equal, what would happen if you bent the diode into a ring (annulus) shape? How would...
  43. K

    I How do cosmologists view loop quantum cosmology?

    recently this paper Quantum Gravity in the Sky: Interplay between fundamental theory and observations Abhay Ashtekar, Brajesh Gupt (Submitted on 15 Aug 2016 (v1), last revised 12 Nov 2016 (this version, v2)) Observational missions have provided us with a reliable model of the evolution of the...
  44. V

    Flushing Data in Loop? -- Keep Entering Empty Space

    Hello, I am in my first class for C++, so I apologize in advance if this question is amateurish. To be clear, this project is already finished, and what I am trying to do already counted points off against me; I am not interested in cheating, I just want to know what the answer to my issue is...
  45. F

    How does a ground loop and a floating ground work?

    Hello Forum, In DC circuits, I understand that a ground is a point or an entire conductor where the electric potential is set to be V=0 and the potential V at any other point in the circuit is referenced to that. How does the the concept of ground loops work? Why are they not desirable? What...
  46. C

    Solving for 'b': Current in a Loop w/ Bsin(1000t+b)

    Homework Statement steady-state current through the loop will be of the form Bsin(1000t +b). What is the phase angle 'b'? in rads Homework EquationsThe Attempt at a Solution [/B] The answer is meant to be 0.46rads/s. However I am getting 9.65x10^-5?? I have no idea what I did wrong. I...
  47. 1

    Finding the magnetic field of a loop at far distances

    Homework Statement Loop of current ##I## sitting in the xy plane. Current goes in counter clockwise direction as seen from positive z axis. Find: a) the magnetic dipole moment b) the approximate magnetic field at points far from the origin c) show that, for points on the z axis, your answer is...
  48. KSNphysics

    Physics Magnetism - Wire Carrying Current in a Loop

    Homework Statement This is a theoretical question, one I'm not sure about. It just randomly popped into my head. Say there is a jumbled wire, one in a glob shape but not overlapping. (Like a deformed circle, or maybe just a rectangle). Assuming we are in a place called "physics utopia" where...
  49. N

    How to find the maximum induced current for a diamond-shaped loop?

    Homework Statement Find the total maximum induced current for the diamond-shaped metal loop that is moving at a speed of 10 m/s towards a uniform magnetic field of 0.8T. All four lengths equal 10 cm or 0.01 m. Homework Equations emf = -dΦB/dt ΦB=∫B*dA A = (1/2)bh The Attempt at a Solution I...
Back
Top