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
`> sort( round(sapply( split( HX, HX$course_id ), function(x) sum(x$viewed) / sum(x$registered) *100 )), decreasing=T)` | |
Programming | |
77 | |
Mechanical Engineering | |
71 | |
Structural Engineering | |
68 | |
E&M | |
67 | |
Computer Science |
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
http://math.ucr.edu/home/baez/photon/tensor.htm: | |
<blockquote>Both direct sum and tensor product are standard ways of <b>putting together little Hilbert spaces to form big ones.</b> They are used for different purposes. Suppose we have two physical systems.... Roughly speaking, if ... a physical system's ... states are either of A OR of B, its Hilbert space will be [a] direct sum.... If we have a system whose states are states of A AND states of B, its Hilbert space will be [a] tensor product.... | |
<pre> | |
<b>MEASURE SPACE</b> disjoint union Cartesian product | |
<b>HILBERT SPACE</b> direct sum tensor product | |
</pre> | |
</blockquote> |
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
require File.expand_path(File.dirname(__FILE__) + '/neo') | |
require 'pry' | |
# Greed is a dice game where you roll up to five dice to accumulate | |
# points. The following "score" function will be used to calculate the | |
# score of a single roll of the dice. | |
# | |
# A greed roll is scored as follows: | |
# | |
# * A set of three ones is 1000 points |
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
taste <- function(soup, ladle=5L) sample.int(x=soup, size=ladle, replace=TRUE) | |
peek <- function(df,n=5L) df[ taste(nrow(df),n) , ] #dataframe[r,c] means "subset of dataframe row #r, column #c" | |
p <- function(df,n=5L) rbind(head(df,1L), peek(df,n), tail(df,1L)) | |
#SAMPLE OUTPUT | |
require(bigvis) | |
data(movies) |
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
#with expm | |
require(expm) | |
matrix( c(0,1,1,1), 2,2 ) -> fibonacci | |
c(1L,1L) -> start | |
start %*% (fibonacci %*% 1337) #1337'th term-pair in Fibonacci series | |
# [,1] [,2] | |
#[1,] 1.887894e+279 3.054677e+279 |
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
fb = function(n) { | |
f = "" | |
b = "" | |
if (!n %%3) f="fizz" | |
if (!n %%5) b="buzz" | |
print(paste0(f,b)) | |
} |
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
" RATIONALE: | |
" _ is used all the time in programming | |
" - is only used for "minus −" operator | |
" chords hurt my hands | |
" I avoid naming things with _ because it hurts | |
" I don't mind hitting <SHIFT> for "minus" | |
" because it's an operator | |
" and therefore requires more thought than | |
" "spacebar in a variable name". |
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
"360852405690179584","","","2013-07-26 20:01:32 +0000","<a href=""http://www.floodgap.com/software/ttytter/"" rel=""nofollow"">TTYtter</a>","Define ""clear"" Mogadishu: http://t.co/fr4NwFlMq2","","","","http://downloads.bbc.co.uk/podcasts/radio4/thpop/thpop_20130723-1000b.mp3" | |
"334368922310676480","","","2013-05-14 18:05:38 +0000","<a href=""http://www.floodgap.com/software/ttytter/"" rel=""nofollow"">TTYtter</a>","Romans & medieval Xtians both thought women were sexually insatiable. So where did ""Lie back and think of your country"" come from? #radio4","","","","" | |
"334365448063823873","","","2013-05-14 17:51:49 +0000","<a href=""http://www.floodgap.com/software/ttytter/"" rel=""nofollow"">TTYtter</a>","Only within the last 200 years that a European city has overtaken the size (1mm people) of Juvenalian Rome. #radio4","","","","" | |
"334359389601419265","","","2013-05-14 17:27:45 +0000","<a href=""http://www.floodgap.com/software/ttytter/"" rel=""nofollow"">TTYtter</a>","ancient Romans slipping Greek into 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
library(colorout) | |
# The function takes numeric vectors of at most three elements each. | |
# The three numbers indicate, respectively, formating, background | |
# color and foreground color. If a vector has only one element, the | |
# number will be used to set the foreground color; if it has two | |
# elements, they will be used to set the background and foreground | |
# colors. | |
# | |
# The table below shows valid values and their meanings as both |
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
#run convenience functions first.... | |
plat <- function(space,FUN,cex=2,chroma=45,a=66,b=4,c=3){ #a,b,c are tuning parameters | |
func=FUN(space) #eval for speedup | |
coleur=arg(func)%%360 | |
light=a+b*mod(func)+c*l(coleur) | |
plot(space, pch=46,cex=cex, col=hcl( h=coleur, c=chroma, l=light ) ) | |
} | |
#what this function does, is plot a boring series of points with nothing on them, | |
# moving the REAL ACTION to the colour parameter. |