Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The CP for many materials can be expressed by the polynomial: Cp, m = k + a T + b T 2 + c T

The CP for many materials can be expressed by the polynomial: Cp, m = k + a T + b T 2 + c T 3 (1) Write a C code to compute the thermodynamic functions molar Enthalpy (H) and Entropy (S), with an option for user to input the temperature range, the number of intervals (n) to compute the area under the curve using the Simpsons 1/3 rule, the coefficients a, b, c and constant k in the polynomial approximation of Cp. (2) Using the code developed in the previous task compute molar H and S for -ZrO2. Based on experimental observations the Cp of -ZrO2. can be written as: Cp, m = 69.62 + 7.53 10-3 T - 14.06 105 T -2 . Calculate the Enthalpy (H) and Entropy (S) for the above material using the following values: T1= 293K T2=500K n = 500. You are required to submit the following printouts: 1. Copy of your working program. 2. Flow diagram of your program. 3. Calculated Enthalpy and Entropy values for -ZrO2. using the conditions specified above. Notes: 1. You are required to mention the name of the compiler you have used to compile/run the program and also mention whether or not the program is successfully running

BACKGROUND INFORMATION What is integration? Integration is the process of measuring the area under a function plotted on a graph. Why would we want to integrate a function? Among the most common examples are finding the velocity of a body from an acceleration function, and displacement of a body from a velocity function. If we want to find out the integral value of f(x) between limits a and b, the darkened portion of the graph gives us the solution. It is basically finding the area under curve f(x) between the limits a and b. Evaluation of the expression f(x) may be difficult sometimes and to simplify the integral, a wide variety of numerical integration methods have been developed. We will be discussing Simpsons 1/3 rule of integration which gives a more accurate value when compared with other numerical integration methods. Simpsons Rule 1/3 rule: In Simpson's Rule, we use parabolas to approximate each part of the curve. This proves to be very efficient. We can show (by integrating the area under each parabola and adding these areas) that the approximate area is given by Simpson's Rule: x = (b a) / n In Simpsons rule, n must be even. Example: Let us take a simple example. Let us find out the integral of f(x) = x2 between limits 2 and 3 and number of division n = 4 using simpsons rule. f(x) = x2 b = 3 , a = 2 x = (b a) / n = (3 2) / 4 = 0.25 y0 = f(a) = f(2) = 22 = 4 y1 = f(a + x) = f(2 + 0.25) = f(2.25) = 2.252 = 5.0625 y2 = f(a + 2x) = f(2 + (2 * 0.25)) = f(2+ 0.5) = f(2.5) = 2.52 = 6.25 y3 = f(a + 3x) = f(2 + (3 * 0.25)) = f(2+ 0.75) = f(2.75) = 2.752 = 7.5625 y4 = f(b) = f(3) = 32 = 9 Therefore, = 0.25 / 3 (4 + (4* 5.0625) + (2*6.25) + (4*7.5625) + 9) = 0.25 / 3 (4 + 20.25 + 12.5 + 30.25 + 9) = 6.33333 Therefore the area under the function x2 between limits 2 and 3 is 6.33333 Sometimes when the number of intervals required is higher (of order 1000), a computer program to calculate the final answer would be easier. Lets try: C program: Let us write a C program to find out the integral value of x2 between limits 2 and 3 and number of divisions n = 4 using Simpsons 1/3 rule.

/*This is the code for integration by simpson's 1/3 rule the function considered here is x 2 */ /*The limits taken are 2 and 3 and the number of intervals being 4.*/

#include #include

#include

using namespace std;

double integration();

double integration()

{ int num_of_intervals = 4, i; double final_sum = 0, lower_limit = 2, upper_limit = 3, var, y = 1, x;

x = (upper_limit - lower_limit) /num_of_intervals; // Calculating delta x value if(num_of_intervals % 2 != 0) //Simpson's rule can be performed only on even number of intevals

{ printf("Cannot perform integration. Number of intervals should be even");

return 0; }

for(i = 0 ; i < num_of_intervals ; i++) { if(i!= 0) //Coefficients for even and odd places. Even places, it is 2 and for odd it is 4.

{ if(i % 2 == 0) y = 2; else y = 4; }

var = lower_limit + (i * x);// Calculating the function variable value final_sum = final_sum + (pow(var, 2) * y); //Calculating the sum } final_sum = (final_sum + pow(upper_limit , 2)) * x / 3; //

Final sum return final_sum; }

int main()

{ printf("The integral value of x2 between limits 2 and 3 is %lf " , integration()); system("PAUSE"); return 0; }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Building Database Driven Catalogs

Authors: Sherif Danish

1st Edition

0070153078, 978-0070153073

More Books

Students also viewed these Databases questions