In [1]:
"Hello World!"
Out[1]:
In [2]:
lista = ["Raul", "Ezequiel"]
In [5]:
for name in lista:
print("hello ", name)
In [1]:
class Switcher(object):
def numbers_to_methods_to_strings(self, argument):
"""Dispatch method"""
# prefix the method_name with 'number_' because method names
# cannot begin with an integer.
method_name = 'number_' + str(argument)
# Get the method from 'self'. Default to a lambda.
method = getattr(self, method_name, lambda: "nothing")
# Call the method as we return it
return method()
def number_0(self):
return "zero"
def number_1(self):
return "one"
def number_2(self):
return "two"
In [2]:
switcher = Switcher()
In [7]:
switcher.numbers_to_methods_to_strings(0)
Out[7]:
In [1]:
import numpy as np
In [2]:
neurons = np.random.random((10, 5))
In [3]:
patr = np.random.random((1, 5))
In [4]:
distances = np.linalg.norm(neurons - patr, axis=1)
In [5]:
closest = distances.argmin()
In [2]:
from sympy import *
In [4]:
init_printing()
In [5]:
x, y, z = symbols('x y z')
Integral(sqrt(1/x), x)
Out[5]:
In [12]:
expr = x**3 + 3*x**2*y + 3*x*y**2 + y**3
expr
Out[12]:
In [15]:
factors = factor(expr)
factors
Out[15]:
In [16]:
expand(factors)
Out[16]:
In [22]:
derivada = Derivative(expr, x)
derivada
Out[22]:
In [23]:
derivada.doit()
Out[23]:
In [27]:
integral = Integral(derivada.doit(), x)
integral
Out[27]:
In [28]:
integral.doit()
Out[28]:
In [29]:
x = Symbol('x')
Limit(1/x, x, S.Infinity)
Out[29]:
In [30]:
Limit(1/x, x, S.Infinity).doit()
Out[30]:
In [32]:
Limit(1/x, x, 0, dir='-')
Out[32]:
In [1]:
for x in range(41, 51):
print('%d == %02d%02d when x=%d' % (x ** 2, x - 25, (50 - x) ** 2, x))
In [24]:
f = Function('f')
F = Function('F')
x, y, u= symbols('x y u')
In [5]:
eq = -2*f(x,y).diff(x) + 4*f(x,y).diff(y) + 5*f(x,y) - exp(x + 3*y)
eq
Out[5]:
In [6]:
pdsolve(eq)
Out[6]:
In [7]:
classify_pde(eq)
Out[7]:
In [37]:
u = f(x, y)
ux = u.diff(x)
uy = u.diff(y)
eq = exp(2*x)*(u.diff(y)) + y*u - u
eq
Out[37]:
In [15]:
sol = pdsolve(eq)
sol
Out[15]:
In [16]:
eq = Eq(1 + (2*(ux/u)) + (3*(uy/u)))
eq
Out[16]:
In [18]:
sol = pdsolve(eq)
sol
Out[18]:
In [20]:
eq = (3*x - 2*y)*exp(-2*x/13 - 3*y/13)
eq
Out[20]:
In [21]:
eq = x*(u.diff(x)) - y*(u.diff(y)) + y**2*u - y**2
eq
Out[21]:
In [34]:
sol = pdsolve(eq)
sol
Out[34]:
In [32]:
Eq(f(x, y), F(x*y)*exp(y**2/2) + 1)
Out[32]:
In [35]:
sol == Eq(f(x, y), F(x*y)*exp(y**2/2) + 1)
Out[35]:
In [38]:
eq = y*x**2*u + y*u.diff(x) + u.diff(y)
eq
Out[38]:
In [40]:
sol = pdsolve(eq)
sol
Out[40]:
In [41]:
Eq(f(x, y), F(-2*x + y**2)*exp(-x**3/3))
Out[41]:
In [43]:
f = -2*x + y**2
diff(f, y)
Out[43]:
In [ ]: