Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 2

import numpy as np

import matplotlib.pylab as plt


import Taller2
Taller2.Meshdomain...
a=np.array([1.,2.,3.])
b=np.array([[1.,2.],[3.,4.],[5.,6.]])
a=np.asmatrix(a)
a=a.T
b=np.asmatrix(b)
a.shape (dimensiones)
b.shape
a.shape[0] cantidad de filas
a.shape[1] cantidad de columnas
len(b)
len(b[:,0])
a=np.arange(6)
a=np.arange(0.,10.,1.)
u=np.array([1.,2.,3.])
v=np.array([4.,5.,6.])
np.dot(u,v) producto punto de dos arreglos
b (matriz)
INVb=np.linalg.inv(b) para invertir matriz
np.linalg.det(b) determinante para ver si es invertible
_____________________________________plt.figure()
plt.plot(u,v)
plt.show
plt.figure
plt.plot(u,v,'r',lx=2) color y espesor
plt.title
plt.xlabel('eje x')
plt.ylabel('eje y')
plt.legend(('Rojo','Verde'),1)
plt.show
_________________________________________________
def MeshDomain(a,b,nx,ny) dimensiones a y b
plt.figure()
plt.plot([0.,a],[0.,0.],'k',lx=2) coordx y coordsy graficar linea
plt.plot([0.,a],[b,b],'k',lx=2)
plt.plot([0.,0.],[0.,b],'k',lx=2)

plt.plot([a,a],[0.,b],'k',lx=2)
Limites de los ejes
plt.xlim(-1.,a+1.)
plt.ylim(-1.,b+1.)
dx=np.linspace(0.,a,nx)
dy=np.linspace(0.,b,ny)
for i in np.arange(nx-1.): recorre coord x
for j in np.arange(ny-1.)
recorre coord y
plt.plot([dx[i],dx[i+1.]],[dy[j],dy[j]],'k')
plt.plot([dx[i],dx[i]],[dy[j],dy[j+1]],'k')
plt.show()

Meshdomain(4.,2.,5.,5.)

You might also like