0

I was solving a problem in which I needed to graphic this:

r = (16442.21*(((np.e**(-10468.04/T))*(P1.5))/((2-X)**1.5))*(((1-X)**2.5)/X))-17374.99*(((np.e(-23855.06/T))(Fo0.2)((2-X)**0.5))/(P0.5))*(X/((1-X)**1.3))

The graphic that I needed was X(T), and the curves represents the values of T and X for which the parametre r has the same value. So I made the plot from the implicit equation, usin this code:

#Librerías
from __future__ import division
import numpy as np
import matplotlib.pyplot as plt

#Ingreso de datos
P=float(input("Ingrese la presión de trabajo en atmosferas: "))
Fo=float(input("Ingrese el flujo inicial de moles de nitrógeno, en kmol/d: "))

#Definición de la función de manera implícita
def f(T,X,r):
    return (16442.21*(((np.e**(-10468.04/T))*(P**1.5))/((2-X)**1.5))*(((1-X)**2.5)/X))-17374.99*(((np.e**(-23855.06/T))*(Fo**0.2)*((2-X)**0.5))/(P**0.5))*(X/((1-X)**1.3))-r

#Definición de vectores T y X    
T=np.linspace(10,2000,500)
X=np.linspace(0.0001,0.9999,500)

#Pasaje a matriz
T,X=np.meshgrid(T,X)


#Gráfico
r=0.000001
hola=plt.contour(T,X,f(T,X,r),[0],colors='g',label='r=0.000001')

r=0.001
plt.contour(T,X,f(T,X,r),[0],colors='b',label='r=0.001')

r=0.002
plt.contour(T,X,f(T,X,r),[0],colors='m',label='r=0.002')

r=0.005
plt.contour(T,X,f(T,X,r),[0],colors='y',label='r=0.005')

r=0.01
plt.contour(T,X,f(T,X,r),[0],colors='k',label='r=0.01')

r=0.02
plt.contour(T,X,f(T,X,r),[0],colors='r',label='r=0.02')

r=0.05
plt.contour(T,X,f(T,X,r),[0],colors='g',label='r=0.05')

r=0.1
plt.contour(T,X,f(T,X,r),[0],colors='c',label='r=0.1')

r=0.2
plt.contour(T,X,f(T,X,r),[0],colors='b',label='r=0.2')

r=0.5
plt.contour(T,X,f(T,X,r),[0],colors='m',label='r=0.5')

r=1
plt.contour(T,X,f(T,X,r),[0],colors='y',label='r=1')

plt.xlabel('Temperatura [K]')
plt.ylabel('Conversión')
plt.title('Curvas de isovelocidad a presión constante')

plt.show()

This was the result:

https://i.stack.imgur.com/5ugDZ.png

The problem is that I need to maximize each curve, and I don't know how to do it because I can't find the data of the graphic, so I can't make a fitting or something like that.

Do you know another way to maximize that?

0 Answers0