Last active
August 29, 2015 14:03
-
-
Save martynchamberlin/0454e7fe9e80ee4386c7 to your computer and use it in GitHub Desktop.
Calculates the mathematical probability of ecological validity of a given experiment, where the Y axis is the percentage of probability and each data point in the graph is a new independent variable being introduced to the experiment. As more independent variables are introduced, the accuracy exponentially diminishes. Needless to say, you need t…
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
// Playground - noun: a place where people can play | |
import Cocoa | |
var i: Int = 0 | |
func power(#x :Int, #y :Int) -> Int { | |
if(y == 0) { | |
return 1; | |
} | |
return (x * power( x:x, y:y-1) ); | |
} | |
for i in 0..20 | |
{ | |
var j: Int = power( x:2, y:i) - 1 | |
var k = Double(j) | |
100 / k // this is the line for which you'll want to view the graph | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment