Computer Systems: A Programmer's Perspective (3rd Edition)
3rd Edition
ISBN: 9780134092669
Author: Bryant, Randal E. Bryant, David R. O'Hallaron, David R., Randal E.; O'Hallaron, Bryant/O'hallaron
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question
Chapter 5, Problem 5.18HW
Program Plan Intro
Given C Code:
double poly(double a[], double x, long degree)
{
long i;
double result = a[0];
double xpwr = x;
for (i = 1; i <= degree; i++)
{
result += a[i] * xpwr;
xpwr = x * xpwr;
}
return result;
}
double polyh(double a[], double x, long degree)
{
long i;
double result = a[degree];
for(i=degree-1; i>=0; i--)
result = a[i] + x*result;
return result;
}
Cycles per element (CPE):
- The CPE denotes performance of program that helps in improving code.
- It helps to understand detailed level loop performance for an iterative program.
- It is appropriate for programs that use a repetitive computation.
- The processor’s activity sequencing is controlled by a clock that provides regular signal of some frequency.
Loop unrolling:
- It denotes a program transformation that would reduce count of iterations for a loop.
- It increases count of elements computed in each iteration.
- It reduces number of operations that is not dependent to program directly.
- It reduces count of operations in critical paths of overall computations.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
5. Consider the trisection method, which is analogous to bisection except that at
each iteration, it creates 3 intervals instead of 2 and keeps one interval where there
is a sign change.
(c) The main computational cost of bisection and trisection is function evalu-
ations. The other operations it does are a few additions and divisions, but
the evaluation of most functions, including sin, cos, exp, etc. are much more
costly. Based on this information, explain why you would never want to use
trisection over bisection.
Write a user-defined MatLab function I=Simp38(FunName,a,b) using the composite Simpson's 3/8 method. FunName is a handle function that calculates the value of the function to be integrated, a and b are the limits of integration and I is the value of the integral. The function should calculate the value of the integral in iterations. In the first iteration the interval [a,b] is divided in two subintervals and in every iterations that follows the number of subintervals should be doubled. Stop the iterations when the difference in the value between two successive iterations is smaller than 1%.
Create a limit evaluation problem that requires substitution with an answer of 1. Please show the steps to solve the problem.
Chapter 5 Solutions
Computer Systems: A Programmer's Perspective (3rd Edition)
Knowledge Booster
Similar questions
- My apologies for misunderstanding. Here's the translation: "A function, f:f(x,y)=x2+2y2−12x+xy is defined on the domain: Ω = {(x, y): -1 ≤ x ≤ 1, -1 ≤ y ≤ x}. Create a contour plot of the function and plot the boundary of Ω with a dashed line: In Pythonarrow_forward3. Develop a user-defined MatLab function | Comptrapez (FunName, a,b) of integrating a function by using the composite trapezoidal method. FunName is a handle function that calculates the value of the function to be integrated, a and b are the limits of integration and I is the value of the integral. The function should calculate the value of the integral in iterations. In the first iteration the interval [a,b] is divided in two subintervals and in every iterations that follows the number of subintervals should be doubled. Stop the iterations when the difference in the value between two successive iterations is smaller than 1% 4. Repeat exactly the same process described in question 3 to write a user-defined Matlab function l=Simp38(FunName, a,b) using the composite Simpson's 3/8 method. The only MatLab build-in function you are allowed to use is: sum.arrow_forward3. Develop a user-defined MatLab function | Comptrapez (FunName, a,b) of integrating a function by using the composite trapezoidal method. FunName is a handle function that calculates the value of the function to be integrated, a and b are the limits of integration and I is the value of the integral. The function should calculate the value of the integral in iterations. In the first iteration the interval [a,b] is divided in two subintervals and in every iterations that follows the number of subintervals should be doubled. Stop the iterations when the difference in the value between two successive iterations is smaller than 1%. The only MatLab build-in function you are allowed to use is: sumarrow_forward
- You are to create a well-formed Python recursive function (i.e, there must be a stopping/base case and the recursive case must present a smaller problem), along with a call to that function. You will then trace that function, showing how memory is used and provide any and all output. You then need to present a relationship, whose domain is some subset of the integers. Finally, you need to provide a prove that the relationship holds over the entire domain by using a detailed Mathematical Induction prove.arrow_forwardGive at least ten (10) examples of diverse circumstances to which you can relate as a function. We request that you abstain from duplicating the Google answer.arrow_forward1)Write a computer program for Gauss elimination method using C programming language. Decide the number of significant figures yourselves. While writing your program, consider the effects of the number of significant figures, pivoting, scaling and do not forget to check if the system is ill conditioned.2)Repeat the same procedures for Gauss-Jordan method.3)Solve an example system using your Gauss elimination and Gauss-Jordan method. Measure the time your computer solves the system for both programs.4)Write a report in which you discuss and compare your Gauss elimination and Gauss-Jordan programs. Upload you report and two code files to the DYS system.arrow_forward
- Restructure Newton's method (Case Study: Approximating Square Roots) by decomposing it into three cooperating functions. The newton function can use either the recursive strategy of Project 2 or the iterative strategy of the Approximating Square Roots Case Study. The task of testing for the limit is assigned to a function named limitReached, whereas the task of computing a new approximation is assigned to a function named improveEstimate. Each function expects the relevant arguments and returns an appropriate value. An example of the program input and output is shown below: Enter a positive number or enter/return to quit: 2 The program's estimate is 1.4142135623746899 Python's estimate is 1.4142135623730951 Enter a positive number or enter/return to quitarrow_forward1)Write a computer program for Gauss elimination method using C programming language. Decide the number of significant figures yourselves. While writing your program, consider the effects of the number of significant figures, pivoting, scaling and do not forget to check if the system is ill conditioned.2)Repeat the same procedures for Gauss-Jordan method.3)Solve an example system using your Gauss elimination and Gauss-Jordan method. Measure the time your computer solves the system for both programs.4)Write a report in which you discuss and compare your Gauss elimination and Gauss-Jordan programs.arrow_forwardGive a complete problem formulation for each of the following problems. Choose a formulation that is precise enough to be implemented. d. A container ship is in port, loaded high with containers. There 13 rows of containers, each 13 containers wide and 5 containers tall. You control a crane that can move to any location above the ship, pick up the container under it, and move it onto the dock. You want the ship unloaded.arrow_forward
- Create a MATLAB code that solves roots of non-linear equations using False-Position Method. The code should have the following features: Nonlinear function can be declared directly on the MLX file Accepts 2 initial limits of interval (bracketing values xu and xl) and the error tolerance Check if the initial limits of the interval has opposing function values. Check if the initial limits of the interval are roots of the inputted function. Displays the iteration table. (For more information, watch the Week 3 Lecture Video: ALTERNATIVE CODING FOR BISECTION METHOD ). Gives the following output values: approximate root, percent approximate relative error, number of iterations required to meet the condition (percent approximate relative error < error tolerance). Gives a non-convergence message when the condition (percent approximate relative error < error tolerance) is not met after 150 iterations.arrow_forwardDevelop a user-defined MatLab function I =Comptrapez(FunName,a,b) of integrating afunction by using the composite trapezoidal method. FunName is a handle function that calculates the value of the function to be integrated, a and b are the limits of integration and I is the value of the integral. The function should calculate the value of the integral in iterations. In the first iteration the interval [a,b] is divided in two subintervals and in every iterations that follows the number of subintervals should be doubled. Stop the iterations when the difference in the value between two successive iterations is smaller than 1%. Thank you very mucharrow_forwardMy Solutions > My first FUNCTION problem Get started with: [STANDARD ASSESSMENT] This example uses a simple problem to demonstrate how to create a MATLAB coding problem where the student solution must be a function. Only the values returned by the function can be assessed in function problem types. This problem type can introduce confusion to students not yet comfortable writing their own functions, Step 1: Use this area to set up the problem and describe the task(s) the student solution will be assessed on. For example: Two commonly used scales for measuring temperature are Fahrenheit and Celsius. In this course we will often want to convert temperature in degrees Fahrenheit to degrees Celsius. Create a function called tempF2C that will accept as input a single temperature in degrees Fahrenheit and return the equivalent temperature in degrees Celsius. Recall that Fahrenheit and Celsius are related by the following equation: Tc (T-32)/1.8 Step 2: Select "Function" Problem Type below…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education