CAN YOU EXPLAIN IN DETAIL THE DIFFERENCES BETWEEN THIS 2 CODING
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
CAN YOU EXPLAIN IN DETAIL THE DIFFERENCES BETWEEN THIS 2 CODING

Transcribed Image Text:#include<iostream>
#include<cmath>
3
#include<conio.h>
#define f(x) pow(x,2)*sin(x)*(exp(pow(x,2)))
using namespace std;
int main()
int N;
float delx,simps,trape;
const float Pi=3.142;
10
11
12
cout<<"Enter the only N(5,10,20,40) : ";
cin>>N;
cout<«"This program will integrate the function, \n\n\t f=(x^2)*(sin(x))*(exp(x^2)) over x(0,Pi)\n\nUsing Simpson's and trapezoidal rules : ";
cout<<"\n\n";
13
14
15
16
17
18
delx = (Pi-e)/N;
19
20
for(int i=@;i<N;i++)
21 É
22
trape +=
(delx/2)*(f(i*delx)+f((i+1)*(delx)));
23
24
for (int x-e;x<(N-3);x=x+2)
{
simps += (delx/3)*(f(x*delx)+4*f((x+1)*delx)+f((x+2)*delx));
25
26 E
27
28
29
cout<<"The trapezoidal Produces an integral value of "<trape<<" for "<<N<<" subsections."<<endl;
cout<<"The simpson's Produces an integral value of "<«simps<<" for "<<N<<" subsections."<<endl;
30
31
32
33
return e;
34

Transcribed Image Text:#include<iostream>
#includecmath>
#includecconio.h>
#define f(x) pow(x,2)*sin(x}*(exp(pow(x,2)}}
using namespace std;
void calculate_simps(int N , float a, float simps)
11
12
13
14
15 E
16
17
18
const float Pi=3.142;
a - (Pi-8)/N;
for (int x-8jx<(N-3)jX=X+2)
simps += (a/3)*(f(x*a)+4*f((x+1)*a)+f((x+2)*a));
cout<«"The simpson's Produces an integral value of "<«simps<<" for "<<N<<" subsections. "<<endl;
20
21
int main ()
23
24
float aj
int Nj
flual simpsj
cuutss"Enter the unly N(5,10,20,40) : ";
cin>Nj
cout<<"This program will integrate the function; \n\n\t_f=(x^2)*(sin(x))*(exp(x^2)) over x(0;Pi)\n\nUsing Simpson's rules : "i
cout<<"\n\n";
27
28
29
31
32
calculate_simps(N,a, simps);
return ej}
34
Expert Solution

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

Recommended textbooks for you

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education

Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY