Prev: Trouble with coupled quadratic equations where the solutions are
Next: Simplify Exponential Output
From: David Park on 14 Mar 2010 06:16 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(a)comcast.net http://home.comcast.net/~djmpark/ From: eric g [mailto:eric.phys(a)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]
First
|
Prev
|
Pages: 1 2 Prev: Trouble with coupled quadratic equations where the solutions are Next: Simplify Exponential Output |