MathGroup Archive 2008

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

Search the Archive

Re: Display[ ] renewed?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg90425] Re: Display[ ] renewed?
  • From: AES <siegman at stanford.edu>
  • Date: Wed, 9 Jul 2008 04:52:36 -0400 (EDT)
  • Organization: Stanford University
  • References: <g4v303$if1$1@smc.vnet.net> <g4vk92$9r3$1@smc.vnet.net>

In response to Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>:

Thanks for suggestion -- but the situation is:  I have a simple expr 
which, when evaluated by itself in its own cell, as a result of that 
evaluation creates and displays a certain plot.

And all I'd like to do is stick that expr (or maybe a couple such 
expr's) into a simple Do loop, and have that Do loop **do what M's 
online documentation explicitly says a Do loop does!**, which is

       Do[expr,{i,Subscript[i, max]}]
             evaluates expr with the variable i successively taking on
            the values 1 through Subscript[i, max] (in steps of 1)

thereby creating and displaying imax plots, not just 1.

Does it really take "something like"

>   SetAttributes[DoPrint, HoldAll]
>   
>   DoPrint[body_, {i_, i1_, i2_}] := Module[{split},
>      split = Hold[body] /. CompoundExpression -> List;
>      split =
>       Flatten[split //. {Hold[{a_, b___}] :> {Hold[a], Hold[b]} ,
>          Hold[a_, b__] :> { Hold[a], Hold[b]}}];
>      split = split /. Hold[a_] :> Hold[Print[a]];
>      Do[
>       ReleaseHold[split /. i -> ii], {ii, i1, i2}
>       ]
>      ]

(with 11 arcane Hold commands!!!) to make Do do what it says it does?

(It was better when Show[ ] actually showed things! -- even if you did 
have to mess with an occasional DisplayFunction.)


  • Prev by Date: Re: PlotRange Trouble
  • Next by Date: Re: A strange precision behavior?
  • Previous by thread: Re: Display[ ] renewed?
  • Next by thread: Re: Display[ ] renewed?