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 matplotlib.pyplot as plt | |
%matplotlib inline | |
def collatz(x, b=False): | |
if x % 2 == 0: | |
if b: | |
print(f'{x} is even, {x}/2 = {x/2}') | |
return x / 2 | |
else: |
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 | |
import matplotlib.pyplot as plt | |
from PIL import Image | |
MAX_RANK = 100 | |
FNAME = 'bcollie.jpg' | |
image = Image.open(FNAME).convert("L") | |
img_mat = np.asarray(image) |
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
def sum_of_squared_digits(n): | |
digits = [i for i in str(n)] | |
sum = 0 | |
for digit in digits: | |
sum += int(digit)**2 | |
return sum | |
iter = 0 | |
iters = [] |
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 matplotlib.pyplot as plt | |
%matplotlib inline | |
from tqdm import trange | |
def isPalindrome(x): | |
return str(x) == str(x)[::-1] | |
def graph_number_to_iterations(): | |
lychrel = [196,295,394,493,592,689,691,788,790,879,887,978, |
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 sympy | |
import numpy as np | |
import matplotlib.pyplot as plt | |
import matplotlib.animation as ani | |
plt.style.use('dark_background') | |
def convert_to_polar_coordinates(num): | |
return num*np.cos(num), num*np.sin(num) | |