Question

For Questions below. write computer code in any programming language or mathematical software to estimate dz using the given

Please Write in C programming Language

0 0
Add a comment Improve this question Transcribed image text
Answer #1

`Hey,

Note: Brother in case of any queries, just comment in box I would be very happy to assist all your queries

#include<stdio.h>
#include<math.h>
// A sample function whose definite integral's
// approximate value is computed using Trapezoidal
// rule
float y(float x)
{
// Declaring the function f(x) = 1/(1+x*x)
return (1.0/ sqrt(x*x -4.0));
}

// Function to evalute the value of integral
float trapezoidal(float a, float b, float n)
{
// Grid spacing
float h = (b-a)/n;
int i;
// Computing sum of first and last terms
// in above formula
float s = y(a)+y(b);

// Adding middle terms in above formula
for ( i = 1; i < n; i++)
s += 2*y(a+i*h);

// h/2 indicates (b-a)/2n. Multiplying h/2
// with s.
return (h/2)*s;
}

// Driver program to test above function
int main()
{
// Range of definite integral
float x0 = 3;
float xn = 5;

// Number of grids. Higher value means
// more accuracy
int n = 6;
float I=trapezoidal(x0, xn, n);
printf("Approximation is %f\nAbsolute Error is %f\nRelative error is %f\n",I,fabs(I-0.6044),fabs(I-0.6044)/0.6044);

return 0;
}

FAcheckimain.exe Approximation is 0.686364 Absolute Error is 0.001964 Relative error is θ.ee3249 Process returned θ (8x8) exe

Kindly revert for any queries

Thanks.

Add a comment
Know the answer?
Add Answer to:
Please Write in C programming Language For Questions below. write computer code in any programming language or mathematical software to estimate dz using the given method. Then calculate the absol...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Please Solve in C programming. Please Use “ f(x) = e^(-x^2) “ for thus question. Thank You

    Please Solve in C programming. Please Use “ f(x) = e^(-x^2) “ for thus question. Thank You rite computer code in any programming language or mathematical software to estimate he following derivatives. Then calculate the absolute and relative errors for each: I, f"(1.5) for f(z) in Question 3 above using the three-point formula. Use h 0.5 rite computer code in any programming language or mathematical software to estimate he following derivatives. Then calculate the absolute and relative errors for each:...

  • Show work by hand and also using MATLAB code. Model 1 Given a polynomial f(x) Write a first-order approximation of f(x), given the value of f(x) at two points Plot the polynomial and the first-or...

    Show work by hand and also using MATLAB code. Model 1 Given a polynomial f(x) Write a first-order approximation of f(x), given the value of f(x) at two points Plot the polynomial and the first-order approximation on a graph Write a second-order approximation of f(x), given the value at three points. Plot the polynomial, the first-order and second-order approximations on a graph Find the integral Exactly Using trapezoidal rule Using composite trapezoidal rule Using Simpson's 1/3 rule . Calculate the...

  • This is for programming using Python with the JES software. Please write the code with the...

    This is for programming using Python with the JES software. Please write the code with the proper indentation. Thanks! Problem 1: Write a function that takes 2 arguments (integer or float) and computes the sum, difference, product, and quotient of the arguments. Once you calculate the values you should print out statements telling the user what arguments we used to compute the values and what the result of each calculation (your function should produce 5 lines of output in the...

  • In Java programming language Please write code for the 6 methods below: Assume that Student class...

    In Java programming language Please write code for the 6 methods below: Assume that Student class has name, age, gpa, and major, constructor to initialize all data, method toString() to return string reresentation of student objects, getter methods to get age, major, and gpa, setter method to set age to given input, and method isHonors that returns boolean value true for honors students and false otherwise. 1) Write a method that accepts an array of student objects, and n, the...

  • Write computer code that performs the Simplex Method of Linear Programming to determine the optim...

    matlab code*** Write computer code that performs the Simplex Method of Linear Programming to determine the optimal solution of the following problem statement. A manufacturer makes three types of plastic fixtures. The time in hours required for molding, trimming, and packaging of each fixture is given in the table below. | Type Y | Type Z 1.5 | Total Time Available Process Molding Trimming Packaging Profit per Fixture $11 Type X 2/3 2/3 1/3 $16 12000 4600 2400 0.5 For...

  • Please solve the questions using R language and attach the script with it!!! zoom it if...

    Please solve the questions using R language and attach the script with it!!! zoom it if the picture is not clear. Please solve the questions using R language and attach the script with it!!! Please solve the questions using R language and attach the script with it!!! What is the probability that a penny I have will land "heads" when tossed? To analyze this question I randomly toss the coin, n=3901 times. On x = 2500 of these tosses, the...

  • Using C++ language, write a code to implement the "evaluate function" described below using the given...

    Using C++ language, write a code to implement the "evaluate function" described below using the given poly.cpp file and poly.h header file. (ignore the other 3 functions if asked) poly.cpp file: poly.h header file: You are asked to implement four functions for a data structure used to store polynomials. The data structure used for polynomials is a linked list that consists of terms where each term consists of a coefficient, an exponent and a pointer to the next term. A...

  • The questions below deal with Microsoft Visual Studio 2012 Reloaded, under the Visual Basic programming language....

    The questions below deal with Microsoft Visual Studio 2012 Reloaded, under the Visual Basic programming language. The book ISBN number that I am using is: 978-1-285-08416-9 or the UPC code is: 2-901285084168-1. Question 1 Visual Basic 2012 is an object-oriented programming language, which is a language that allows the programmer to use ____________________ to accomplish a program�s goal. Question 2 An application that has a Web user interface and runs on a server is called a(n) ____________________ application. Question 3...

  • WRITE A CODE USING C PROGRAMMING LANGUAGE: PSUT planning to organize a Football champion by eight...

    WRITE A CODE USING C PROGRAMMING LANGUAGE: PSUT planning to organize a Football champion by eight teams where the first round has two groups and then the best two of then continue to the next round until we achieve the champion. A) The each round you will create a 2D array and you will use Random algorithm to determine the winner (the function still running until finding the best two teams) 0 lost 1 Drawn 2 win B) Then you...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT