Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Here is my SSCCE:

a[1] = 2; a[2] = 3; a[3] = 6; Histogram[a]

This throws and error though. Here are my questions:

  1. What kind of data type is a? Is it an Array? a List? So far as I can tell it's neither.
  2. How do I get the above to work?
share|improve this question
Do you want an histogram or a bar chart? I suspect you want a bar chart, in which case a={2,3,6}; BarChart[a] – Cassini Nov 13 '12 at 1:56
And to answer your first question, a is a symbol. a={2,3,6} would be a list. – Cassini Nov 13 '12 at 1:57
Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2)Read the FAQs! 3) When you see good Q&A, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. ALSO, remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign` – chris Nov 13 '12 at 7:04

These are DownValues. Lets say you defined a bunch of them as follows.

Table[a[i] = 
  RandomVariate[BinomialDistribution[100, 1/2]], {i, 10000}]

Applying DownValues to a gives the list you've created. Here is the first one.

DownValues[a] // First

(* HoldPattern[a[1]] :> 46 *)

You can similarly get them all at once and use Histogram on the values.

Histogram[ReleaseHold[First /@ DownValues[a]]]

enter image description here

share|improve this answer
Thanks for your response. What is the holding bit about? – David Nov 13 '12 at 2:08
DownValues uses HoldPattern so that it remains unevaluated. ReleaseHold does precisely what it says and releases the HoldPattern (and other types of held expressions). – Andy Ross Nov 13 '12 at 2:10
The following is worth reading.… – Andy Ross Nov 13 '12 at 2:12
Andy, any reason not to use Histogram[Last /@ DownValues@a]? – Mr.Wizard Nov 13 '12 at 2:16
@David Is there a motivation for using this unconventional method for manipulating data? – image_doctor Nov 13 '12 at 8:53

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.