
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Question
c++
please help me.

3. **Submit your code as a .cpp file and your findings as a PDF file.**
### Polynomial Evaluation
#### Conventional Algorithm
The **conventional algorithm** for evaluating a polynomial \( a_n x^n + a_{n-1} x^{n-1} + \ldots + a_1 x + a_0 \) at \( x = c \) can be expressed in pseudocode:
```plaintext
procedure polynomial(c, a_0, a_1, ..., a_n: real numbers)
power := 1
y := a_0
for i := 1 to n
power := power * c
y := y + a_i * power
return y {y = a_n c^n + a_{n-1} c^{n-1} + \ldots + a_1 c + a_0}
```
**Note:** The final value of \( y \) is the value of the polynomial at \( x = c \).
**Example (a):** Evaluate \( 3x^2 + x + 1 \) at \( x = 2 \) by working through each step of the algorithm, showing the values assigned at each assignment step.
#### Horner’s Method
This exercise involves Horner’s method. This pseudocode shows how to use this method to find the value of \( a_n x^n + a_{n-1} x^{n-1} + \ldots + a_1 x + a_0 \) at \( x = c \).
```plaintext
procedure Horner(c, a_0, a_1, a_2, ..., a_n: real numbers)
y := a_n
for i := 1 to n
y := y * c + a_{n](https://content.bartleby.com/qna-images/question/b4deeaa2-280e-4afd-b08f-ce2df53e06a4/7a3e8d7c-cfc7-419f-9ca2-038fb3465b2e/13lgonl_thumbnail.png)
Transcribed Image Text:## Exploring Polynomial Evaluation Methods
In this lab, you will explore the conventional means to evaluate a polynomial and compare its efficiency to Horner’s method (see textbook, page 242).
### Objectives
1. **Implement each method as a C++ function**
2. **Time each method against a set of test polynomials to collect some empirical data.**
- Recommend using C++’s high resolution clock, for an example see time point:
[https://www.geeksforgeeks.org/chrono-in-c/](https://www.geeksforgeeks.org/chrono-in-c/)
3. **Submit your code as a .cpp file and your findings as a PDF file.**
### Polynomial Evaluation
#### Conventional Algorithm
The **conventional algorithm** for evaluating a polynomial \( a_n x^n + a_{n-1} x^{n-1} + \ldots + a_1 x + a_0 \) at \( x = c \) can be expressed in pseudocode:
```plaintext
procedure polynomial(c, a_0, a_1, ..., a_n: real numbers)
power := 1
y := a_0
for i := 1 to n
power := power * c
y := y + a_i * power
return y {y = a_n c^n + a_{n-1} c^{n-1} + \ldots + a_1 c + a_0}
```
**Note:** The final value of \( y \) is the value of the polynomial at \( x = c \).
**Example (a):** Evaluate \( 3x^2 + x + 1 \) at \( x = 2 \) by working through each step of the algorithm, showing the values assigned at each assignment step.
#### Horner’s Method
This exercise involves Horner’s method. This pseudocode shows how to use this method to find the value of \( a_n x^n + a_{n-1} x^{n-1} + \ldots + a_1 x + a_0 \) at \( x = c \).
```plaintext
procedure Horner(c, a_0, a_1, a_2, ..., a_n: real numbers)
y := a_n
for i := 1 to n
y := y * c + a_{n
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps with 2 images

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Please give me correct solution.arrow_forwardC++ Here is the original question for what it is worth. Please do not give me an answer you found on Chegg. I have one of those accounts too. Please read carefully, I have submitted this question several times and no one could follow directtions. I have my code doing what is asked of the problem with the exception of displaying the last_name, first_name A teacher is requiring her students to line up in alphabetical order, according to their first names..For example, in one class Chapel, Christine would be at the front and Uhura, Nyota would be last. The program will get the names from a file using getline since the file name includes spaces. The names should be read in until there is no more data to read. The program should prompt the user for the file name and read the data from the file. Note that these names might include spaces; handle your input accordingly. The expected output is two names; do not show the entire file. Do not use arrays or sorting for this problem. Here is my…arrow_forwardC++, use examples of code in the answerarrow_forward
- C++ Programmingarrow_forwardonly in c++ please!arrow_forwardHello, can anyone help me with this program please? I need it in C++. I already have a bit of code that was given to me but I'm not sure how to go forward with it. Please help me. Modify the vehicle management program to allow an automobile rental company to manage its fleet of automobiles. First, define a class called CityCar that contains an array of pointers to the 100 objects in the Car class. This also allows you to store pointers to objects of the derived class types PassCar and Truck. The objects themselves will be created dynamically at runtime. Define a class CityCar with an array of pointers to the Car class and an int variable for the current number of elements in the array. The constructor will set the current number of array elements to 0. The destructor must release memory allocated dynamically for the remaining objects. Make sure that you use a virtual destructor definition in the base class Car to allow correct releasing of memory for trucks and passenger vehicles.…arrow_forward
- Create a social network, Chirper, that lets the user add new Chirps and like existing Chirps. It's lonely because only one person can add and like messages -- so there's really not much "social" about it. At least you can practice using objects, references, and function overloading in C++! Here's an example of how this program will run You can "chirp" a new message to Chirper, or "like" an existing chirp, or "exit". What do you want to do? chirp What's your message? This is my first chirp! Chirper has 1 chirps: 1. This is my first chirp! (0 likes) You can "chirp" a new message to Chirper, or "like" an existing chirp, or "exit". What do you want to do? like Which index do you want to like? 1 Chirper has 1 chirps: 1. This is my first chirp! (1 likes) You can "chirp" a new message to Chirper, or "like" an existing chirp, or "exit". What do you want to do? chirp What's your message? Second chirp is the best chirp. Chirper has 2 chirps: 1. This is my first chirp! (1 likes) 2. Second chirp…arrow_forwardPlease due in C++ If possible can explain what should I put in StudentInfo.h file what in StudentInfo.c Thank youarrow_forwardCan I please get help with this program?arrow_forward
- C++ Programming I would like to make this code like the result(photo submitted). And please let me know how I can open it on notepad. ----------------------------------------------------------------- Code: #include<iostream>#include<fstream>using namespace std;int main();int taxi_num=5; int tx1_call=0,tx1_pass=0,tx2_call=0,tx2_pass=0, // Creating global variablestx3_call=0,tx3_pass=0,tx4_call=0,tx4_pass=0,tx5_call=0,tx5_pass=0; int total_passangers=0; // Total passanger count char NeedTaxi(){if(taxi_num<1) taxi_num=5;char ans; cout<<"\n\nDo you need Taxi (Y/N) : ";cin>>ans;if(ans!='Y' && ans!='N') {cout<<"\n\nError entry !\n\n"; main();}if(ans=='N') return ans;cout<<"Taxi #"<<taxi_num<<" will pick you up in a few minutes."; if(taxi_num==5) {tx5_call++; tx5_pass+=3;} // Add 3 passangers everytime taxi 5 calledif(taxi_num==4) {tx4_call++; tx4_pass+=5;} // Add 5 passangers everytime taxi 4 calledif(taxi_num==3) {tx3_call++;…arrow_forwardPlease write the code in C and not C++. I have already attached a screenshot that has main() method declaredarrow_forwardOnly use given directions, no extra code needed. Thank you!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