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
import math, tabulate | |
def factorial(x): | |
pi = math.pi | |
e = math.exp(1) | |
exponent = -x + pi ** e / (e ** (2 * pi) * x) + \ | |
pi ** e / (e ** (2 * pi) * x + 2 * pi ** e) | |
return x ** x * math.sqrt(2 * pi * x) * math.exp(exponent) | |
if __name__ == '__main__': |
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
╒═════╤════════════════╤═════════════════════╕ | |
│ x │ factorial(x) │ math.factorial(x) │ | |
╞═════╪════════════════╪═════════════════════╡ | |
│ 1 │ 0.999575 │ 1 │ | |
├─────┼────────────────┼─────────────────────┤ | |
│ 2 │ 1.99951 │ 2 │ | |
├─────┼────────────────┼─────────────────────┤ | |
│ 3 │ 5.99942 │ 6 │ | |
├─────┼────────────────┼─────────────────────┤ | |
│ 4 │ 23.9991 │ 24 │ |
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
// Create a 2D array for the grid | |
int[][] grid; | |
// each cell is 4x4 pixel | |
int cellSize = 4; | |
// the whole grid is 125x125 cells | |
int gridSize = 125; | |
int cellStartX = 0; | |
int cellStartY = 0; | |
// enumerate directions |
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
#! /usr/bin/octave -qf | |
pkg load signal | |
% read the file name | |
fprintf('\n\nInitializing equalizer ...\n'); | |
% setting default values for Equalizer | |
Equalizer.type = 'Custom'; | |
Equalizer.amps = [7 7 2 0.25 0]; | |
Equalizer.freqs = [100 500 1000 5000 10000]; |
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 ATree: | |
"Aggregator Tree Data Structure" | |
def __init__(self): | |
self.count = 0 | |
self.children = {} | |
def __repr__(self): | |
return "<ATree: %d\n\t%s>" \ | |
% ((self.count, self.children)) \ | |
if self.children else "<ATree: %d>" \ |
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
module Main where | |
-- x -> number whose sqrt has to be found | |
-- y -> approximate guessed sqrt of x | |
mysqrt x y = let z = x + y ^ 2 | |
in z / (4 * y) + x * y / z | |
main = do | |
-- lets compute sqrt(10) with guess=3 | |
putStr "Actual Value: " |
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
CTGCCGCAAGCCGATCGGAGATCGCAGGTGAGAACCGCAG | |
TAATTGGTCTAGGTGGGAGCGACGCCATACCTCTACGGCA | |
CACACACACTCGTTTGATATTCCTAGGTGCGCGTTCTTCC | |
TACAGACATCGTGTGAGATATGTACCCACATTCAAAGAAA | |
ACTAGATCAAGTTGCTTGACCCGCTGGAGACGGGCCTGGT |
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
Block of size=15 is | |
CACCACCTTGTGGAG | |
ATree as dict: | |
╒═════════╤═════════╕ | |
│ chunk │ count │ | |
╞═════════╪═════════╡ | |
│ │ 15 │ | |
├─────────┼─────────┤ | |
│ A │ 3 │ | |
├─────────┼─────────┤ |
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
PFont font; | |
void setup(){ | |
background(0); | |
size(500,500); | |
noLoop(); | |
// you can find this file in my LangtonAnt project | |
// at https://github.com/Mizzlr/LangtonAnt | |
// place FreeMonoBold.ttf in a directory named data | |
// under the Parent directory recursivePi |
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
Actual value of pi: 3.141592653589793 | |
Product expansion upto n terms: | |
1 --> 2.82842712474619 | |
2 --> 3.0614674589207183 | |
3 --> 3.1214451522580524 | |
4 --> 3.1365484905459393 | |
5 --> 3.140331156954753 | |
10 --> 3.1415914215112 | |
100 --> 3.141592653589797 |
OlderNewer