ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 06 May 2020 20:50:30 +0200Can't plot a functionhttps://ask.sagemath.org/question/51300/cant-plot-a-function/ 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.Wed, 06 May 2020 20:15:00 +0200https://ask.sagemath.org/question/51300/cant-plot-a-function/Answer by slelievre for <p>Hey guys, I'm trying to plot this function into Sage and it does not work for some reason.</p>
<p>g(x) = binomial(3,x)*binomial(3,2-x) / binomial(6,2)</p>
<p>plot(g(x), (x,0,2))</p>
<p>Nothing shows up.</p>
https://ask.sagemath.org/question/51300/cant-plot-a-function/?answer=51302#post-id-51302The 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](https://i.imgur.com/yJxLrLh.png)Wed, 06 May 2020 20:50:30 +0200https://ask.sagemath.org/question/51300/cant-plot-a-function/?answer=51302#post-id-51302