Re: List argument
- To: mathgroup at smc.vnet.net
- Subject: [mg36400] Re: [mg36376] List argument
- From: "Y.A.Tesiram" <yas at pcomm.hfi.unimelb.edu.au>
- Date: Wed, 4 Sep 2002 21:22:13 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
CeZaR,
Sort of confused about what you really wanted. If you have forgotten to
assign x = ? then you can do the following,
Clear[x, eq, m, l]
eq = m x^2 + 2(m + 1)x + m + 2
l = {};
x = 1;
For[i = -30, i < 30, i++, AppendTo[l, eq /. m -> i]]
ListPlot[l]
But if you really intend to make a list of quadratics and then plot the
results for each of the quadratics then you can try the following
Clear[x, eq, m, l]
eq = m x^2 + 2(m + 1)x + m + 2;
l = {};
For[i = -30, i < 30, i++, AppendTo[l, eq /. m -> i]];
test = Table[l[[i]], {i, 1, Length[l], 1}, {x, -50, 50}];
MultipleListPlot[test[[5]], test[[10]], test[[15]], test[[20]],
test[[25]],
test[[30]], test[[35]], test[[40]], test[[45]], test[[50]], test[[55]],
test[[60]],
PlotJoined -> True,
SymbolShape -> None,
ImageSize -> 500
]
Essentially your For loop generates a list of quadratics if x is left out.
Cheers
Yas
On Wed, 4 Sep 2002, CeZaR wrote:
> Hi,
>
> 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??
>
> Thanks!
>
> CeZaR
>
>