Write a Python function called integrateSpectrum that uses the Trapezoidal Method to numerically estimate the bounded integral. The first few lines of its definition are outlined here. It's up to you to fill in the rest of the function with code: def integrateSpectrum (wavelengths, fluxes, w_lower, w_upper): This function performs a numerical integral of a spectrum. Arguments: wavelengths = a numpy array of wavelengths, in nanometers fluxes = a numpy array of fluxes, corresponding to w w_lower = the lower wavelength limit of the integration w_upper = the upper wavelength limit of the integration Returns:

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter5: Repetition Statements
Section5.5: A Closer Look: Loop Programming Techniques
Problem 12E: (Program) Write a program that tests the effectiveness of the rand() library function. Start by...
icon
Related questions
Question
Write a Python function called integrateSpectrum that uses the Trapezoidal Method
to numerically estimate the bounded integral. The first few lines of its definition are outlined
here. It's up to you to fill in the rest of the function with code:
def integrateSpectrum(wavelengths, fluxes, w_lower, w_upper):
This function performs a numerical integral of a spectrum.
Arguments:
wavelengths = a numpy array of wavelengths, in nanometers
fluxes = a numpy array of fluxes, corresponding to w
w_lower = the lower wavelength limit of the integration
W_upper = the upper wavelength limit of the integration
Returns:
the integral of fluxes, with wavelength limits from w_lower to w_upper
(this should be one floating point number)
# now you write the rest!
#HINT: Booleans arrays can be really useful for selecting ranges out of an array
Transcribed Image Text:Write a Python function called integrateSpectrum that uses the Trapezoidal Method to numerically estimate the bounded integral. The first few lines of its definition are outlined here. It's up to you to fill in the rest of the function with code: def integrateSpectrum(wavelengths, fluxes, w_lower, w_upper): This function performs a numerical integral of a spectrum. Arguments: wavelengths = a numpy array of wavelengths, in nanometers fluxes = a numpy array of fluxes, corresponding to w w_lower = the lower wavelength limit of the integration W_upper = the upper wavelength limit of the integration Returns: the integral of fluxes, with wavelength limits from w_lower to w_upper (this should be one floating point number) # now you write the rest! #HINT: Booleans arrays can be really useful for selecting ranges out of an array
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Function Arguments
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
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr