Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

plotting many curves

0 views
Skip to first unread message

eric g

unread,
Mar 13, 2010, 7:57:51 AM3/13/10
to
Hello Group,

I know I should avoid For cycles in mathematica, but I am C person...
how to do this without For

(*--------initialization------------------*)
n = 10^2;
xoi = RandomReal[{-10, 10}, {n}];
yoi = RandomReal[{-10, 10}, {n}];
ri = RandomReal[{0, 10}, {n}];
-----------------------------------
(*

n=10^2;
Clear[circles];
circles = Table[Null, {n}];
For[i = 1, i <= n, i++,
circles[[i]] = {xoi[[i]] + ri[[i]]*Cos[t], yoi[[i]] + ri[[i]]*Sin[t]}]

(*---------------displaying--------------------*)
ParametricPlot[circles, {t, 0, 2 Pi}, PlotStyle -> Black]

DC

unread,
Mar 14, 2010, 6:14:22 AM3/14/10
to
n = 5;
centers = RandomReal[{-10, 10}, {n, 2}];
radii = RandomReal[{0, 10}, {n}];

circles = {centers[[#, 1]] + radii[[#]] Cos[t],
centers[[#, 2]] + radii[[#]] Sin[t]} & /@ Range[n];

ParametricPlot[circles, {t, 0, 2 Pi}, PlotStyle -> Black]

-Francesco

0 new messages