Re: Why the loop gain no result?
- To: mathgroup at smc.vnet.net
- Subject: [mg126082] Re: Why the loop gain no result?
- From: Ray Koopman <koopman at sfu.ca>
- Date: Sun, 15 Apr 2012 03:19:01 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <jmb7v4$r2e$1@smc.vnet.net>
On Apr 14, 12:11 am, Huafeng Cao <geotom.... at gmail.com> wrote: > I use the 'For' loop to solving an equation, such as : > For[i = 1, i < 5, i++, a = i; Solve[a*x^2 - 2 x + 1 == 0, x]]. > The 'a' in the body must be updated in every loop with the 'i'. > But i can't gain the result, Somewhere is disorder? I am confused. No, you don't need the 'a'. But if you want to see the results then you need to Print them: For[i = 1, i < 5, i++, Print@Solve[i*x^2 - 2 x + 1 == 0, x]] or put them in a Table: Table[Solve[i*x^2 - 2 x + 1 == 0, x], {i,4}]