Group Abstract Group Abstract

Message Boards Message Boards

Language for plotting in Mathematica 9

Posted 11 years ago

so i started working for a project on the birthday problem ( those who dont know may refer here: http://mathworld.wolfram.com/BirthdayProblem.html ) I created a table which had all values for the probablity and wanted to plot it . I name the table as t and gave command Plot[t], Mathematica plotted but it was a line plot and i wanted something like the screenshot like .the first in table ( i.e expr 1 in the table) with its value at y and 1 at x, 2nd with value at y and 2 at x and so on. the table has 365 so i cant do manually, please help

Attachments:
POSTED BY: Anvit Garg
6 Replies

Yes.

enter image description here

POSTED BY: David Reiss
Posted 11 years ago

I don't have access to Mathematica right now will ListLinePlot give a similar result as the figure above

POSTED BY: Anvit Garg

Plot[t] is syntactically incorrect and will not display anything. Use

ListLinePlot[t]
POSTED BY: David Reiss
Posted 11 years ago
POSTED BY: Anvit Garg

You want ListPlot or ListLinePlot to plot a table of data values. Plot is for plotting a function.

POSTED BY: David Reiss

Is this what you want? Set d=366 to include possible Feb 29. Table example goes to n=23, can expand to 366.

In[1]:= P2[n_, d_] := 1 - d!/((d - n)! d^n)

In[2]:= P2[23, 366] // N

Out[2]= 0.506323

In[3]:= Do[Print[n, "    ", N[P2[n, 366]]], {n, 1, 23}]

1    0.

2    0.00273224

3    0.00818179

4    0.0163114

5    0.0270621

6    0.0403536

7    0.0560856

8    0.0741386

9    0.094376

10    0.116645

11    0.140781

12    0.166604

13    0.193929

14    0.22256

15    0.252298

16    0.282941

17    0.314288

18    0.346138

19    0.378295

20    0.41057

21    0.442779

22    0.474751

23    0.506323
POSTED BY: S M Blinder
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard