Message Boards Message Boards

Language for plotting in Mathematica 9

Posted 10 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 10 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 10 years ago

S M Blinder, I don't think you've got my question I'll write my program for your assistance

f[x_] :=1- 365!/((365-x)!*365^x).   

This program would give the chances for 'x' number of days. This made a table for all probabilities

In[2]:t=Table[1- 365!/((365-x)!*365^x),{x,1,366}].  
out[2]:{0,.......(all the probabilities ) ......,1}
: Plot[t]

The output instead of what shown in the shot above, showed some random lines What I expected that the first expr I.e.0 in out[2] would have 0 as y coordinate and 1 as x coordinate and the last value would have 1 as y coordinate and 366 as x The above figure shows till 100 but I wanted to expand it till 366

Or I suppose if I write Plot[Do[Print[n," ",N[P2[n,365]]],{n,1,366}]] it'd plot the above figure ?

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
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

Group Abstract Group Abstract