Skip to content

Instantly share code, notes, and snippets.

View nathanesau's full-sized avatar
😃

Nathan Esau nathanesau

😃
View GitHub Profile
# Sudoku Solver
# Nathan Esau
# May 27, 2015
# 6x6
import copy
strBoard1 = "216000300126000401143260000000030652"
strBoard2 = "003000400000500361601540024005000004" # can't solve yet
strBoard3 = "045160300000050621102340500216600000"
strBoard4 = "005600260000000012001060013200040053"
@nathanesau
nathanesau / assign.py
Created October 18, 2014 03:18
10/17/2014 python lab
# q5
n = input("Please enter a number: ")
msg = ""
for i in range(n):
msg = msg + str(i) + " "
print(msg)
# q6
userStr = raw_input("Please enter a string: ")
userChar = raw_input("Please enter a character: ")
@nathanesau
nathanesau / appendix.vb
Created June 23, 2014 23:56
AppendixTables.vb
Function aduex(x As Double, A As Double, B As Double, c As Double, w As Double, i As Double) As Double
aduex = (1 - Ax(x, A, B, c, w, i)) / (i / (1 + i))
End Function
Function adueselectx(x As Double, A As Double, B As Double, c As Double, w As Double, i As Double) As Double
adueselectx = (1 - Aselectx(x, A, B, c, w, i)) / (i / (1 + i))
End Function
Function adueselectxplus1(x As Double, A As Double, B As Double, c As Double, w As Double, i As Double) As Double
adueselectxplus1 = (1 - Aselectxplus1(x, A, B, c, w, i)) / (i / (1 + i))
@nathanesau
nathanesau / pension.vb
Last active August 29, 2015 14:02
Actuarial Mathematics (10.5) VBA code, REVISED
Sub PensionTable()
'Dim A As Double: A = Range("B2").Value
'Dim B As Double: B = Range("B3").Value
'Dim c As Double: c = Range("B4").Value
'Dim w As Double: w = Range("B5").Value
'Dim x As Double: x = Range("B6").Value
'Dim lx As Double: lx = Range("B7").Value
Dim A As Double: A = 0.00022
Dim B As Double: B = 2.7e-06
@nathanesau
nathanesau / pension.vb
Last active August 29, 2015 14:02
10.5 (Actuarial Mathematics for LCR - VBA code)
Sub PensionTable()
' Assume retirement age is 65
'Dim A As Double: A = Range("B2").Value
'Dim B As Double: B = Range("B3").Value
'Dim c As Double: c = Range("B4").Value
'Dim w As Double: w = Range("B5").Value
'Dim x As Double: x = Range("B6").Value
'Dim lx As Double: lx = Range("B7").Value
Dim A As Double: A = 0.00022
@nathanesau
nathanesau / proj02.py
Created June 9, 2014 02:06
assignment 2 (cmpt 120, summer 2014 SFU)
#### CMPT 120, HOMEWORK 2 ###
import math
# sum function is already defined. define sumsquares
def sumsquares(x):
total = 0
for i in range(len(x)):
total = total + x[i]*x[i]
return(total)
@nathanesau
nathanesau / assign5.c
Created March 22, 2014 22:05
assign5.C, cmpt 130
#include <stdlib.h>
#include <stdio.h>
void brute_force_test();
int is_permutation(int arr[], int n);
int* reverse(int *arr, int n);
int score(int arr[], int n);
void print(int arr[], int n);
int* make_perm(int n);
int factorial(int n);
@nathanesau
nathanesau / assign4.C
Created March 16, 2014 01:33
assign4 version 1.1
/**
* Cmpt 130, Assignment 4
*
* @author Nathan Esau (nesau@sfu.ca)
* @date 2014-03-14 21:26:18
* @version 1.1
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@nathanesau
nathanesau / assign3.C
Created March 16, 2014 01:18
assign3.C (cmpt 130)
/**
* Cmpt 130, Assignment 3
*
* @author Nathan Esau (nesau@sfu.ca)
* @date 2014-03-15 11:46:02
* @version 1.0
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@nathanesau
nathanesau / assign4.C
Created March 15, 2014 18:41
assignment 4, cmpt 130
/**
* Cmpt 130, Assignment 4
*
* @author Nathan Esau (nesau@sfu.ca)
* @date 2014-03-14 21:26:18
* @version 1.0
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>