Ask Your Question
1

Can't plot a function

asked 2020-05-06 20:15:00 +0100

Alex89 gravatar image

Hey guys, I'm trying to plot this function into Sage and it does not work for some reason.

g(x) = binomial(3,x)*binomial(3,2-x) / binomial(6,2)

plot(g(x), (x,0,2))

Nothing shows up.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2020-05-06 20:50:30 +0100

slelievre gravatar image

updated 2020-05-06 21:07:08 +0100

The command plot samples 200 points in the specified interval.

For the combinatorial function in the question, only integer values matter.

The corresponding plotting function is list_plot.

sage: g = lambda x: binomial(3, x) * binomial(3, 2 - x) / binomial(6, 2)
sage: glist = [g(x) for x in range(3)]
sage: gplot = list_plot(glist, ymin=0, size=30)
sage: gplot.show()
Launched png viewer for Graphics object consisting of 1 graphics primitive

plot of combinatorial function

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2020-05-06 20:15:00 +0100

Seen: 650 times

Last updated: May 06 '20