Re: What's going on here (Table-generated lists)?

*To*: mathgroup at smc.vnet.net*Subject*: [mg98143] Re: What's going on here (Table-generated lists)?*From*: Bill Rowe <readnews at sbcglobal.net>*Date*: Tue, 31 Mar 2009 04:19:12 -0500 (EST)

On 3/30/09 at 4:43 AM, siegman at stanford.edu (AES) wrote: >But >Plot[0.5{x,x^2}, {x,0,1}] >will not plot two curves in two different colors -- right? -- >despite the fact that evaluating 0.5{x,x^2} by itself >displays as {0.5 x, 0.5 x^2} ); Right, 0.5{x,x^2} is not a list until it is evaluated. Entering this by itself causes it to be evaluated to a list. But Plot has the attribute HoldAll which means it is not evaluated immediately. Consequently, only one color is used. >Plot[{0.5x, 0.5x^2}, {x, 0, 1}] >does plot two curves in two different colors Right. This is an explicit list for which Plot will use different colors for each member of the list. >>What answer are you looking for here? >In my case (I'm not the OP), not an explanation of why this happens >(I've come to sort of understand this); but as purely curiosity >questions (since this behavior of Plot comes up time after time): >1) Is having this weird and confusing behavior in the Plot[] >command somehow necessary, unavoidable, for reasons deep in the >fundamental structure of Mathematica? -- or is this merely a bad >design choice made long ago, that one would wish could now be >extirpated (but probably can't be)? It is a question of efficiency. For a simple expression such as 0.5{x,x^2} the time to evaluate this symbolically then substitute numbers is trivial. But it is not difficult to find examples where the time needed to evaluate the expression symbolically then substitute numbers is far greater than the time needed to substitute numbers and evaluate. It is also not difficult to find examples where just the opposite is true. There is no single process guaranteed to be the best in all cases. And note, there is no simple way to determine whether multiple values returned by an expression are the result of a multi-valued function to be plotted in one color of the results from a list of separate expressions to be plotted in more than one color without first evaluating the expression. And that requires execution time. Including this functionality into Plot would mean more time to create a given Plot. >2) Does Wolfram have any understanding of how much the string of >endless "gotchas" like this damage the usability of Mathematica for >ordinary users (as contrasted to full time professional >programmers)? You seem to think there is a solution that would avoid such issues. I definitely do not believe this to be the case. Nor do I accept your implication that a full time professional programmer is needed to avoid such issues. Many (if not all) of these "gotchas" are reasonably easy to understand with a bit of thought. In this particular case, how would you decide whether a set of values returned by an expression where from a multi-valued function to be plotted in a single color or values from members of a list to be plotted in different colors? In the case of Plot, the answer is simple. If the expression has Head == List, then it is to be plotted in multiple colors. Otherwise a single color is to be used.

**Re: simpler way to get a particular banded matrix?**

**Re: manipulate, NDSolve, Evaluate**

**Re: What's going on here (Table-generated lists)?**

**Asking PlotRange to take a Dynamic value**