mation Method (LRAM) Right Rectangular Approximation

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Write a Python program that would solve for the definite integral of a given function using integral approximations.

 

Choose only one method from the following Integral Approximation Methods:

  1. Left rectangular Approximation Method (LRAM)
  2. Right Rectangular Approximation Method (RRAM)
  3. Midpoint Rectangular Approximation Method (MRAM)
  4. Trapezoidal Rule

 

Program Specification:

1.Your program should display the function to be integrated (Function of x, [(x)]. The function could be pre-defined in the program user-defined (ask from the user.) You may use algebraic function or transcendental functions.

2.User dx = 0.05 for the width of the slices along x

3.Ask the user for Lower Limit and Upper Limit

4.Display the iterations in tabular form

5.Display the answer of the definite integral

 

This is a sample output below

The function is f (x) = 2x+3 (2)
Width is 0.05
Enter Lower Limit: 1
Enter Upper Limit: 2
Iteration: 1.0
Function
Lower Limit
Upper Limit
LRAM Application (width=0.05)
Answer
f (x) = 2x+3 (2)
x=1.00
x=1.05
f (x) = (2 (1.0) +3 (2))
* 0.05
0.4
Iteration: 2.0
Function
Lower Limit
Upper Limit
LRAM Application (width=0.05)
Answer
f (x) = 2x+3 (2)
x=1.05
x=1.10
f(x)
= (2 (1.05) +3 (2)) * 0.05
0.405
Iteration: 3.0
Function
Lower Limit
Upper Limit
LRAM Application (width=0.05)
Answer
f(x) = 2x+3 (2)
x=1.10
x=1.15
E(x) = (2 (1.1)+3 (2)) * 0.05
0.41
Iteration: 4.0
Function
Lower Limit
Upper Limit
LRAM Application (width=0.05)
Answer
f(x) = 2x+3 (2)
x=1.15
x=1.20
f(x) = (2 (1.15000000o00000001) +3 (2))
* 0.05
0.41500000000000004
Iteration: 5.0
Function
Lower Limit
Upper Limit
LRAM Application (width=0.05)
Answer
f (x) = 2x+3 (2)
x=1.20
x=1.25
f (x)
= (2 (1.2000000000000002) +3 (2))
* 0.05
0.42000000000000004
Iteration: 6.0
Function
Lower Limit
Upper Limit
LRAM Application (width=0.05)
Answer
f (x) = 2x+3 (2)
x=1.25
x=1.30
f(x)
(2 (1.250o00000000o0002) +3 (2))
0.05
0.42500000000000004
Iteration: 7.0
Function
Lower Limit
Upper Limit
LRAM Application (width=0.05)
Answer
f (x) = 2x+3 (2)
x=1.30
x=1.35
f (x) = (2 (1.3000000000000003) +3 (2))
0.05
0.4300000o00000001
Iteration: 8.0
Function
Lower Limit
Upper Limit
LRAM Application (width=0.05)
Answer
f (x) = 2x+3 (2)
x=1.35
x=1.40
f (x) = (2 (1.3500000000000003) +3 (2))
0.05
0.43500000000000005
Iteration: 9.0
Function
Lower Limit
Upper Limit
LRAM Application (width=0.05)
Answer
f (x) = 2x+3 (2)
x=1.40
x=1.45
f (x) = (2 (1.4000000000000004) +3 (2))
0.05
0.44000000000000006
Iteration: 10.0
Function
Lower Limit
Upper Limit
LRAM Application (width=0.05)
Answer
f (x) = 2x+3 (2)
x=1.45
x=1.50
f(x) = (2 (1.4500000000000004) +3 (2))
0.05
0.44500000000000006
Iteration: 11.0
Function
Lower Limit
Upper Limit
LRAM Application (width=0.05)
Answer
f (x) = 2x+3 (2)
x=1.50
x=1.55
f (x)
(2 (1.5000000000000004) +3 (2))
0.05
0.45
%3D
Iteration: 12.0
Function
Lower Limit
Upper Limit
LRAM Application (width=0.05)
Answer
f (x) = 2x+3 (2)
x=1.55
x=1.€0
f(x) = (2 (1.5500000000000005) +3 (2))
* 0.05
0.45500000000000007
Iteration: 13.0
Function
Lower Limit
Upper Limit
LRAM Application (width=0.05)
Answer
f (x) = 2x+3 (2)
x=1.60
x=1.65
f (x) = (2 (1.6000000000000005) +3 (2))
* 0.05
0.4600000000000001
Iteration: 14.0
Function
Lower Limit
Upper Limit
LRAM Application (width=0.05)
Answer
:
f (x) = 2x+3 (2)
x=1.65
x=1.70
f (x)
= (2 (1.650000000o000006) +3 (2))
* 0.05
0.46500000000000001
Iteration: 15.0
Function
Lower Limit
Upper Limit
LRAM Application (width=0.05)
Answer
f (x) = 2x+3 (2)
x=1.70
x=1.75
f (x) = (2 (1.7000000000000006) +3 (2))
* 0.05
0.47000000000000014
Iteration: 16.0
Function
Lower Limit
Upper Limit
LRAM Application (width=0.05)
Answer
f (x) = 2x+3 (2)
x=1.75
x=1.80
f (x)
= (2 (1.7500000000000007) +3 (2))
* 0.05
0.4750000000000001
Iteration: 17.0
Function
Lower Limit
Upper Limit
LRAM Application (width=0.05)
Answer
f (x) = 2x+3 (2)
x=1.80
x=1.85
f (x) = (2 (1.8000000000000007)+3 (2)) * 0.05
0.4800000000000001
Iteration: 18.0
Function
Lower Limit
Upper Limit
LRAM Application (width=0.05)
Answer
f (x) = 2x+3 (2)
x=1.85
x=1.90
f (x) = (2(1.8500000000000008) +3 (2)) * 0.05
0.4850000000000001
Iteration: 19.0
Function
Lower Limit
Upper Limit
LRAM Application (width=0.05)
Answer
f (x) = 2x+3 (2)
x=1.90
x=1.95
f (x) = (2 (1.9000000000000008)+3 (2)) * 0.05
0.49000000000000005
Iteration: 20.0
Function
Lower Limit
Upper Limit
LRAM Application (width=0.05)
Answer
f (x) = 2x+3 (2)
x=1.95
x=2.00
f(x) = (2 (1.9500000000000008) +3 (2))
0.05
0.4950000000000001
Final answer/Summation of all iterations is 8.95
BUILD SUCCESSFUL (total time: 12 seconds)
Transcribed Image Text:The function is f (x) = 2x+3 (2) Width is 0.05 Enter Lower Limit: 1 Enter Upper Limit: 2 Iteration: 1.0 Function Lower Limit Upper Limit LRAM Application (width=0.05) Answer f (x) = 2x+3 (2) x=1.00 x=1.05 f (x) = (2 (1.0) +3 (2)) * 0.05 0.4 Iteration: 2.0 Function Lower Limit Upper Limit LRAM Application (width=0.05) Answer f (x) = 2x+3 (2) x=1.05 x=1.10 f(x) = (2 (1.05) +3 (2)) * 0.05 0.405 Iteration: 3.0 Function Lower Limit Upper Limit LRAM Application (width=0.05) Answer f(x) = 2x+3 (2) x=1.10 x=1.15 E(x) = (2 (1.1)+3 (2)) * 0.05 0.41 Iteration: 4.0 Function Lower Limit Upper Limit LRAM Application (width=0.05) Answer f(x) = 2x+3 (2) x=1.15 x=1.20 f(x) = (2 (1.15000000o00000001) +3 (2)) * 0.05 0.41500000000000004 Iteration: 5.0 Function Lower Limit Upper Limit LRAM Application (width=0.05) Answer f (x) = 2x+3 (2) x=1.20 x=1.25 f (x) = (2 (1.2000000000000002) +3 (2)) * 0.05 0.42000000000000004 Iteration: 6.0 Function Lower Limit Upper Limit LRAM Application (width=0.05) Answer f (x) = 2x+3 (2) x=1.25 x=1.30 f(x) (2 (1.250o00000000o0002) +3 (2)) 0.05 0.42500000000000004 Iteration: 7.0 Function Lower Limit Upper Limit LRAM Application (width=0.05) Answer f (x) = 2x+3 (2) x=1.30 x=1.35 f (x) = (2 (1.3000000000000003) +3 (2)) 0.05 0.4300000o00000001 Iteration: 8.0 Function Lower Limit Upper Limit LRAM Application (width=0.05) Answer f (x) = 2x+3 (2) x=1.35 x=1.40 f (x) = (2 (1.3500000000000003) +3 (2)) 0.05 0.43500000000000005 Iteration: 9.0 Function Lower Limit Upper Limit LRAM Application (width=0.05) Answer f (x) = 2x+3 (2) x=1.40 x=1.45 f (x) = (2 (1.4000000000000004) +3 (2)) 0.05 0.44000000000000006 Iteration: 10.0 Function Lower Limit Upper Limit LRAM Application (width=0.05) Answer f (x) = 2x+3 (2) x=1.45 x=1.50 f(x) = (2 (1.4500000000000004) +3 (2)) 0.05 0.44500000000000006 Iteration: 11.0 Function Lower Limit Upper Limit LRAM Application (width=0.05) Answer f (x) = 2x+3 (2) x=1.50 x=1.55 f (x) (2 (1.5000000000000004) +3 (2)) 0.05 0.45 %3D Iteration: 12.0 Function Lower Limit Upper Limit LRAM Application (width=0.05) Answer f (x) = 2x+3 (2) x=1.55 x=1.€0 f(x) = (2 (1.5500000000000005) +3 (2)) * 0.05 0.45500000000000007 Iteration: 13.0 Function Lower Limit Upper Limit LRAM Application (width=0.05) Answer f (x) = 2x+3 (2) x=1.60 x=1.65 f (x) = (2 (1.6000000000000005) +3 (2)) * 0.05 0.4600000000000001 Iteration: 14.0 Function Lower Limit Upper Limit LRAM Application (width=0.05) Answer : f (x) = 2x+3 (2) x=1.65 x=1.70 f (x) = (2 (1.650000000o000006) +3 (2)) * 0.05 0.46500000000000001 Iteration: 15.0 Function Lower Limit Upper Limit LRAM Application (width=0.05) Answer f (x) = 2x+3 (2) x=1.70 x=1.75 f (x) = (2 (1.7000000000000006) +3 (2)) * 0.05 0.47000000000000014 Iteration: 16.0 Function Lower Limit Upper Limit LRAM Application (width=0.05) Answer f (x) = 2x+3 (2) x=1.75 x=1.80 f (x) = (2 (1.7500000000000007) +3 (2)) * 0.05 0.4750000000000001 Iteration: 17.0 Function Lower Limit Upper Limit LRAM Application (width=0.05) Answer f (x) = 2x+3 (2) x=1.80 x=1.85 f (x) = (2 (1.8000000000000007)+3 (2)) * 0.05 0.4800000000000001 Iteration: 18.0 Function Lower Limit Upper Limit LRAM Application (width=0.05) Answer f (x) = 2x+3 (2) x=1.85 x=1.90 f (x) = (2(1.8500000000000008) +3 (2)) * 0.05 0.4850000000000001 Iteration: 19.0 Function Lower Limit Upper Limit LRAM Application (width=0.05) Answer f (x) = 2x+3 (2) x=1.90 x=1.95 f (x) = (2 (1.9000000000000008)+3 (2)) * 0.05 0.49000000000000005 Iteration: 20.0 Function Lower Limit Upper Limit LRAM Application (width=0.05) Answer f (x) = 2x+3 (2) x=1.95 x=2.00 f(x) = (2 (1.9500000000000008) +3 (2)) 0.05 0.4950000000000001 Final answer/Summation of all iterations is 8.95 BUILD SUCCESSFUL (total time: 12 seconds)
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Binary numbers
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.
Recommended textbooks for you
Database System Concepts
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)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education