Group Abstract Group Abstract

Message Boards Message Boards

0
|
7.1K Views
|
3 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Use list in Chart-function

Posted 11 years ago

How can I simplify this:

BarChart[{pPoäng[2], pPoäng[3], pPoäng[4], pPoäng[5], pPoäng[6], 
  pPoäng[7], pPoäng[8], pPoäng[9], pPoäng[10], pPoäng[11], pPoäng[12],
   pPoäng[13], pPoäng[14], pPoäng[15], pPoäng[16], pPoäng[17], 
  pPoäng[18], pPoäng[19], pPoäng[20], pPoäng[21], pPoäng[22], 
  pPoäng[23], pPoäng[24], pPoäng[25], pPoäng[26], pPoäng[27], 
  pPoäng[28], pPoäng[29], pPoäng[30], pPoäng[31], pPoäng[32], 
  pPoäng[33], pPoäng[34], pPoäng[35], pPoäng[36]}, 
 ChartLabels -> {Range[2, 36]}, AxesLabel -> {X}, ImageSize -> Large]

To something like this:

BarChart[{pPoäng}, ChartLabels -> {Range[2, 36]}, AxesLabel -> {X}, ImageSize -> Large]

I've tried multiple approaches and I either get an empty chart or the error message: "pPoäng is not a valid dataset or list of datasets"

TIA!

POSTED BY: Jim Brännlund
3 Replies
POSTED BY: Gerli Jõgeva

What is pPoäng?

POSTED BY: David Reiss
Posted 11 years ago

Sorry, it should be a list with probabilities (floats).

omega = Sort /@ 
   Tuples[{Range[1, 4], Range[1, 6], Range[1, 8], Range[1, 12], 
     Range[1, 20]}];
ntot = Length[omega];
poäng[{x_, x_, x_, y_, y_} /; x != y] := 3 x + 2 y == p (* There are multiple lines like this *))
Do[pPoäng[p] = N[Count[omega, _?(poäng)]/ntot], {p, 2, 36}];
POSTED BY: Jim Brännlund
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard