Loading [MathJax]/extensions/TeX/AMSsymbols.js

jueves, 29 de marzo de 2012

[MSDS] Mapa de Logística. Puntos Extra

Código



#!/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()
view raw gistfile1.py hosted with ❤ by GitHub

GNUPLOT



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

Resultado Pagina Web





Resultado Código





Referencias