Ask Your Question
1

Can't plot a function

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

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 13:50:30 -0500

slelievre gravatar image

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

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 13:15:00 -0500

Seen: 43 times

Last updated: May 06