Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: loop for with plot

  • To: mathgroup at smc.vnet.net
  • Subject: [mg110060] Re: loop for with plot
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Sun, 30 May 2010 23:48:03 -0400 (EDT)

>From the documentation: "Unless an explicit Return is used, the value returned by For is Null." You must explicitly display (Print) the plots.

R3 = 6;

For[e3 = 0, e3 < 4, e3++,
 Print[Plot[
   2*R3*Sin[ArcCos[x/R3]]*e3,
   {x, -2 R3, 2 R3},
   PlotRange -> {0, 36}]]]

However, Table is generally more useful

Plot[
 Evaluate[
  Table[
   Tooltip[
    2*R3*Sin[ArcCos[x/R3]]*e3, e3],
   {e3, 0, 3}]],
 {x, -2 R3, 2 R3}]

Plot[
 Evaluate[
  Tooltip[
   Table[
    2*R3*Sin[ArcCos[x/R3]]*e3,
    {e3, 0, 3}]]],
 {x, -2 R3, 2 R3}]


Bob Hanlon

---- maria giovanna dainotti <mariagiovannadainotti at yahoo.it> wrote: 

=============
Dear Mathgroup,

when I am using the loop for with plot is not working.

here is the example
R1=1.029
R2=3
R3=6
e1=27
e2=0
e3=2.5
For[e3=0,e3<4,e3++,Plot[{2*R3*Sin[ArcCos[x/R3]]*e3}, {x, -2R3,2 R3}]]
How can I sort out the problem?
Best regards
Maria



  • Prev by Date: Re: Styling single bar in BarChart
  • Next by Date: Re: Styling single bar in BarChart
  • Previous by thread: Re: loop for with plot
  • Next by thread: Re: loop for with plot