Danke für die Tips. Jetzt Habich nur noch das Problem, daß die Legende nicht erscheint ..... ich mach ja erst seit ein paar Wochen Python. Das gravierendste Problem bei dieser Sprache scheint mir das Einrücken zu sein.....
Code: Alles auswählen
>>> from sympy import sieve
>>> from sympy import primepi
>>> from colorama import Fore
>>> import math
>>> from mpmath import *
PZuX = []
PZiiI = []
FrPL = []
uNPZ = []
bruch1=0
bruch2=0
ln1=0
ln2=0
iln1=0
iln2=0
pzgez=0
pzgezS=0
lnErg=0
duf=0
dufln=0
dufil=0
iLogErg=0
ILog = []
Ln = []
PZiD =[]
PZgez =[]
for x in range (0,130,1):
duf = int (x/15*8) #Anzahl der durch 3 und 5 teilbaren Zahlen im Intervall
frpl=(x-duf) #Anzahl Freie Plätze - Alle Zahlen 1mod3 und 2mod3, können PZ, aber auch zZ sein.
pzkx=primepi(x)-primepi(2) #PZ kleiner als x
pziiI=primepi((x+1)*(x+1))-primepi(x*x) #Anzahl PZ im interq. Intervall also zwischen x^2 und (x+1)^2
unpz=(duf)-pziiI #Anzahl zZ im interq. Intervall (gezählt mit primepi)
pzid=int(primepi((x*x)/7)-primepi(x))/2 #halbe Anzahl der PZ zwischen xQ/7 und x
PZiD.append(pzid)
PZuX.append(pzkx)
PZiiI.append(pziiI)
FrPL.append(frpl)
uNPZ.append(unpz)
for i in sieve.primerange (7,x):
bruch1 = int((math.pow(x,2))/(i)) #obere Intervallgrenze - höhere Zahl 961/7
bruch2 = int((math.pow(x,2))/(i+1)) #untere Intervallgrenze - kleinere Zahl 900 / 8
ln1=int(1/math.log(bruch1)*bruch1) #oberer Ln-Wert (Anzahl PZ im Intervall)
ln2=int(1/math.log(bruch2)*bruch2) #unterer Ln-Wert (Anzahl PZ im Intervall)
iln1=int(li(bruch1)) #oberer iL-Wert (Anzahl PZ im Intervall)
iln2=int(li(bruch2))#unterer iL-Wert (Anzahl PZ im Intervall)
pzgezS=primepi(bruch1)-primepi(bruch2)
iLogErg=iLogErg+(int(iln1-iln2)) #Grosse Teiler PZ in den Teilerbreichen. Log. integralis
lnErg=lnErg+(int(ln1-ln2)) #Grosse Teiler PZ in den Teilerbreichen. Log. naturalis
pzgez=pzgez+pzgezS
dufln=int(duf+lnErg) #duf + Ln-Abschätzung
dufil=int(duf+iLogErg) #duf + logi-Abschätzung
#print(Fore.RED,"x",Fore.BLACK,x,
#Fore.RED,"i",Fore.BLACK,i,
#Fore.RED,"bru1",Fore.BLACK,bruch1,
#Fore.RED,"bru2",Fore.BLACK,bruch2,
#Fore.RED,"Dfbr",Fore.BLUE,bruch1-bruch2,
#Fore.RED,"ln1", Fore.BLACK,ln1,
#Fore.RED,"ln2", Fore.BLACK,ln2,
#Fore.RED,"DfLn",Fore.BLUE,ln1-ln2,
#Fore.RED,"SuDLn",Fore.GREEN,LnErg,
#Fore.RED,"iln1",Fore.BLACK,iln1,
#Fore.RED,"iln2",Fore.BLACK,iln2,
#Fore.RED,"DfiL",Fore.BLUE,iln1-iln2,
#Fore.RED,"SuDiL",Fore.GREEN,iLogErg)
PZgez.append(pzgez)
ILog.append(iLogErg)
Ln.append(lnErg)
#print(ILog)
#print(Ln)
#print(Fore.RED, "x",Fore.BLACK,x,
# Fore.RED, "PZ<x",Fore.BLACK,pzkx, # PZ kleiner als x
# Fore.RED, "35zZ",Fore.BLACK,duf, # 8/15-tel - Anteil von 3 und 5
# Fore.RED, "gezPZiI.",Fore.BLACK,pziiI,
# Fore.RED, "LnErg",Fore.BLACK,lnErg, # PZ unter den oberen Teilern, ln ermittelt
# Fore.RED, "DfLngz.",Fore.BLACK,pziiI-(x-dufln),
#Fore.RED, "X-35+lnErg",Fore.BLUE,x-(dufln),
#Fore.RED, "iLogErg",Fore.BLACK,iLogErg,
#Fore.RED, "X-35+iLogErg",Fore.BLUE,x-(dufil),
#Fore.RED, "DfiLgz.",Fore.BLACK,(x-dufil)-pziiI)
pzgez=0
lnErg=0
iLogErg=0
import matplotlib.pyplot as plt
Quadrate = range(0,130)
plt.figure(figsize=(20,6), dpi=80)
plt.axis( [0,130,-10,100] )
plt.grid(True)
plt.title('Vergleich Ln & Li')
plt.xlabel('x = n')
plt.ylabel('y = Anzahl PZ unter x')
plt.legend(loc= 'upper left', frameon=True)
plt.plot(Quadrate, PZuX, color='blue', linewidth=1, linestyle='-', label=r'PZ>x')
plt.plot(Quadrate, PZiiI, color='red', linewidth=1, linestyle='-', label=r'PZ im interq. Intervall')
plt.plot(Quadrate, PZiD, color='green', linewidth=1, linestyle='-', label=r'zZ im interq. Intervall')
plt.plot(Quadrate, Ln, color='black', linewidth=1, linestyle='-', label=r'PZ in Bruch -Log. nat')
plt.plot(Quadrate, ILog, color='cyan', linewidth=1, linestyle='-', label=r'PZ in Bruch -Log. integr.')
plt.plot(Quadrate, PZgez, color='magenta', linewidth=1, linestyle='-', label=r'PZ in Schnipseln gezählt')
plt.show()