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.
Hello, I am a high school student trying to learn physics out of Kleppner and Kolenkow. Unfortunately, the solutions to some of the problems are not available online, nor is a solutions manual available, so I am unable to find out where I am wrong in some cases, such as this one. I would...
Hi, I'm working on an idea and i need some guidance
say i have a wire loop of a single wire (not solenoid) the area of the loop is about 1-2 cm^2
now say i change the area of the loop slightly by about 0.1%-0.01%
could i measure with today's electronics this slight change of L
thanks in...
Homework Statement
Let G be a compact connected Lie group define the loop group and the based loop group as LG = \{ \gamma \in C^\infty(S^1,G) \}, \Omega G = \{ \gamma \in LG : \gamma(e_{S^1}) = e_G \} (choose whatever identification of the circle S^1 you like ). Show that \Omega G is a...
I can't generally map Loop Invariant method for proving the correctness of an Algorithm. Take the case of an Insertion Sort
http://csnx.groups.allonline.in/pool/Introduction%20to%20Algorithms-Cormen%20Solution.pdf
in the above link, at the page 2-3, they have proved the correctness of...
Hey guys, I have an ArrayList<String> al = ArrayList<String>(); and I have a textbox, the textbox allows a user to enter a word and that word will be added into the ArrayList.
When I print the list out it looks like this
[Cat, Dog, Mouse] can you please write out the for loop that I need...
Homework Statement
I have a hill with a roller coaster cart on it and it goes down and around a loop-the-loop
the radius of the loop is 10m
Diameter=20m
What is the minimum speed the cart needs to go to keep it on the track?
There is no friction, what is the height of the hill...
3. Consider the motorcyclist riding on the inside of a vertical circle of radius b. His initial speed at the bottom of the circle is u.
a) Explain why the three domains (i) u^2 < 2gb, (ii) 5gb > u^2 > 2gb and (iii) u^2 > 5gb are qualitatively different.
b) Describe what happens in domain...
Hi, I'm writing a program in fortran that basically creates a loop from 1 until a certain number x (input by the user), and goes through each value between 1 and the certain number x in order to determine if each value meets certain criteria. The criteria is that the sum of the square of the...
Homework Statement
Find the potential difference between points a and b.
Picture of Circuit involved.
Homework Equations
V=IR
ΔV=Vb-Va
The Attempt at a Solution
Pretty much completely lost, due to the only one current shown I'm not sure which way the current flows through...
I have asked many times this question to many people and have many different answers:
Let X be a widebody jet airliner like an Airbus or Boeing, larger than a typical business jet. Can X do a vertical loop manoeuvre? If X cannot, what is it that stops X?
changing part of a name of a variable in a "for" loop
hello everyone!
let's say i have the equation between two variables: DT10sec= A*T10sec, working in matlab. How can i use a "for" loop to calculate the equation DT20sec= A*T20sec DT30sec= A*T30sec, DT40sec= A*T40sec,... etc
How can i...
Hi..
Speedo, flying in space, is at large speed compared to c relative to his brother on earth. Therefore, after a long time meeting at rest relative to each other, Speedo aged less than did his brother from his brother perspective. But from Speedo's point of view, his brother was also moving...
Dear all,
I have a list of pairs say Li={{a,x},{b,y},{c,z}...}. I want to eliminate from this list all pairs that have their second part i.e the x, y, z...>1 and I was thing of using an If loop. Can anyone tell me how please...
Thanks...
Hello, I have a few questions regarding machine tool drive and feed back system.
Say I have a 1 meter long guide way and a carriage that is driven by DC motor. This carriage glides on air bearings.
The drive mechanism has pinch rollers that pinch a drive rod and these rollers are driven by...
I will be attempting to make liquid nitrogen from air. Part of the process involves passing air compressed to 200 atm through a coil and rapidly expanding it. The expanded air that does not form liquid from the rapid cooling will pass back over the condensor coils in a counter-current fashion to...
Homework Statement
Question: A ball is launched from a height of 12m. It should land in a pool that has a length of 22m and is 9m away from the wall. Find the minimum and maximum initial velocities for the ball to land in the pool. The ramp is angled at 1 radian such that vy = 0.54v and vx =...
Trying to make a three line loop that would differentiate x2√4x+1 to the nth term starting from the original function (n=0) to the 5th derivative (n=5) and then substitute 2 into the derivatives. Here's what I got
f = @(x) x2√4x+1
For n=[0:5] - As the nth term goes from 0 to 5...
4. Consider a coaxial cable consisting of two infinitely thin conducting cylindrical surfaces
with radii R1 < R2. A current I flows in one direction in the inner cable and in the
opposite direction in the outer cable. Using the Amperian loop technique, determine the
magnetic field
a)inside...
Homework Statement
A Hertzian dipole at origin generates a signal in empty space which is detected at a wire loop with position vector;
r=(50m)ez
Homework Equations
Signal is detected by changing magnetic field;
B(t)=B0 sin(2∏ft)ex
Show it is consistent with the Maxwell's solution to a plane...
Hi,
I'm a non-expert on LQG, and have a question about it:
What is the status of the correspondence principle applied to LQG?
I.e., in which sense can we take the classical (h --> 0) or non-relativistic (c --> oo) limit in order to obtain classical GR or Newtonian gravity out of LQG...
For Loop Circuit -- calculate the nth derivative of the signal
I'm trying to design a circuit that differentiate a signal using a differentiating amplifier. What I want to do is to calculate the nth derivative of the signal based on a count I specify. How can I apply the same amplifier to the...
Suppose we have a neutral uncharged square current loop, carrying a constant current I. If we boost it in the x direction, x' = \gamma \left( x + \beta t \right) , so that x' increases as t increases (hence the plus sign), what happens to the current?
I get that the current density in the y...
C: Simple "for" loop is not working
Homework Statement
I'm taking an online course (yay lynda!) in C/C++, and I am trying to replicate a course example that prints "Hello, World!" five times, using a simple "for" loop.
Homework Equations
for(int i = 1; i <= 5; ++i){...}
The Attempt at a...
Homework Statement
http://pokit.org/get/img/65e8ba92c1d00bf7fc8be2b178757ed8.jpg
If a=5b, and I1 and I2 are known, find the force on the triangular loop.
Homework Equations
The Attempt at a Solution
For start, the field from the infinitely long wire is :
\vec B=\large -\frac{\mu _{0}...
In many books i saw that open loop transfer function is given by KG(s)H(s) , where G(s) is forward path gain and H(s) is the feedback gain. But according to the definition of open loop it does not contain feedback , then why there is a term of H(s) ?
reference url...
Homework Statement
Find the current flowing through the circuit.
http://wildedge.zxq.net/IMG.jpg
Homework Equations
Amps=Total Voltage / Total ResistanceThe Attempt at a Solution
(20 + 12 + 12 + 3) / (10 + 5 + 30 + 40 + 20 + 15)=0.39A
I'm almost certain that this is wrong. I don't even know...
Homework Statement
I want to create a program that prints the sum of integers k for k(1-20)
ie,
k sum
1 1
2 3
3 6
4 10
5 .
6 .
.
.
.
.
.
20 .
in that format
Homework Equations
The Attempt at a Solution
#include <stdio.h>
int...
1. A rectangular wire loop (length 60 cm, width 40 cm) lies completely within a
perpendicular and uniform magnetic field of magnitude of 0.5 T. If the length of the loop
starts increasing at a rate of 20 mm/s at time t = 0, while the width is decreasing at the
same rate, what is the magnitude...
hi!
can someone please help me with this problem...i have to match the open loop respone to the close loop unity feedback system of a control system.
what is the relation between the two?
thanx in advance
In the following code, highlighted in bold, I am using a nested DO loop to create a running sum of the yearly emissions ("emissions") read out of histem.txt, to create a cumulative emissions curve.
The code generates an "Unexpected STATEMENT FUNCTION statement for sum in cem(i) = sum...
The following code block is in C++ Everything is inside the first for loop.
for( int i=0; i<=2; i++)
{
int a[3]={0};
for(int j=0; j<3; j++)
a[i]=j;
for( int i=0; i<=2; i++)
cout<<a[i];
cout<<endl;
}
basically I am trying to get the screen to output...
This is my first post here.
I'm currently learning about Negative feedback.
Normally, When we want to know the open loop gain, we rewrite circuit(a) to circuit(b).
My question is why do RE1,RF,RE2 from circuit(a) turn into what we see circuit(b)?
what is a theory behind this?
In...
I am trying to find the three roots from x=0 to x=2∏ for this equation: x*Sin[x] + 1.5 x - 3. I want to divide the graph into intervals of say from x=1.0 to x=2.0 as one interval and so on and so forth. How do I go about inserting that code into my existing codes? I am using the bisection method...
Homework Statement
Prove that, in a uniform magnetic field, the net force on a current loop carrying current I is zero.Homework Equations
Green's theorem, and magnetic force equationThe Attempt at a Solution
My main question is whether I can use Green's theorem to prove this result... it seems...
I'm having a recurring problem in mathematica when I try and introduce a simple for loop.
For instance, I have the code shown below. It should increment my var value, and calculate a value of 'initial' for each 'var' value. These should then be recorded under the name RMPvalue[var] so I can...
Homework Statement
A square loop with side-length a is positioned at the centre of a long thin solenoid, which has radius r (with r>a), length l and N turns. The plane of the loop is perpendicular to the axis of the solenoid, find V_{emf} induced in the solenoid
Homework Equations...
Homework Statement
Determine VC for the network in Fig. 7.24 (left-hand image).
Homework Equations
Kirchhoff's Voltage Law: The algebraic sum of the potential rises and drops around a closed path (or closed loop) is zero.
The Attempt at a Solution
This is an example problem...
Homework Statement
Please check the enclosed figure.
Find the force of compression in the wire loop.
Magnetic field B is directed into the page and current i is flowing anti-clockwise. The radius of the wire loop is 'a'.
Homework Equations
\vec{F}=i\vec{l}\times\vec{B}
The...
Hi
Its an existing industrial problem. There is a chiller system and two separate Water Circulation loops are there for water flow.
First: Piping of the Chiller ( Made of Copper), then Mild Steel Piping upto the storage vessel and the to plate heat exchanger (PHE).
Second:
Water...
I have an mp3 player in my car and i think it is having a ground loop issue. Whenever I plug it into my cig. lighter, I could hear a whining noise. The whining noise's pitch is proportional to the engine's RPM. I'm trying to fix and understand the problem because my background is electrical...
Suppose that the number ##\pi## is divided by 2. The resulting quotient is divided by 2 again. This process is continued till the current quotient is less than or equal to 0.01. What is the largest quotient that is greater than 0.01?
Here is my attempt:
r = 1;
quo = 1;
while (quo > 0.01)...
Homework Statement
I'm doing a project right now which deals with designing a closed loop recirculating system using water to cool multiple components. However, this post will only deal with the fluids portion.
Below is the diagram of a very simplified system. Note that the areas marked red...
My book says that the total vector displacement around a closed loop is zero. Is this a general thing for every type of closed loop?
If so, should this be obvious?
Hi Guys,
Attached is a problem from an old exam for a Process Control and Instrumentation unit.
I have tried everything I know (which isn't much, it's not the main assessable portion of the unit).
Other questions similar involve giving us either the characteristic closed loop equation...
Hello, so i have a problem with my assembly code. I want to clear the screen of the DOS and display the string input in the first line. I decided to make a loop that will run 2000 times and fill the space with [20H, which is the ascii for space bar] however, It clears out my message as well and...
]Homework Statement
A closed loop of wire 7.2 x10^{}-3 m^{}2 is placed so that it is at an angle of 60degrees to a uniform magnetic field. The flux density is changing at 0.1 T/s.
The emf, in V, induced in the loop of wire is
A) 3.6x10^{}-4
b)3.6x10^{}-2
6.9
Homework Equations
emf...
I wanted to ask that do each point of the current-carrying circular loop would create a magnetic field and hence the magnetic field lines? And if yes wouldn't the field lines produced by each point of the loop would intersect each other? I read somewhere that magnetic field lines never...
I don't understand why this would work, shouldn't it be "while(x)" because we don't want to repeat the loop?
int main(void)
{
int x=0;
do {
printf("Enter an amount:\n");
scanf("%lf", &amount);
if (amount < 100)
x=1;
else
printf("Invalid");
}while(!x);
return 0;
}