Re: List argument
- To: mathgroup at smc.vnet.net
- Subject: [mg36404] Re: [mg36376] List argument
- From: BobHanlon at aol.com
- Date: Wed, 4 Sep 2002 21:22:19 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
In a message dated 9/4/02 3:31:53 AM, pascal at go.ro writes:
>I want to do these operations:
>
>eq = m x^2 + 2(m + 1)x + m + 2
>l = {}
>For[i = -30, i < 30, i++, AppendTo[l, eq /. m -> i]]
>Plot[l, {x, -50, 50}]
>
>but i get this error:
>l is not a machine-size real number at x = -49.99999583333334
>
>Can someone exaplain to me what i am doing wrong here??
>
eq = m x^2 + 2(m + 1)x + m + 2;
l = {};
For[i = -30, i < 30, i++, AppendTo[l, eq /. m -> i]];
It would be more straightforward and efficient to define the list using Table
l == Table[eq, {m, -30, 29}]
True
To Plot, use Evaluate
Plot[Evaluate[l], {x, -50, 50}];
Bob Hanlon