Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Consider the blocks of code below. Match each labelled line of code with the statement that best describes its purpose. import numpy as np import

image text in transcribed Consider the blocks of code below. Match each labelled line of code with the statement that best describes its purpose. import numpy as np import numpy.random as nrand def integrationA (f,a,b,n) : dx=(ba) \#\# (a) x=np. linspace (a,b,n+1) \#\# (b) y=f(x) \#\# (c) return npsum(y[0:n])dx##(d) def integration B(f,a,b,n) : dx=(ba) x=np. linspace (a,b,n+1) y=f(x) return npsum(y[1:n+1])dx \#\# (e) def integrationC (f,a,b,n) : dx=(ba) x=a+(ba)n rand. random (n) \#\# (f) y=f(x) \#\# (g) return npsum(y)dx##(h) (1) Creates an array of randomly chosen values between a and b, inclusive. (2) Computes the Monte Carlo approximation of the definite integral of f on [a,b]. (3) Creates an array of n+1 equally spaced values between a and b, inclusive. (4) Computes the left Riemann sum approximation of the definite integral of f on [a,b]. (5) Creates an array of n+1y-values, where y=f(x). (6) Defines the width of each approximating rectangle. (7) Computes the right Riemann sum approximation of the definite integral of f on [a,b]. (8) Creates an array of ny-values, where y=f(x). So, for example, if you think that (a) matches (3), (b) matches (5), (c) matches (1), (d) matches (2), (e) matches (7), (f) matches (4), (g) matches (5), and (h) matches (6), then you would enter 3,5,1,2,7,4,5,6 into the answer box below

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spomenik Monument Database

Authors: Donald Niebyl, FUEL, Damon Murray, Stephen Sorrell

1st Edition

0995745536, 978-0995745537

More Books

Students also viewed these Databases questions

Question

Why do mergers and acquisitions have such an impact on employees?

Answered: 1 week ago