This file contains hidden or 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
let normal zz = | |
let p = 0.2316419 | |
let b = [0.31938153;-0.356563782;1.781477937;-1.821255978;1.330274428] | |
let f = 1.0/(sqrt (2.0*3.1415926)) | |
let abszz = abs zz | |
let ff = f*(exp((-(abszz**2.0)/2.0))) | |
let sfunc e b = b/((1.0+p*abszz)**e) | |
let sfunclist = List.init 6 (fun x->(sfunc (float x))) | |
let s = List.init 5 (fun x->List.nth sfunclist (x+1) (List.nth b x)) | |
let sz = ff * (List.sum s) |
This file contains hidden or 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
let list_sum ls = List.fold_left (fun a x->a+.x) 0.0 ls | |
let list_init c f = Array.to_list (Array.init c (fun x->f x)) | |
let normal zz = | |
match zz with | |
|v when v = 0.0 -> 0.5 | |
|v when v >= 6.0 -> 1.0 | |
|v when v <= -6.0 -> 0.0 | |
|v -> | |
let p = 0.2316419 in |
This file contains hidden or 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
(define new-pi 3.1415926) | |
(define days-in-year 365) | |
(define (sqrt-t days-to-expiration) | |
(sqrt (/ days-to-expiration days-in-year))) | |
(define (normal-dist zz) | |
(if (= zz 0) 0.5 | |
[let ((p 0.2316419) (b1 0.31938153) (b2 -0.356563782) |
This file contains hidden or 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 <stdio.h> | |
#define BUFFER_SIZE 2 | |
enum FLAGS {NONE, SLASH, COMMENT1, COMMENTM, QUOTE1, QUOTE2, COMMENTM_STAR}; | |
char buffer[BUFFER_SIZE]; | |
int buff_pointer = 0; | |
void flush(char buff[]); | |
int state = NONE; | |
char t; |
This file contains hidden or 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 <stdio.h> | |
#include <stdlib.h> | |
double stack[100]; | |
char buffer[100]; | |
int isDot(char); | |
int handle(char); | |
int ptr=0; | |
int bufptr=0; |
This file contains hidden or 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
class Circuit: | |
"""Base class for modeling circuits""" | |
_type="Circuit" | |
def __init__(self,a,b): | |
self.set(a,b) | |
def __repr__(self): | |
return str(self) | |
def cond(self, e, r1, r2): | |
if e: | |
return r1 |
This file contains hidden or 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
var SlideChanger = function(seconds_each) { | |
var index = -1; | |
// on the first cycle, index will be set to zero below | |
var maxindex = ($(".change_link").length) - 1; | |
// how many total slides are there (count the slide buttons) | |
var timer = function() { | |
// this is the function returned by SlideChanger | |
var logic = function() { | |
// this is an inner function which uses the | |
// enclosed values (index and maxindex) to cycle through the slides |
This file contains hidden or 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
/* | |
* jalert jQuery JavaScript Plugin v0.0.1 | |
* | |
* Copyright 2010, Eric Christensen | |
* | |
* Permission to use, copy, modify, and distribute this software and its | |
* documentation for any purpose and without fee is hereby granted, provided | |
* that the above copyright notice appear in all copies and that both that | |
* copyright notice and this permission notice appear in supporting | |
* documentation, and that the name of the copyright holder not be used in |
This file contains hidden or 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 <stdlib.h> | |
#include <stdio.h> | |
#include "ll.h" | |
LL *createlist(int item) | |
{ | |
LL *it = malloc(sizeof(LL)); | |
it->val = item; | |
printf("creating new LL@%p whose value is %d\n", it, item); | |
return it; |
This file contains hidden or 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
var callback = function(msg) { | |
alert(msg); | |
} | |
var funcList = []; | |
var vals = ['do', 're', 'mi']; | |
for(var m in vals) { | |
funcList[m] = function() { | |
callback(m); |