Re: plotting many curves
- To: mathgroup at smc.vnet.net
- Subject: [mg108349] Re: plotting many curves
- From: "David Park" <djmpark at comcast.net>
- Date: Sun, 14 Mar 2010 05:16:23 -0500 (EST)
Easy using Functional expressions, of which Table is the simplest but most
useful construct.
Graphics[
Table[Circle[{RandomReal[{-10, 10}], RandomReal[{-10, 10}]},
RandomReal[{0, 10}]], {10}],
Frame -> True,
PlotRange -> All
]
If you want to draw parametric curves then I would use the Presentations
package.
Needs["Presentations`Master`"]
circle[t_] :=
With[
{center = RandomReal[{-10, 10}, {2}],
r = RandomReal[{0, 10}]},
center + r {Cos[t], Sin[t]}]
Draw2D[
{Table[ParametricDraw[circle[t] // Evaluate, {t, 0, 2 \[Pi]}], {10}]},
Frame -> True,
PlotRange -> All
]
If you want to draw in the complex plane:
circle2[t_] :=
With[
{center = RandomComplex[{-10 - 10 I, 10 + 10 I}],
r = RandomReal[{0, 10}]},
center + r Exp[I t]]
Draw2D[
{Table[ComplexCurve[circle2[t] // Evaluate, {t, 0, 2 \[Pi]}], {10}]},
Frame -> True,
PlotRange -> All
]
If you want to draw using the ComplexPolar[r,theta] notation:
Draw2D[
{Table[ComplexCurve[
RandomComplex[{-10 - 10 I, 10 + 10 I}] +
ComplexPolar[RandomReal[{0, 10}], t] // PolarToComplex //
Evaluate, {t, 0, 2 \[Pi]}], {10}]},
Frame -> True,
PlotRange -> All
]
David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/
From: eric g [mailto:eric.phys at gmail.com]
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]