Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

Jupyter notebook TallerQuiz1-2015-2.ipynb

40 views
Kernel: Python 2
# PUNTO 1 TALLER DE ECUACIONES DIFERENCIALES DE PRIMER ORDEN #código python para graficacion implicita: # Librerias necesarias from matplotlib.pyplot import * from numpy import * from __future__ import division %matplotlib inline # definicion de la funcion a graficar def f(x,y,c): return sqrt(1-(y/x)**2)-arctanh(sqrt(1-(y/x)**2))-log(c*x) # vectores para x y y x=linspace(0,1,500) y=linspace(-1,1,500) # construccion de malla X, Y = meshgrid(x, y) # grafica c=2 contour(X, Y, f(X, Y,c),[0],colors='b',label='C=2'); c=1 contour(X, Y, f(X, Y,c),[0],colors='r',label='C=1'); c=0.5 contour(X, Y, f(X, Y,c),[0],colors='g',label='C=0.5'); title(r'$\sqrt{1-(\frac{y}{x})^2}-atanh(\sqrt{1-(\frac{y}{x})^2})-\ln(Cx)$')
/projects/sage/sage-6.7/local/lib/python2.7/site-packages/IPython/kernel/__main__.py:13: RuntimeWarning: divide by zero encountered in true_divide /projects/sage/sage-6.7/local/lib/python2.7/site-packages/IPython/kernel/__main__.py:13: RuntimeWarning: invalid value encountered in sqrt /projects/sage/sage-6.7/local/lib/python2.7/site-packages/IPython/kernel/__main__.py:13: RuntimeWarning: divide by zero encountered in log
<matplotlib.text.Text at 0x7f5d43bbfcd0>
Image in a Jupyter notebook
# PUNTO 2 TALLER DE ECUACIONES DIFERENCIALES DE PRIMER ORDEN # definicion de la funcion a graficar def f(x,y): return -((x/y)**2)/2-x+3/2 # vectores para x y y x=linspace(-5,5,500) y=linspace(-5,5,500) # construccion de malla X, Y = meshgrid(x, y) # grafica contour(X, Y, f(X, Y),[0],colors='b'); title(r'$-(\frac{x}{y})^2-2x+3=0$')
<matplotlib.text.Text at 0x7f5d43a19350>
Image in a Jupyter notebook
# PUNTO 3 TALLER DE ECUACIONES DIFERENCIALES DE PRIMER ORDEN # Para graficar familias de curvas from __future__ import division from matplotlib.pyplot import * from numpy import * x=linspace(-4,4,500) fig, ax = subplots() for C in range(-2,2,1): y=((C+x)**2-x**2)/4 ax.plot(x,y,label="Para $C=%s$" %C) xlim(-5,10) legend(loc="best") plt.title(r'$y=\frac{(C+x)^2-x^2}{4}$') figure() fig2, ax2 = subplots() for C in range(-2,2,1): y=((C-x)**2-x**2)/4 ax2.plot(x,y,label="Para $C=%s$" %C) xlim(-5,10) legend(loc="best") title(r'$y=\frac{(C-x)^2-x^2}{4}$')
<matplotlib.text.Text at 0x7f5d43780310>
Image in a Jupyter notebook
<matplotlib.figure.Figure at 0x7f5d437a6150>
Image in a Jupyter notebook