Not exactly the same but shows the gist: sage: m = matrix(5, 5, lambda i, j: binomial(i,j)) sage: m.plot()
On Thursday, November 27, 2014 9:08:30 PM UTC, projetmbc wrote: > > Hello. > > Is it possible to do the same thing as the following code in "pure" Sage > coding ? > > *Christophe BAL* > *Enseignant de mathématiques en Lycée* > *et développeur Python amateur* > > *--**------**------**--- **CODE **---**------**------**--* > *import matplotlib.pyplot as plt* > *import numpy as np* > *from sympy import binomial* > > *nmax = 200* > > *im = np.zeros((nmax+1, nmax+1, 3))* > > *for n in range(nmax):* > * for k in range(n+1):* > * if binomial(n, k) % 2 == 1:* > * im[k, n] = (255, 255, 255)* > > *im = im.astype(np.uint8)* > > *plt.imshow(im)* > *plt.axis('off')* > *plt.show()* > > -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.