Ask Your Question

Can't plot a function

asked 2020-05-06 13:15:00 -0600

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

answered 2020-05-06 13:50:30 -0600

slelievre gravatar image

updated 2020-05-06 14:07:08 -0600

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


Asked: 2020-05-06 13:15:00 -0600

Seen: 54 times

Last updated: May 06 '20