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
package main | |
import ( | |
"fmt" | |
) | |
func Iblog(n uint) uint { | |
i := uint(0) | |
for n > 1 { | |
n = n / 2 |
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
Identification | Proper name | |
---|---|---|
14 Andromedae b | Spe | |
18 Delphini b | Arion | |
41 Lyncis b | Arkas | |
42 Draconis b | Orbitar | |
47 Ursae Majoris b | Taphao Thong | |
47 Ursae Majoris c | Taphao Kaew | |
51 Pegasi b | Dimidium | |
55 Cancri b | Galileo | |
55 Cancri c | Brahe |
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
\documentclass[12pt,a4paper]{exam} | |
\pointsmarginright | |
\begin{document} | |
\begin{questions} | |
\question | |
\part[2] | |
Show that $371 \times 83 = 30\,793$ | |
\part[1] | |
Write down the answer to $3.71 \times 0.83$ |
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 that processes a list of results, and produces a sorted league table. | |
The list of results is a pandas data frame with format | |
"Home" "Home Score" "Away" "Away Score" | |
0 "Chelsea" 4 "Man U" 2 | |
1 ... ... ... ... | |
Result is a Data frame representing the league table |
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
import math | |
#import sys | |
#import sunau | |
#import array | |
""" | |
ecc=0.5 | |
P=1 | |
p=1 | |
if len(sys.argv)>1: | |
ecc=float(sys.argv[1]) |
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
import numpy as np | |
from numpy.linalg import solve | |
import logging | |
logging.basicConfig(level = logging.DEBUG) | |
from scipy.stats import moment,norm | |
def fleishman(b, c, d): | |
"""calculate the variance, skew and kurtois of a Fleishman distribution | |
F = -c + bZ + cZ^2 + dZ^3, where Z ~ N(0,1) | |
""" |
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
#!/usr/bin/env python3 | |
from math import sin, cos, pi, sqrt, asin, log | |
sqrt2 = sqrt(2) | |
def solveNR(lat, epsilon=1e-6): | |
"""Solve the equation $2\theta\sin(2\theta)=\pi\sin(\mathrm{lat})$ | |
using Newtons method""" | |
if abs(lat) == pi / 2: |
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
#!/usr/bin/env python3 | |
"""Usage: | |
tictactoe : Play the graphical game | |
tictactoe t(ext) : play the text game, using the keypad | |
""" | |
import logging as log | |
import random, sys | |
import tkinter as tk | |
log.basicConfig(level=log.WARNING) |
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
#!/usr/bin/env python3 | |
#Use: LoveCalculator.py "Katy Perry" "Justin Bieber" | |
import sys | |
import itertools | |
def pairwise(iterable): | |
"s -> (s0,s1), (s1,s2), (s2, s3), ..." | |
a, b = itertools.tee(iterable) | |
next(b, None) | |
return zip(a, b) |
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
#Find a minecraft stronghold | |
#To find a stronghold you need an eye of ender, which you throw into the air. | |
#Make a note of your current location and the direction in which the eye goes. | |
#You can find these from the F3 debug screen. | |
#Move to a second point (it should be reasonably distant from the first) | |
#Throw the eye again and note the second point and direction. Enter | |
#the numbers below and run. It outputs the location of the stronghold. |
NewerOlder