Skip to content

Instantly share code, notes, and snippets.

#include <iostream>
#include <cmath>
#include <string>
#include <fstream>
#include <vector>
#include <algorithm>
const int grid = 50;
const double dx = 1.0 / grid;
const double dy = dx;
# Quasi-1D nozzle with HLL and nonequilibrium vibration of N2
# R.Deiterding Dec. 2016
# Modified by Matthew Beckett 2017
import numpy as np
import time
import math as m
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit
from scipy.fftpack import fft, ifft
from scipy import signal
import math
# GLOBAL CONSTANTS #
g = 9.80011
import matplotlib.pyplot as plt
# SPACECRAFT PARAMETERS #
m = 10.0 # kg
# SPACECRAFT PID PARAMETERS #
kp_thrust = 0.8
ki_thrust = 0.1
kp_vel = 0.5
from newspaper import Article
url = u'http://fox13now.com/2013/12/30/new-year-new-laws-obamacare-pot-guns-and-drones/'
article = Article(url)
article.download()
article.parse()
a = article.text.encode("ascii", "ignore")
b = a.replace("\n", " ")
import numpy as np
import matplotlib.pyplot as plt
import math
num_steps = 150000
G = 6.67e-11 # N m2 / kg2
m_e = 5.97e24 # kg
m_m = 7.35e22 # kg
total_time = 27.32 * 24 * 3600 # s
#include <avr/io.h>
#include <avr/interrupt.h>
#include <string.h>
#define USART_BAUDRATE 9600
//#define BAUD_PRESCALE ((((F_CPU / 16) + (USART_BAUDRATE / 2) / (USART_BAUDRATE))-1)
#define BAUD_PRESCALE 104
static volatile char rxbuff[100]; // to fill from USART
#include <avr/io.h>
int main(void){
unsigned int PIN = 5;
TCCR1B |= ((1 << CS10) | (1 << CS12));
DDRB |= (1 << PIN); // enable LED pin in DDRB register
#include <avr/io.h>
#include <avr/interrupt.h>
#define USART_BAUDRATE 9600
//#define BAUD_PRESCALE ((((F_CPU / 16) + (USART_BAUDRATE / 2) / (USART_BAUDRATE))-1)
#define BAUD_PRESCALE 104
void initialise_UART(void)
{
# simple plotter for particles speed distribution example
import matplotlib.pyplot as plt
import numpy as np
fob = open("Boltzmann.txt", "r")
v_freq_string = fob.read()
fob.close()
v_freq = []