Dados los números enteros V , T y n que representan el volumen, la temperatura y el número de moles de un gas real, la tarea es calcular la presión P del gas usando la ecuación de Van der Waal para gas real.
Ecuación de Van der Waal para gas real:
( P + a * n 2 / V 2 ) * (V – n * b) = n RT)
donde, atracción promedio entre partículas (a) = 1.360,
volumen excluido por un mol de partículas (b) = 0,03186,
constante de gas universal (R) = 8,314
Ejemplos:
Entrada: V = 5, T = 275, n = 6
Salida: 2847,64Entrada: V = 7, T = 300, n = 10
Salida: 3725,43
Enfoque: Para resolver el problema, simplemente calcule la presión P del gas real usando la ecuación P = ((n * R * T) / (V — n * b)) — (a* n * n) / (V * V) e imprimir el resultado.
A continuación se muestra la implementación del enfoque anterior:
C++
// C++ Program to implement // the above approach #include <bits/stdc++.h> using namespace std; // Function to calculate the pressure of a // real gas using Van der Wall's equation void pressure_using_vanderwall(double V, double T, double n) { double a = 1.382; double b = 0.031; double R = 8.314; // Calculating pressure double P = ((n * R * T) / (V - n * b)) - (a * n * n) / (V * V); // Print the obtained result cout << P << endl; } // Driver code int main() { double V = 7, T = 300, n = 10; pressure_using_vanderwall(V, T, n); return 0; }
Java
// Java program to implement // the above approach class GFG{ // Function to calculate the pressure of a // real gas using Van der Wall's equation public static void pressure_using_vanderwall(double V, double T, double n) { double a = 1.382; double b = 0.031; double R = 8.314; // Calculating pressure double P = ((n * R * T) / (V - n * b)) - (a * n * n) / (V * V); // Print the obtained result System.out.println(String.format("%.2f", P)); } // Driver Code public static void main(String[] args) { double V = 7, T = 300, n = 10; pressure_using_vanderwall(V, T, n); } } // This code is contributed by divyesh072019
Python3
# Python3 Program to implement # the above approach # Function to calculate the pressure of a # real gas using Van der Wall's equation def pressure_using_vanderwall(V, T, n): a = 1.382 b = 0.031 R = 8.314 # Calculating pressure P = ((n * R * T) / (V - n * b)) - (a * n * n) / (V * V) # Print the obtained result print(round(P, 2)) # Driver code V, T, n = 7, 300, 10 pressure_using_vanderwall(V, T, n) # This code is contributed by divyeshrabadiya07
C#
// C# program to implement // the above approach using System; class GFG{ // Function to calculate the pressure of a // real gas using Van der Wall's equation public static void pressure_using_vanderwall(double V, double T, double n) { double a = 1.382; double b = 0.031; double R = 8.314; // Calculating pressure double P = ((n * R * T) / (V - n * b)) - (a * n * n) / (V * V); // Print the obtained result Console.WriteLine(Math.Round(P, 2)); } // Driver Code public static void Main(String[] args) { double V = 7, T = 300, n = 10; pressure_using_vanderwall(V, T, n); } } // This code is contributed by AnkitRai01
Javascript
<script> // Javascript program to implement the above approach // Function to calculate the pressure of a // real gas using Van der Wall's equation function pressure_using_vanderwall(V, T, n) { let a = 1.382; let b = 0.031; let R = 8.314; // Calculating pressure let P = ((n * R * T) / (V - n * b)) - (a * n * n) / (V * V); // Print the obtained result document.write(P.toFixed(2)); } let V = 7, T = 300, n = 10; pressure_using_vanderwall(V, T, n); // This code is contributed by decode2207. </script>
3725.43
Tiempo Complejidad: O(1)
Espacio Auxiliar: O(1)
Publicación traducida automáticamente
Artículo escrito por deepakkumar737373 y traducido por Barcelona Geeks. The original can be accessed here. Licence: CCBY-SA