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
import numpy as np | |
from pylab import * | |
raw = np.array([ | |
[0, 0.0], | |
[0.15708, 0.156313], | |
[0.314159, 0.308879], | |
[0.471239, 0.453952], | |
[0.628319, 0.587785], | |
[0.785398, 0.706871], |
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
#lang r5rs | |
(define amb-fail '*) | |
(define initialize-amb-fail | |
(lambda () | |
(set! amb-fail | |
(lambda () | |
(display "amb tree exhausted"))))) | |
(initialize-amb-fail) |
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
;;;;;;;;;; | |
(load "amb.ss") | |
;(define (debug e) #f) | |
(define debug | |
(lambda (e) | |
(cond ((list? e) | |
(for-each display e)) | |
((string? e) | |
(display e))))) |
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
#lang racket | |
;;; 以下三个定义 env0, ent-env, lookup 是对环境(environment)的基本操作: | |
;; 空环境 | |
(define env0 '()) | |
;; 扩展。对环境 env 进行扩展,把 x 映射到 v,得到一个新的环境 | |
(define ext-env | |
(lambda (x v env) | |
(cons `(,x . ,v) env))) |
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
#lang racket | |
; applicative-order Y-combinator. | |
; Y: The function that takes a function f and returns f (f (f (f (···)))) | |
(define Y | |
(lambda (le) | |
((lambda (f) (f f)) | |
(lambda (f) | |
(le (lambda (x) ((f f) x))))))) | |
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
#include <iostream> | |
#include <cstdio> | |
#include <map> | |
#include <algorithm> | |
using namespace std; | |
// 双射函数 | |
// proven : | |
// as |
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
#include <vector> | |
#include <iostream> | |
#include "d:/workspace/dxh/testUlt.h" | |
using namespace std; | |
//计算二项式系数C(n,k) | |
int Binomial(int n, int k) { | |
int result[n + 1][k + 1]; | |
for(int i = 0; i <= n; ++i) //按行来填矩阵 | |
{ |
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
# -*- coding:UTF-8 -*- | |
#!/usr/bin/env python | |
''' | |
Clear the directory using filter | |
''' | |
import os.path | |
import sys,os | |
import stat | |
import re |
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
Fibonacci f(n+1)=f(n)+f(n-1) n >= 1 | |
1. sum(f(n)^2) = f(n)*f(n+1) | |
证明如下,面积之和相等 | |
# 绘图代码如下 | |
import matplotlib.pyplot as plt | |
from matplotlib.path import Path | |
import matplotlib.patches as patches |
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
Show hidden characters
{ | |
"cmd": ["g++", "-std=c++1y", "${file}", "-O2", "-Wall", "-o", "${file_path}/${file_base_name}"], // For GCC On Windows and Linux | |
//"cmd": ["CL", "/Fo${file_base_name}", "/O2", "${file}"], // For CL on Windows Only | |
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$", | |
"working_dir": "${file_path}", | |
"selector": "source.c, source.c++", | |
"variants": | |
[ | |
{ |
OlderNewer