This file contains hidden or 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 win32evtlog | |
import win32evtlogutil | |
import win32con | |
import winerror | |
import time | |
import sys | |
import traceback | |
from os.path import exists | |
from pandas import read_csv | |
from matplotlib import pyplot as plt |
This file contains hidden or 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
from matplotlib import pyplot as plt | |
from numpy.random import random | |
from numpy import linspace, log | |
%matplotlib inline | |
x = linspace(0.01, 2, 40) | |
rand_list = (random(len(x))-0.5) | |
y = log(x-1e-3) + rand_list | |
y2 = log(x+1e-2*8) + rand_list | |
x_mid, y_mid = x[int(len(x)/2)], y[int(len(x)/2)] | |
x_low, y_low = x[3], y[3] |
This file contains hidden or 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 | |
from numpy import finfo, array, sqrt | |
def y(x): | |
return x**3 + 4 * x**2 - 10 | |
max_it = 100 | |
tol = finfo(float).eps | |
alpha = 1e-4 | |
y_list = [] |
This file contains hidden or 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 | |
from matplotlib import patches | |
from matplotlib.collections import LineCollection | |
from numpy import finfo, array, sqrt, isnan, concatenate, sin, exp | |
def secant_ls_3p(y, x_0, tol, max_it=100): | |
x_k = x_0 | |
y_k = y(x_k) | |
g_k = 1 / 2 * y_k**2 |
This file contains hidden or 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
from numpy import array, exp, real, imag, empty, finfo | |
# Ref. Press, William H., et al. "Numerical recipes in C++." The art of scientific computing 2 (2007): 1002. | |
def zroots(a, polish=False): | |
eps = 1.0e-14 # a small number | |
m = len(a)-1 | |
roots = empty(len(a)-1, dtype=complex) | |
# copy coefficients for successful deflation | |
ad = a.copy() |
This file contains hidden or 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
#include<complex> | |
#include<vector> | |
#include<limits> | |
using namespace std; | |
typedef complex<double> Complex; | |
//typedef const vector<complex<double>> VecComplex_I; | |
typedef vector<complex<double>> VecComplex_I; | |
typedef vector<complex<double>> VecComplex, VecComplex_O; |
This file contains hidden or 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
from numpy import array, ones | |
from numpy.linalg import inv | |
import matplotlib.pyplot as plt | |
# Ref. E. L Cussler - Diffusion mass transfer in fluid systems 2009 | |
m = array([14]) | |
text_data = """ | |
0 14.0153 |
This file contains hidden or 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
from numpy import array, lexsort, pi, cos, arccos, log10, complex | |
def solve_cubic(abcd): | |
""" solve cubic polynomial - Tartaglia-Cardano | |
ref. Polyanin, Manzhirov Handbook of Mathematics for engineers | |
and scientists | |
a*x^3+b*x^2+c*x+d=0 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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
from numpy import array, linspace, exp, zeros, diff | |
from scipy.integrate import odeint, ode | |
from matplotlib import pyplot as plt | |
import ctypes # Needed to set the app icon correctly | |
r1, r2, r3 = [0.33, 1, -0.33] | |
d21 = d12 = d23 = d32 = 1e-5 # m^2/s | |
d13 = d31 = 1/10 * d12 | |
y0 = [0.3, 0.7, 0] |