Skip to content

Instantly share code, notes, and snippets.

View CodeDrome's full-sized avatar

Chris Webb CodeDrome

View GitHub Profile
@CodeDrome
CodeDrome / squarerootcalculationsdemo.py
Created September 9, 2022 11:54
squarerootcalculationsdemo.py
import math
import numpy as np
import squarerootcalculations as src
import squarerootplot as srp
def main():
@CodeDrome
CodeDrome / squarerootcalculations.py
Created September 9, 2022 11:51
squarerootcalculations.py
import math
import numpy as np
import squarerootestimates as sre
def babylonian_array(radicands, iterations):
estimates = sre.linear_2(radicands)
@CodeDrome
CodeDrome / squarerootestimatesdemo.py
Created September 5, 2022 12:59
squarerootestimatesdemo.py
import math
import numpy as np
import squarerootestimates as sre
import squarerootplot as srp
def main():
@CodeDrome
CodeDrome / squarerootplot.py
Created September 5, 2022 12:57
squarerootplot.py
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
def plot(valuerange, sqrts=None):
matplotlib.pyplot.figure(figsize=(10,8), facecolor="#FFFFFF")
plt.title('Square Roots in Python ')
@CodeDrome
CodeDrome / squarerootestimates.py
Created September 5, 2022 12:56
squarerootestimates.py
import numpy as np
def _nparray_to_sci_not(radicands):
exponents = np.log10(radicands).astype(int)
significands = radicands / 10**exponents
return {"significands": significands, "exponents": exponents}
@CodeDrome
CodeDrome / siunits.py
Created August 16, 2022 11:26
siunits.py
import sibaseunit as sibu
def main():
print("----------------------")
print("| codedrome.com |")
print("| SI Units in Python |")
print("| Part 1: Base Units |")
print("----------------------\n")
@CodeDrome
CodeDrome / sibaseunit.py
Created August 16, 2022 11:21
sibaseunit.py
from types import MappingProxyType
class SIBaseUnit(object):
"""
The SIBaseUnit class provides properties for
representing values of the 7 SI base units,
multiplier prefixes such as kilo and nano,
methods for string representation,
@CodeDrome
CodeDrome / setdemo.py
Created August 13, 2022 12:20
setdemo.py
import setutilities as su
def main():
print("-----------------")
print("| codedrome.com |")
print("| Set Demo |")
print("-----------------\n")
@CodeDrome
CodeDrome / setutilities.py
Created August 13, 2022 12:19
setutilities.py
from types import MappingProxyType
symbols = MappingProxyType({ "emptySet": "∅",
"union": "∪",
"intersection": "∩",
"is_element_of": "∈",
"is_not_element_of": "∉",
"is_subset_of": "⊆",
"is_proper_subset_of": "⊂",
@CodeDrome
CodeDrome / jumbledtextdemo.py
Created August 11, 2022 12:14
jumbledtextdemo.py
import textjumbler
def main():
print("------------------")
print("| codedrome.com |")
print("| Jumbled Text |")
print("------------------\n")