Skip to content

Instantly share code, notes, and snippets.

View RobertTalbert's full-sized avatar

Robert Talbert RobertTalbert

View GitHub Profile
# Libraries
library(dplyr)
library(tidyverse)
library(ggplot2)
# Load data
colnames <- c("time", "email", "name", "section",
"challenge", "support",
"competence", "autonomy", "relatedness",
aliases

(insert tags here)

Definition

[!tldr] Definition Contents

# Use basic logic commands to "fake" set operations.
# Here's union:
U = [1,2,3,4,5,6,7,8,9,10]
A = [1,2,3,4,5,6]
B = [2,4,6]
# A union B
[x for x in U if ((x in A) or (x in B))]
# Recursive functions for MTH 225 9/25/2023
# Input is a positive integer
def A(n):
if n == 1:
return n
else:
return n + A(n-1)
# Input is a positive integer
@RobertTalbert
RobertTalbert / collatz.py
Created August 28, 2023 13:54
Python code for exploring the Collatz conjecture
# Individual Collatz computation
def f(n):
if n % 2 == 0:
return n//2
else:
return 3*n+1
# Create sequence of integers from the Collatz function
# This assumes the Collatz conjecture is true LOL
def collatz(n):
  1. Generosity: Give wealth, time, and attention when and where others can be well served by it.
  2. Charity: Look out not only for your own interests, but also the interests of others.
  3. Leadership: Build your influence and use it to make a positive difference.
  4. Balance: Live as a whole person with a multifaceted, multidimensional life.
  5. Health: Build and maintain your physical, emotional, and spiritual self.
  6. Curiosity: Seek out and pursue interesting things and never stop learning.
  7. Adventure: Take risks, seek out new experiences, and pursue growth without fear.
  8. Humor: Keep perspective, don't take yourself too seriously, and have fun.
  9. Persistence: Honor your commitments, finish what you start, and don't give up.
  10. Faith: Love God with all your heart, sould, mind, and strength -- and respond to Him with trust.

Weekly Review

Get clear

  • Weekly wipedown
  • Collect loose items and get into physical inbox
  • Inbox Zero
    • Physical inbox
    • Personal Gmail
    • Work email - Outlook
from sympy import *
def niceEigs(e1,e2):
M = Matrix([[e1,0],[0,e2]])
P = randMatrix(2,2,-3,3)
while P.det() == 0:
# Change the -3 and 3 if you want more variety in the entries
P = randMatrix(2,2,-3,3)
return P*M*P.inv()
# Function to create a random nxn upper triangular matrix
def randUT(n,lower,upper):
A = randMatrix(n,n,lower,upper)
for j in range(n-1):
for i in range(j+1,n):
A[i,j] = 0
return A
# Code to test this out
A = randUT(5,-10,10)