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
%Limpiamos la pantalla y mostramos el nombre del método | |
clear | |
clc | |
disp('Método de Newton Raphson modificado') | |
%Damos de alta la variable simbólica X | |
syms x | |
%Introducimos la función,el punto de inicio,así como | |
%porcentaje de error | |
f=input('Introduzca la función f(x):'); | |
pi=input('Introduzca el punto de inicio:'); |
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
%Limpiamos la pantalla y mostramos el nombre del método | |
clear | |
clc | |
disp('Método de Newton Raphson') | |
%Damos de alta la variable simbólica X | |
syms x | |
%Introducimos la función,el punto de inicio,así como | |
%porcentaje de error | |
f=input('Introduzca la función f(x):'); | |
pi=input('Introduzca el punto de inicio:'); |
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
#Intervalo inferior | |
a=10 | |
#Intervalo superior | |
b=454657 | |
#Contador para la cantidad de capicuas | |
c=0 | |
print("Los capicuas encontrados son los siguientes:") | |
for i in range(a,b+1): | |
num_s=str(i) | |
num_list=list(num_s) |
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 cv2 | |
import sys | |
imagePath = sys.argv[1] | |
cascPath = "haarcascade_frontalface_default.xml" | |
faceCascade = cv2.CascadeClassifier(cascPath) | |
image = cv2.imread('iron_maiden.jpg') | |
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) | |
faces = faceCascade.detectMultiScale( | |
gray, | |
scaleFactor=1.1, |
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
# Importamos la librería Sympy | |
import sympy | |
# Importamos el módulo de latex | |
sympy.init_printing(use_latex='mathjax') | |
# Damos de alta la variable simbólica x, y la función Y | |
x = sympy.Symbol('x') | |
y = sympy.Function('y') | |
#Expresamos la ecuacion |
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
# Importamos la librería SymPy, así como el módulo de LaTeX | |
from sympy import * | |
init_printing(use_latex='mathjax') | |
# importamos el módulo para hacer divisiones | |
from __future__ import division | |
# Damos de alta la variable simbólica X | |
x= symbols('x') | |
# Expresemos la función a integrar | |
y=exp(1)**-x/sqrt(x) | |
y |
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 re | |
from collections import Counter | |
def words(text): return re.findall(r'\w+', text.lower()) | |
WORDS = Counter(words(open('big.txt').read())) | |
def P(word, N=sum(WORDS.values())): | |
"Probability of `word`." | |
return WORDS[word] / N |
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 re, collections | |
def words(text): return re.findall('[a-z]+', text.lower()) | |
def train(features): | |
model = collections.defaultdict(lambda: 1) | |
for f in features: | |
model[f] += 1 | |
return model | |
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 re, collections | |
def words(text): return re.findall('[a-z]+', text.lower()) | |
def train(features): | |
model = collections.defaultdict(lambda: 1) | |
for f in features: | |
model[f] += 1 | |
return model | |
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
from mpl_toolkits.mplot3d import Axes3D | |
from matplotlib import cm | |
from matplotlib.colors import LogNorm | |
import matplotlib.pyplot as plt | |
import numpy as np | |
fig = plt.figure() | |
ax = Axes3D(fig, azim = -29, elev = 49) | |
X = np.arange(-6, 6, 0.1) | |
Y = np.arange(-6, 6, 0.1) |
OlderNewer