惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Microsoft Security Blog
Microsoft Security Blog
博客园 - 聂微东
aimingoo的专栏
aimingoo的专栏
J
Java Code Geeks
腾讯CDC
大猫的无限游戏
大猫的无限游戏
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Google DeepMind News
Google DeepMind News
博客园_首页
F
Fortinet All Blogs
小众软件
小众软件
Apple Machine Learning Research
Apple Machine Learning Research
H
Help Net Security
博客园 - 【当耐特】
量子位
博客园 - 叶小钗
M
MIT News - Artificial intelligence
酷 壳 – CoolShell
酷 壳 – CoolShell
月光博客
月光博客
MyScale Blog
MyScale Blog
爱范儿
爱范儿
The Cloudflare Blog
N
Netflix TechBlog - Medium
T
Tailwind CSS Blog

K.I.S.S

身在 Kimi 的 800 天 写在 Kimi K2 发布之后:再也不仅仅是 ChatBot macOS 按域名切换 DNS 解析 | K.I.S.S 为什么说 GPT 是无损压缩 | K.I.S.S 握着你的手训一个类GPT语言模型 (二) | K.I.S.S 握着你的手训一个类GPT语言模型 (一) | K.I.S.S Rosetta in Linux Virtual Machine on Apple Silicon Fit an Overfit with MegEngine 把 CUPS 扔进 docker 里 ASUS Chromebook Flip | K.I.S.S GPG 与 SSH Agent 转发 使用 dnsmasq 和 ipset 的策略路由 YubiKey 4 简介与配置 | K.I.S.S 定制GH60机械键盘 | K.I.S.S Debian 网络安装内核参数 | K.I.S.S 我的 Vim 配置 | K.I.S.S Libinput 与 Udev | K.I.S.S 给妹子看的 Arch Linux 桌面日常安装 | K.I.S.S 修复GTK3 CSD外观 | K.I.S.S 握着你的手教你画哀女王 | K.I.S.S R.I.P Google Reader | K.I.S.S Richard Stallman仍然是对的 | K.I.S.S Scala 自定义控制结构 | K.I.S.S 入手Wacom Bamboo CTL470 | K.I.S.S 转个型? | K.I.S.S Wish List | K.I.S.S pulseaudio音量问题 | K.I.S.S 入手yubikey,一点小心得 | K.I.S.S 迁移到Octopress | K.I.S.S 自动更新DNSPod记录 | K.I.S.S
Python 调用gnuplot的例子 | K.I.S.S
2010-11-26 · via K.I.S.S

最近和lvzongting一块儿做一些仿真,不想用matlab了,原因有:

  • 商业软件,用破解版毕竟不好

  • 难以实现分布式计算和并行计算

  • 太慢 考虑之下决定用可爱的Python,因为

  • God,it’s so simple!

  • 完善的类库,数学功能不亚于matlab

  • 比matlab通用,再也不需要“一切都是矩阵”了

  • 灵活

  • 自由,开源

为了实现 网络变型的仿真,先做一个框架,也算为python练练手

#!/usr/bin/env python
import numpy
import Gnuplot, Gnuplot.funcutils
import matplotlib.pyplot as pl
import time
import sys

def lzt_1(num,x):

    x=numpy.random.randint(0,100,[num,2])

    return x

def lzt(num,x):               #all the array of x
 
    xx=numpy.random.randint(-1,2,[num,2])
    #print xx
    x=x+xx
    
    return x

if __name__=='__main__':
    #the part of init #
    g = Gnuplot.Gnuplot(debug=1) #init of gnuplot

    #print sys.argv[1]
    step=10                      #default step is 10
    if len(sys.argv) > 1:
        step=int(sys.argv[1])    #first argv is step of simulation
    num=100                      #default num is 100
    if len(sys.argv) > 2:      
        num=int(sys.argv[2])     #second argv is step of simulation
    range_x_min=[-10,-10]
    range_x_max=[110,110]        #rang of simulation default is 100*100
    x=numpy.random.randint(0,100,[num,2])       #print x

    for i in range(0,step):      
        print i
        #the part of iterative #
        x=lzt(num,x)             #the function of controling the node
        #the part of plot #
        y=x.tolist()             #change to list in order to plot
        y.append(range_x_min)    #add de range point
        y.append(range_x_max)
        g.plot(y)                #point
        #raw_input('Please press return to continue...\n')
        time.sleep(0.1)

就是这样,程序没有什么实际意义,也没啥算法,几个类库的调用,一个仿真的框架而已。