Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #9659

Re: Why the loop gain no result?

From Bill Rowe <readnews@sbcglobal.net>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Why the loop gain no result?
Date 2012-04-15 07:21 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jmdsuh$adi$1@smc.vnet.net> (permalink)

Show all headers | View raw


On 4/14/12 at 3:10 AM, geotom.cao@gmail.com (Huafeng Cao) 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
>cann' t gain the result,Somewhere is disorder? I am confused.

 From the documentation for For

Unless an explicit Return is used, the value returned by For is Null

And that is why your code doesn't display any result. Instead of
using For, use Table, i.e.

Table[Solve[a*x^2 - 2 x + 1 == 0, x], {a, 5}]

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: Why the loop gain no result? Bill Rowe <readnews@sbcglobal.net> - 2012-04-15 07:21 +0000

csiph-web