Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Some questions on plot

This is a multi-form question. After this question https://ask.sagemath.org/question/67023/error-in-listing-a-zip/ my code works anew. Do not ask me why ?

But I encounter somenew problem. I have had problem to make docker works properly on my computer. But now I would like to enlight the following code

billes=[ZZ.random_element(0, 4) for i in range(50)]
billes+=[ZZ.random_element(5, 10) for i in range(80)]
billes+=[ZZ.random_element(10, 25) for i in range(21)]
billes+=[ZZ.random_element(25, 50) for i in range(28)]
billes+=[ZZ.random_element(50, 100) for i in range(28)]
shuffle(billes)#no necessary here only to confirm
billes1=sorted(billes)
binbilles1=[[x for x in billes1 if 0 <= x < 4],[x for x in billes1 if 5 <= x < 10],[x for x in billes1 if 10 <= x < 25],[x for x in billes1 if 25 <= x < 50],[x for x in billes1 if 50 <= x < 100]]
avbinbilles1=[len(x)^(-1)*sum(x) for x in binbilles1]
number=[len(x) for x in binbilles1]
cumsumpop=[sum(number[:i]) for i in range(1, len(number)+1)]
percumsumpop=[0]+[sum(number[:i])/sum(number) for i in range(1, len(number)+1)]
cumsumavbinbilles1=[sum(avbinbilles1[:i]) for i in range(1, len(avbinbilles1)+1)]
percumsumavbinbilles1=[0]+[sum(avbinbilles1[:i])/sum(avbinbilles1) for i in range(1, len(avbinbilles1)+1)]
#percumbilles1=[0]+[sum(binbilles1[:i])/sum(number) for i in range(1, len(binbilles1)+1)]
show(percumsumpop)
show(percumsumavbinbilles1)
A=zip(percumsumpop,percumsumavbinbilles1)
p=line([(0,1),(1,1),(1,0)],color='black')
p+=list_plot(list(A),color='red',plotjoined=true,aspect_ratio=1)
p+=line([(0,0),(1,1)])
p+=text(r"$Courbe\,\, de\,\, Lorenz$",(0.2,0.95), color='green')
p+=text(r"$Pourcentages\,\, Cumulés\,\, de \,\, la \,\, Population$",(-0.1,0.5), color='green', rotation=90)
p+=text(r"$Pourcentages\,\, Cumulés\,\, de \,\, la \,\, richesse$",(0.5,-0.1), color='green', rotation=0)
show(p)

1) I would like to fill the space between the red and the blue line but I do not find how 2) I would like to change the font of the ticks and label if I use them but I do not find how 3) I use Docker but I do not know how to gives access to Latex (We need a container with bot Sagemath and latex)

Some questions on plot

This is a multi-form question. After this question https://ask.sagemath.org/question/67023/error-in-listing-a-zip/ my code works anew. Do not ask me why ?

But I encounter somenew problem. some new problems. I have had problem to make docker works properly on my computer. But now I would like to enlight the following codecode (look at 3) for the docker problem)

billes=[ZZ.random_element(0, 4) for i in range(50)]
billes+=[ZZ.random_element(5, 10) for i in range(80)]
billes+=[ZZ.random_element(10, 25) for i in range(21)]
billes+=[ZZ.random_element(25, 50) for i in range(28)]
billes+=[ZZ.random_element(50, 100) for i in range(28)]
shuffle(billes)#no necessary here only to confirm
billes1=sorted(billes)
binbilles1=[[x for x in billes1 if 0 <= x < 4],[x for x in billes1 if 5 <= x < 10],[x for x in billes1 if 10 <= x < 25],[x for x in billes1 if 25 <= x < 50],[x for x in billes1 if 50 <= x < 100]]
avbinbilles1=[len(x)^(-1)*sum(x) for x in binbilles1]
number=[len(x) for x in binbilles1]
cumsumpop=[sum(number[:i]) for i in range(1, len(number)+1)]
percumsumpop=[0]+[sum(number[:i])/sum(number) for i in range(1, len(number)+1)]
cumsumavbinbilles1=[sum(avbinbilles1[:i]) for i in range(1, len(avbinbilles1)+1)]
percumsumavbinbilles1=[0]+[sum(avbinbilles1[:i])/sum(avbinbilles1) for i in range(1, len(avbinbilles1)+1)]
#percumbilles1=[0]+[sum(binbilles1[:i])/sum(number) for i in range(1, len(binbilles1)+1)]
show(percumsumpop)
show(percumsumavbinbilles1)
A=zip(percumsumpop,percumsumavbinbilles1)
p=line([(0,1),(1,1),(1,0)],color='black')
p+=list_plot(list(A),color='red',plotjoined=true,aspect_ratio=1)
p+=line([(0,0),(1,1)])
p+=text(r"$Courbe\,\, de\,\, Lorenz$",(0.2,0.95), color='green')
p+=text(r"$Pourcentages\,\, Cumulés\,\, de \,\, la \,\, Population$",(-0.1,0.5), color='green', rotation=90)
p+=text(r"$Pourcentages\,\, Cumulés\,\, de \,\, la \,\, richesse$",(0.5,-0.1), color='green', rotation=0)
show(p)

1) I would like to fill the space between the red and the blue line but I do not find how 2) I would like to change the font of the ticks and label if I use them but I do not find how 3) I use Docker but I do not know how to gives access to Latex (We need a container with bot Sagemath and latex)latex) 4) Incidently, I do notknow how to make docker remanent. Each time I shut down my computer , I loose all my notebooks

Some questions on plot

This is a multi-form question. After this question https://ask.sagemath.org/question/67023/error-in-listing-a-zip/ my code works anew. Do not ask me why ?

But I encounter some new problems. I have had problem to make docker works properly on my computer. But now I would like to enlight the following code (look at 3) for the docker problem)

billes=[ZZ.random_element(0, 4) for i in range(50)]
billes+=[ZZ.random_element(5, 10) for i in range(80)]
billes+=[ZZ.random_element(10, 25) for i in range(21)]
billes+=[ZZ.random_element(25, 50) for i in range(28)]
billes+=[ZZ.random_element(50, 100) for i in range(28)]
shuffle(billes)#no necessary here only to confirm
billes1=sorted(billes)
binbilles1=[[x for x in billes1 if 0 <= x < 4],[x for x in billes1 if 5 <= x < 10],[x for x in billes1 if 10 <= x < 25],[x for x in billes1 if 25 <= x < 50],[x for x in billes1 if 50 <= x < 100]]
avbinbilles1=[len(x)^(-1)*sum(x) for x in binbilles1]
number=[len(x) for x in binbilles1]
cumsumpop=[sum(number[:i]) for i in range(1, len(number)+1)]
percumsumpop=[0]+[sum(number[:i])/sum(number) for i in range(1, len(number)+1)]
cumsumavbinbilles1=[sum(avbinbilles1[:i]) for i in range(1, len(avbinbilles1)+1)]
percumsumavbinbilles1=[0]+[sum(avbinbilles1[:i])/sum(avbinbilles1) for i in range(1, len(avbinbilles1)+1)]
#percumbilles1=[0]+[sum(binbilles1[:i])/sum(number) for i in range(1, len(binbilles1)+1)]
show(percumsumpop)
show(percumsumavbinbilles1)
A=zip(percumsumpop,percumsumavbinbilles1)
p=line([(0,1),(1,1),(1,0)],color='black')
p+=list_plot(list(A),color='red',plotjoined=true,aspect_ratio=1)
p+=line([(0,0),(1,1)])
p+=text(r"$Courbe\,\, de\,\, Lorenz$",(0.2,0.95), color='green')
p+=text(r"$Pourcentages\,\, Cumulés\,\, de \,\, la \,\, Population$",(-0.1,0.5), color='green', rotation=90)
p+=text(r"$Pourcentages\,\, Cumulés\,\, de \,\, la \,\, richesse$",(0.5,-0.1), color='green', rotation=0)
show(p)

1)

  1. I would like to fill the space between the red and the blue line but I do not find how 2) how
  2. I would like to change the font of the ticks and label if I use them but I do not find how 3) how
  3. I use Docker but I do not know how to gives access to Latex (We need a container with bot Sagemath and latex) 4) latex)
  4. Incidently, I do notknow how to make docker remanent. Each time I shut down my computer , I loose all my notebooks