Modify the function int_fun written in class (posted on Blackboard) to calculate the integral between two...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Modify the function int_fun written in class (posted on Blackboard) to calculate the integral between two anonymous functions using the midpoint rectangular integration rule. The new function should take the form Int= int2_fun (func1, func2, a, b, num_rectangles) Where the integral is the area between two anonymous functions, func1 and func2. It's ok to assume that func2 will always be the upper function, that is: INT = = [ (func₂(x) - func₁(x))dx Test your function by integrating (in your main script) between 1. func2(x)=x*, func1(x)= x(12) from 0 to 5 using 5000 rectangles. 2. func2(x)=sin(x)e*, func1(x) = cos(x)ln(x) from 1 to 3.18 using 5000 rectangles. Modify the function int_fun written in class (posted on Blackboard) to calculate the integral between two anonymous functions using the midpoint rectangular integration rule. The new function should take the form Int= int2_fun (func1, func2, a, b, num_rectangles) Where the integral is the area between two anonymous functions, func1 and func2. It's ok to assume that func2 will always be the upper function, that is: INT = = [ (func₂(x) - func₁(x))dx Test your function by integrating (in your main script) between 1. func2(x)=x*, func1(x)= x(12) from 0 to 5 using 5000 rectangles. 2. func2(x)=sin(x)e*, func1(x) = cos(x)ln(x) from 1 to 3.18 using 5000 rectangles.
Expert Answer:
Related Book For
Posted Date:
Students also viewed these programming questions
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Your independent film production company owns the rights to a script for a rom-com movie. They estimate that the script would cost $30 million to make into a movie, which would have a 35% chance of...
-
A sample of an ideal gas is in a vertical cylinder fitted with a piston. As 5.79 kJ of energy is transferred to the gas by heat to raise its temperature, the weight on the piston is adjusted so that...
-
Let p(t) = 0.1e 0.1t be the density function for the waiting time at a subway stop, with t in minutes, 0 t 60. (a) Graph p(t). Use the graph to estimate visually the median and the mean. (b)...
-
An AM radio detects the oscillating magnetic field of the radio wave with an antenna consisting of a coil of wire wrapped around a ferrite bar, as shown in Figure Q25.21. Ferrite is a magnetic...
-
Hamlin Steel Company wishes to determine the value of Craft Foundry, a firm that it is considering acquiring for cash. Hamlin wishes to determine the applicable discount rate to use as an input to...
-
Describe what the conclusion was from this "consideration" process. Identify and provide details on at least two of the benefits Sam anticipates by pursuing an enterprise architecture approach.
-
A small cube moves at a constant velocity v= 8.5 m/s on the smooth horizontal floor until it reaches the bottom of an inclined plane at = 37 above the horizontal. The cube slides up the inclined...
-
If a fixed number of industrial pollution permits are marketable, then we should just sell the right to smoke to the highest bidders rather than ban smoking outright in many cities, towns, business...
-
Question 3: This question tests your understanding of the various form of "break-evens". A proposed project has the following facts: o Investment required today, t=0, $10M (cash outflow) o Length of...
-
Discuss the role of intrinsic and extrinsic motivation in fostering employee engagement and its impact on organizational citizenship behavior. Provide examples and analyze how effective motivational...
-
I would like you to describe at least three distinct culturally specific details about one chosen cultures that were described in the case study below. Were you aware of these before you read them?...
-
Discuss each of the five stages in the consumer decision making process when buying a new TV as a birthday present for your best mate.
-
Consider a two period firm model similar to the one you studied in Unit 1 modified to include uncertain productivity. In period 1, the firm starts with some capital K, = K that it owns. Within each...
-
1. An auditor selected a product maintained in the finished goods Warehouse. The auditor counted the product and compare this amount what the amount in the finished goods Perpetual inventory...
-
You deposit $10,000 in a savings account that earns 7.5% simple interest per year. What is the minimum number of years you must wait to double your balance? Suppose instead that you deposit the...
-
Rewrite the following code using braced initialization list syntax; the rewrite should dispense with using the array ar: class Z200 { private: int j; char ch; double z; public: Z200(int jv, char chv,...
-
What safeguards does C++ provide to keep you from exceeding the limits of an integer type?
-
Write a program that repeatedly asks the user to enter pairs of numbers until at least one of the pair is 0. For each pair, the program should use a function to calculate the harmonic mean of the...
-
An April 2014 study by researchers at University College London found that people who ate seven or more portions of fruits and vegetables a day had a \(42 \%\) lower risk of death at any point in...
-
Suppose that the demand curve for wheat is \(Q=100-10 p\) and the supply curve is \(Q=10 p\). The government imposes a specific tax of \(t=1\) per unit. a. How do the equilibrium price and quantity...
-
Two linear demand curves go through the initial equilibrium, \(e_{1}\). One demand curve is less elastic than the other at \(e_{1}\). The original horizontal supply curve also goes through \(e_{1}\)....
Study smarter with the SolutionInn App