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
data IOAction a = Return a | |
| Put String (IOAction a) | |
| Get (String -> IOAction a) | |
get = Get Return | |
put s = Put s (Return ()) | |
seqio :: IOAction a -> (a -> IOAction b) -> IOAction b | |
seqio (Return a) f = f a | |
seqio (Put s io) f = Put s (seqio io f) |
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
the | |
be | |
am | |
are | |
is | |
was | |
were | |
been | |
to | |
of |
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
function em(X,theta) | |
% Expectation maximization, P coins | |
% | |
% X is TxN matrix of coin flip results (1 = heads, 0 = tails) | |
% theta is 1xP vector of probabilities (0 < theta < 1) | |
% Convergence criterion (relative difference) | |
tol = 1e-6; | |
% Compute parameters of distribution assigning coins to outputs |
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
State Winner Confidence | |
California DEM 100% | |
Connecticut DEM 100% | |
District of Columbia DEM 100% | |
Massachusetts DEM 100% | |
New York DEM 100% | |
Vermont DEM 100% | |
Maryland DEM 100% | |
Washington DEM 100% | |
Hawaii DEM 100% |
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
%Uniform distribution | |
x1 = randi(10,1000,1); | |
[n1 xout1] = hist(x1); | |
%Sum of uniform distribution | |
x2 = sum(randi(10,1000,12),2); | |
m = mean(x2); | |
s = std(x2); | |
[n2 xout2] = hist(x2); |
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
function [plate cellLocs] = simCancer(sz,pDiv,maxCells) | |
directions = [1 0; -1 0; 0 1; 0 -1]; % Possible grid directions | |
plate = zeros(sz); % Initial state of the plate | |
cellLocs = zeros(sz*sz,2); % (x,y) location of cells | |
numCells = 1; % Initial number of cells | |
generation = 1; % Initial generation |
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
{-# LANGUAGE ViewPatterns, GADTs, ScopedTypeVariables #-} | |
-- Functions to fold and unfold. We are using ViewPatterns to make the symmetry between fold and unfold explicity. | |
foldr2 :: (Either (a,b) () -> b) -> [a] -> b | |
foldr2 f [] = f $ Right () | |
foldr2 f (x:xs) = f $ Left (x, foldr2 f xs) | |
unfoldr2 :: (b -> Either (a,b) ()) -> b -> [a] | |
unfoldr2 f (f -> Right () ) = [] |
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
module Module1 where | |
import Control.Monad.Reader | |
data Config = Config { arg :: Int } | |
initialize :: IO Config | |
initialize = do | |
n <- getLine | |
return $ Config (read n) |
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
function [T Y] = relent(Tspan) | |
%% Configuration | |
leg = {'Species 1','Species 2'}; | |
opts = odeset(); | |
opts.AbsTol = 1e-8; | |
opts.RelTol = 1e-4; |
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
/********************************************************************** | |
* | |
* Customize the values given below to suit your needs. | |
* You can make additional copies of this file with | |
* different customizated settings if you need to load | |
* jsMath with different parameters. | |
* | |
* Load this page via: | |
* | |
* <SCRIPT SRC="path-to-jsMath/easy/load.js"></SCRIPT> |