Skip to content

Instantly share code, notes, and snippets.

View angellicadearaujo's full-sized avatar
🏠
Working from home

Angéllica de Araujo angellicadearaujo

🏠
Working from home
View GitHub Profile
@angellicadearaujo
angellicadearaujo / Install PIP to user site on macOS.md
Created January 14, 2021 18:49 — forked from haircut/Install PIP to user site on macOS.md
How to install and use pip without sudo or admin on macOS

Install and use pip on macOS without sudo / admin access

Most recently tested on macOS Sierra (10.12.6)

  1. Download the installation script; curl https://bootstrap.pypa.io/get-pip.py -o ~/Downloads/get-pip.py
  2. Run the installation, appending the --user flag; python ~/Downloads/get-pip.py --user. pip will be installed to ~/Library/Python/2.7/bin/pip
  3. Make sure ~/Library/Python/2.7/bin is in your $PATH. For bash users, edit the PATH= line in ~/.bashrc to append the local Python path; ie. PATH=$PATH:~/Library/Python/2.7/bin. Apply the changes, source ~/.bashrc.
  4. Use pip! Remember to append --user when installing modules; ie. pip install <package_name> --user

Note

import time
''' Simplex method '''
# Funcao objetivo na ultima linha
def Simplex(A, nonBasicMap):
EPSILON = 0.0001
m = len(A) # Linhas
@angellicadearaujo
angellicadearaujo / chole.js
Created March 20, 2017 04:57
Cholesky algorithm JavaScript Vanilla version
function transpose(A) {
var B = [];
var l = A.length;
var c = A[0].length;
var i;
if (Object.prototype.toString.call(c)==="[object Undefined]") {
// A is a vector
@angellicadearaujo
angellicadearaujo / simplex.py
Created February 26, 2017 03:30
SIMPLEX method Linear Programming
''' Simplex method '''
# Funcao objetivo na ultima linha
def Simplex(A):
EPSILON = 0.0001
m = len(A) # Linhas
n = len(A[0]) # Colunas
from array import *
import math
def produtoMatVet(A, v):
n=len(A)
s=array('f', [0 for i in range(n)])
for i in range(n): #linhas
for j in range(len(A[i])): #colunas
s[i] += A[i][j] * v[j]
import math
# @description Multiplies a matrix by a vector (one column matrix)
def multiply(A, x):
m=len(A)
n=len(x)
y=[0 for i in range(m)]
for i in range(m):
@angellicadearaujo
angellicadearaujo / Arnoldi.py
Created November 7, 2016 12:15
Algoritmo de Arnoldi
def Arnoldi(A,b):
n=len(A)
# Build S set
q=[[] for j in range(n+1)]
S=[[] for j in range(n+1)]
q[0]=b
for i in range(n):
@angellicadearaujo
angellicadearaujo / MinimoQuadradoLinear.py
Created November 7, 2016 12:00
Mínimos quadrados para equações lineares
def MinimoQuadrado(h,e):
n=len(h)
sh=0
se=0
shh=0
she=0
m=0
b=0
from array import *
import numpy as np
import math
def protudoMatVet(A, v):
n=len(A)
s=array('f', [0 for i in range(n)])
for i in range(n): #linhas
@angellicadearaujo
angellicadearaujo / PRECONDGMRES.py
Created October 24, 2016 13:40
GMRS condicionado
import math
# @description Multiplies a matrix by a vector (one column matrix)
def multiply(A, x):
m=len(A)
n=len(x)
y=[0 for i in range(m)]
for i in range(m):