Código
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
from sys import argv | |
import math | |
def logisticMap(L, ntg, maxVal): | |
generation = L * ntg * (maxVal - ntg) | |
return generation | |
def main(): | |
L = float(argv[1]) | |
numGenerations = int(argv[2]) | |
generation = int(argv[3]) | |
maxVal = int(argv[4]) | |
myFile = open('data.dat', 'w') | |
for i in range(numGenerations): | |
generation = logisticMap(L, generation, maxVal) | |
print '%d - %d'%(i, generation) | |
myFile.write(str(i) + ' ' + str(generation) + '\n') | |
myFile.close() | |
if(__name__) == '__main__': | |
main() |
GNUPLOT
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set term png | |
set output "logisticMap.png" | |
set key outside Right | |
set size 2, 1.5 | |
set pointsize 2 | |
plot "data.dat" with lines |
Comando
python logisticMap.py 0.000039 100 1000 100000
gnuplot logisticMap.plot
convert -flatten data.eps data.png