martes, 30 de enero de 2024

Graficar Rosa con Coordenadas Polares con Python y Matplotlib

 

import numpy as np
import matplotlib.pyplot as plt
a = []
i = 0
alfa = 0.01
r3 = []
for i in range(0,770):
     alfa = 0.04*i
     alfa = round(alfa,2)
     a.append(alfa)
     r4 = 3*np.sin(np.pi*alfa) # cambiar np.pi por 3 para obtener 
       # una rosa de 3 petalos, por 4 para 4 petalos.
     r3.append(r4)
print(a)
ax = plt.subplot(111, projection='polar')
ax.plot(a, r3)
ax.set_rmax(3.5)
ax.set_rticks([0.5, 1, 1.5, 2, 2.5, 3, 3.5])  # less radial ticks
ax.set_rlabel_position(-22.5)  # get radial labels away from plotted line
ax.grid(True)

ax.set_title("A line plot on a polar axis", va='bottom')
plt.show()
# con np.pi se obtiene la grafica de abajo.

minuvasoft10@gmail.com Programador de Proyectos Software
download here






jueves, 25 de enero de 2024

Graficar la funcion seno en 3d con Python y Matplotlib

import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits import mplot3d
x = np.linspace(-6,6,30)
y = np.linspace(-6,6,30)
X,Y = np.meshgrid(x,y)
Z = np.sin(X)

fig = plt.figure()
ax = plt.axes(projection='3d')

ax.contour3D(X,Y,Z,50,cmap='binary')
plt.show()


lunes, 22 de enero de 2024

Graficar Resorte con Python y Matplotlib

Tener instalado la libreria matplotlib. Desde la linea de comandos o CMD digitar pip install matplotlib.

import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits import mplot3d
X = np.linspace(0,15,1000)
Y = np.cos(X)

Z = np.sin(X)

fig = plt.figure()
ax = plt.axes(projection='3d')

ax.plot3D(X,Y,Z)
plt.show()


domingo, 14 de enero de 2024

Graficar con Coordenadas Polares en Python y Matplotlib

import numpy as np
import matplotlib.pyplot as plt
a = []
i = 0
k = 0.01
for i in range(0,6):
     k = k + 3.14/4
     k = round(k,2)
     a.append(k)
r = np.arange(0, 2, 0.01)
r2 = [0.5,0.6,0.7,0.8,0.9,1]
theta = 2 * np.pi * r

ax = plt.subplot(111, projection='polar')
ax.plot(a, r2)
ax.set_rmax(2)
ax.set_rticks([0.5, 1, 1.5, 2])  # less radial ticks
ax.set_rlabel_position(-22.5)  # get radial labels away from plotted line
ax.grid(True)

ax.set_title("A line plot on a polar axis", va='bottom')
plt.show()

minuvasoft10@gmail.com 
download here



 

Hallar las raizes de Cualquier Ecuacion con Excel 365

  Se establece un intervalo de x de -20 a 20 para hallar los f(x) que cambian de signo, X aumenta en 1.   Se halla el cambio de signo de f(x...