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.
Homework Statement
I am trying to create a code, in Matlab, that will describe the geometry of a PARSEC airfoil. The x coordinates for the upper and lower surfaces of the airfoil shape simply run from 0 to 1 (for a unit chord length). The z-coordinates (that describe the shape) are given by...
I'm reading through my text (Griffiths Electrodynamics), and I'm working through an example in which he tries to dismantle a scenario where it is tempting to think that the magnetic field does work.
The scenario is as follows, we have a square current carrying loop of wire of constant current...
Homework Statement
A small bead is on square loop in the xz plane with dimensions (±R, 0, ±R). An electric field is turned that is ##\vec{E}(\vec{r})=-Cx\hat{z}##
Calculate W
Homework Equations
##W= \int q\vec{E}\bullet dl##
The Attempt at a Solution
Starting with z direction...
So I have a constant force F acting tangentially on a mass m in a vertical circle around a loop of radius r. The mass starts from rest at the very top of the loop. The only other force is gravity, that is m*g
Now I did Work=Change in energy with a system that is comprised of both the...
Homework Statement
A wire loop of resistance R and area A has its normal along the direction of a uniform magnetic field, B. The loop is then flipped over in a time Δt so that its normal is opposite to the field. a) Calculate the average induced EMF. b) Find the average induced current. c) If...
Homework Statement
A conducting loop with area 0.13m2 and resistance 6.0Ω lies in the x-y plane. A spatially uniform magnetic field points in the z direction. The field varies with time according to Bz=at2−b, where a = 2.8T/s2 and b = 8.0T .
(a) Find the (magnitude of the) loop current...
Dear All:
For a line structure(say a very long atomic chain) and a closed loop structure( connect the head and tail of this atomic chain). Does there exists a transformation between these two structures?
For example if we want to study the vibration mode of these two cases. If we already know...
Does there exist a transformation between a line and a closed loop ?
Dear All:
For a line structure(say a very long atomic chain) and a closed loop structure( connect the head and tail of this atomic chain). Does there exists a transformation between these two structures?
For example if we...
Karami's talk is scheduled for Tuesday 29 October in just a few days.
http://relativity.phys.lsu.edu/ilqgs/
The title has not yet been posted. It is a good bet that it will be about one or more of the active topics in Loop cosmology of which there are quite a few. Karami's recent work...
The fourth quarter 2013 has already seen an interesting bunch of Loop gravity research papers. I'll list a few and say why I think they are remarkable. Some make meaningful progress along established lines, while one or more others take an unexpected direction and are clearly exceptional...
What is the difference between a short bar magnet and a long bar magnet ?
How is the magnetic field passing through circular loop similar to short bar magnet? And if a number of circular loops are connected to diff sources of current but attached together , do they form a solenoid ? Or are the...
Can anyone help me to in this problem?
I want to use DO loop in Plot order at mathematica 8, how can I do this?
I want to change one variables and see the changes in other variables in the graph, and want to plot all of my graph in one Plot order. Like this.
I Uploaded my file too.
Homework Statement
In Fig. 8-28, a small block of mass m = 3.0 kg can slide along the frictionless loop-the-loop. The loop has radius R = 0.80 m. The block is released from rest at point P, at height h = 2.9R above the bottom of the loop.
I attatched a picture
(a) Find the speed of the...
I can't go into detail right know - but the thing is: in order to make a real antimatter engine one would need to make a loop of SCs wire r = 70 m, where r(wire) is approx. 20 cm.
I need to generate about 10 T in the center of the field, that is 70 m from the nearest wire. How much mechanical...
Homework Statement
http://ezto.mhecloud.mcgraw-hill.com/13252699450881445581.tp4?REQUEST=SHOWmedia&media=ch28q44a.jpg
A long, straight wire has a 11.1‐A current flowing in the positive x -direction, as shown in the figure. Close to the wire is a square loop of copper wire that carries a...
I remember having studied that closed loop systems can be represented by open loop systems. But that seems weird..if it were possible for both the types of systems to have the same transfer function, why would they behave differently?
Homework Statement
A circular conducting coil is present in space in the absence of any external electric and magnetic fields.A steady and constant current is flowing through the coil.What is the tension developed in the coil?.(Given current is 'I' and radius of coil is 'r')
Homework...
I haven't seen anyone derive the magnetic field density (B) using ampere's law, only using Biot-Savart Law
any reason why?
if we cut the loop and loop at one end (of the new cut) and treat it as if it was a current carrying wire, then by ampere's law we'd get:
B = u*I / 2*pi*r
but...
this is the E field above a square loop with side=a at distance z on the z axis. by symmetry the Ex, Ey field cancel out. it really kind of bothers me that I can't see this substitution, including the sin(tan^-1(u)) portion. I guess it's an easy technique but I wonder how you get the...
i know that a current loop creates some kind of a short bar magnet ,
but how ?
i mean in a short bar magnet , the magnetic field leaves the north pole and goes towards the south pole Of the MAGNET itself , but in the case of the solenoid or a coil , it just looks as if the magnetic field...
Homework Statement
So, I understand that I'm supposed to write the problem however, given the nature of current diagrams I think this is a bit hard. I am given the voltages and resistances and I have to solve for the current through each resistor. Here is a link to the problem which I found...
Suppose I take a random walk on a 2 dimensional square lattice, but this lattice plane has a finite size, e.g. Dx*Dy. I can not cross the boundary, my step length is the lattice cell size, I either go straight or make turns with right angle. Is there any work on this type of random walk?
If...
I was playing with an old crt TV and a small loop antenna earlier and noticed that when I hold the antenna vertically in front of the TV I get one solid spike at around 15 kHz. When I hold the antenna horizontally I get a multitude of spikes that are not there when I turn off the TV.
This...
Homework Statement
Compute the current through R2 of the circuit in the figure.
Homework Equations
kirchoff's loop rule
V=IRThe Attempt at a Solution
Junction: I1+I2=I3
Alpha loop: V1-I3R3-I5R5=0
I1=(V1-I5R5)/R3=?
Beta loop: V2-I8R8-I5R5=0
*without one of the currents provided I am not...
Homework Statement
The following pseudocode demonstrates an algorithm to create a 2D array from a 1D array by adding elements into certain rows:
For i = 1, 2, ..., n
For j = i + 1, i + 2, ..., n
Add up array entries A[i] through A[j]
Store the result in B[i, j]
Endfor...
Hi, I have a program that is entering a infinite loop in the last if else of this loop. The program is printing 3 endless times. Here is the code that generates it:
else {
for (j=1;j<n;j++) {
if (j<=(n/2)) {
a[1][j] = j-1;
printf ("%d", a[1][j]);
}...
When you start going around a loop to try and determine whether to add or subtract each voltage in that loop, how do you decide which?
For example see the diagram just above Q7. http://www.facstaff.bucknell.edu/mastascu/eLessonsHTML/Basic/Basic5Kv.html
Starting from any point and going...
Homework Statement
A conductor (wire) is folded into a square loop with each side having a length of a. Total charge of Q is transferred onto the conductor. Describe the line charge density of the square loop in equilibrium. (If I am interpreting this correctly what is required is...
This is a problem I encountered while studying/practicing for my upcoming MCAT exam:
Homework Statement
A 1kg block slides down a ramp and then around a circular loop of radius 10m. Assume that all surfaces are frictionless.
1)What is the minimum height of the ramp required so that...
Homework Statement
Consider AdS_5 space in Poincaré coordinates with metric ds^2=\frac{dz^2+dx_\mu dx^\mu}{z^2}. There is a circular Wilson Loop with Radius R in the Minkowskian boundary of AdS_5. We want to find the surface of minimal area in AdS_5 that has this loop as boundary.
We choose...
Homework Statement
A square loop of wire is made up of 50 turns of wire, 45 cm on each side. The loop is immersed in a 1.4T magnetic field perpendicular to the plane of the loop. The loop of wire has little resistance but it is connected to two resistors in parallel as shown. (a) When the loop...
I was looking at an example where it was evaluating a closed loop integral of a vector field around a triangle (0,0) (1,1) (2,0) by using greens theorem. This example was in the green's theorem section of the book so green's theorem must be used. Anyways the double integral was set up as follows...
Homework Statement
Car Dynamics
f(t)→ \frac{\frac{1}{M}}{s+\frac{D}{M}}→y(t)
Applied Force Velocity
Homework Equations
M=1,000 kg and D=1000 kg/s
Where f(t) represents the input force and y(t) is the output velocity. M is the Mass and D...
Homework Statement
A tennis ball is a hollow sphere with a thin wall. It is set rolling without slipping at 4.08 m/s on a horizontal section of a track as shown in the figure below. It rolls around the inside of a vertical circular loop of radius r = 45.8 cm.
given radius =0.458m
ω= 4.08...
This is part of the derivation of vector magnetic potential of a small current loop center at origin and on xy plane. The current is stated to assumed to be constant along the loop. Attach is the scanned copy of the page in question.
http://i43.tinypic.com/5f2q7d.jpgI cannot understand why the...
The vector magnetic potential is given
\vec A=\frac{\mu I}{4\pi}\oint\frac{e^{-j\beta R_1}}{R_1}dl'
After a few steps, the equation becomes:
\vec A=\frac{\mu I}{4\pi}e^{-j \beta R}\left[ (1+j\betaR)\oint\frac{dl'}{R_1}-j\beta\oint dl'\right]
The Book claim the second integral obviously...
Homework Statement
Homework Equations
The Attempt at a Solution
The force on the loop due to magnetic field in the direction normal to the incline is ##qvB##.
Balancing forces in the direction normal to the incline,
mg\cos\alpha=qvB+N
where ##N## is the normal reaction due to incline and v is...
Homework Statement
A square loop of wire of side length L lies in the xy-plane, with its center at the origin and its sides parallel to the x- and y- axes. It carries a current i, in a counterclockwise direction, as viewed looking down the z-axis from the positive direction. The loop is in...
Hello,
I'm working on a small scale parabolic trough concentrator project to generate electricity.
This electricity is used for pumping water for irrigation,and I want to use an open loop Rankine cycle with no condenser(if it is applicable),to reduce cost,with the steam exhausting directly...
How specifically does LQG explain how the universe can oscillate from big bang to big crunch ad infinitum? Wouldn't the total energy able to be used as work decrease after a couple of bounces? Am I simply misunderstanding or making a false assumption about what LQG's premises are? I've not...
In my circuit analysis textbook, there is an example problem using a KVL loop. Though it seems relatively simple, I cannot understand the answer.
the loop consists of 3 voltages: -8, 12, and the unknown, Vr2. The polarities (clockwise) around the loop are respectively +,-,+.
The answer...
Homework Statement
A small loop with area 6.8 mm^2 is placed in a long solenoid with 854 turns/cm and a sinusoidally varying current w/ amplitude 1.28 A and angular frequency of 212 rad/s. What is the amplitude of the emf induced in the loop?
Homework Equations
\textbf{B}=\mu_0 in
\Phi_B...
Hello,
I'm working on a small scale parabolic trough concentrator project to generate electricity.
This electricity is used for pumping water for irrigation,and I want to use an open loop Rankine cycle with no condenser(if it is applicable),to reduce cost,with the steam exhausting directly...
I have posted a question on here before regarding the generation of a number sequence. I followed up that question with an answer. However, as I have developed my code more I need to use an equation instead of a lookup table.
Note: I'm using MATLAB
Given a matrix A of size r x c where r >=...
Here's a picture:
Edit: Here's a description of the problem in case the picture isn't clear. A 54-kg pilot flies a jet trainer in a half vertical loop of 1200-m radius so that the speed of the trainer
decreases at a constant rate. Knowing that the pilot’s apparent weights at Points A and C...
Say I have an airplane that is performing a loop at a constant speed. Why is it that at the top of the loop the normal force points inward and not upward due to the lift of the plane?
That way, at the top of the loop, when the pilot is upside down, he feels lighter due to the lift of the...
Homework Statement
Consider a bead of mass m on a loop of radius R. The loop is rotating at a constant rate ω. Using a non-inertial frames of reference, find all equilibrium points of the bead on the loop.
Homework Equations
\vec{F_e}=m\vec{a_r}...
Some time ago I was doing my dissertation on inflation and wrote to Martin Bojowald to ask if loop quantum cosmology was compatible with eternal inflation or not. He said at the time that no work had been done on the subject but it might be something to look at in the future.
I have now found...