df(x) The first derivative of a function f(x) at a point x = xo can be...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
df(x) The first derivative of a function f(x) at a point x = xo can be approx- dx imated with the two-point central difference formula: df(x) _ f(x+h)-f(xo-h) dx 2h Where h is a small number. Write a user-defined function that calculates the derivative of a math function f(x) by using the two-point central difference formula. For the user-defined function name, use dfdx=deriv (func, x0), where func is a name for the function that is passed into deriv, and x0 is the point where the derivative is calculated. Use h = 0.001 in the two-point central difference formula. Use the user-defined function deriv to calculate the following derivatives in your main script: 1. f(x)=sin(x) at x0 = 0 2. f(x)=sin(x) at x0 = pi/2 3. f(x)=x* sin(x)e* at x0 = 0.1 4. f(x)=x* at x0 = 2.3 (Note that this is hard to compute analytically, but easy to compute with MATLAB df(x) The first derivative of a function f(x) at a point x = xo can be approx- dx imated with the two-point central difference formula: df(x) _ f(x+h)-f(xo-h) dx 2h Where h is a small number. Write a user-defined function that calculates the derivative of a math function f(x) by using the two-point central difference formula. For the user-defined function name, use dfdx=deriv (func, x0), where func is a name for the function that is passed into deriv, and x0 is the point where the derivative is calculated. Use h = 0.001 in the two-point central difference formula. Use the user-defined function deriv to calculate the following derivatives in your main script: 1. f(x)=sin(x) at x0 = 0 2. f(x)=sin(x) at x0 = pi/2 3. f(x)=x* sin(x)e* at x0 = 0.1 4. f(x)=x* at x0 = 2.3 (Note that this is hard to compute analytically, but easy to compute with MATLAB
Expert Answer:
Answer rating: 100% (QA)
import math def derivfunc x0 h 0001 return funcx0 h funcx0 h 2 h Define the ... View the full answer
Related Book For
Posted Date:
Students also viewed these databases questions
-
Verify that it does not matter which product you use to predict the limiting reagent by using both products in this combustion reaction to determine the limiting reagent and the amount of the...
-
C. / d. Names of methods and variable should always start with: 8. upper case letter and upper case for all subsequent words . b. lower case letter and lower case for all subsequent words it does not...
-
(a) What is the symbol for a scores deviation from the mean? (b) What is the symbol for the sum of the deviations? (c) What does it mean to say the sum of the deviations around the mean equals zero?
-
What personal constructs do you rely on when perceiving the people in this photo?
-
A journal article reported that a null hypothesis of = 100 was rejected because the P-value was less than 0.01. The sample size was given as 62, and the sample mean was given as 103.6. Find the...
-
The Bakery Department of Culbert Dessert Corporation has submitted the following forecast of fruit pies to be produced by quarter for the upcoming fiscal year. Units to be produced First Second Third...
-
Wilmot Real Estate Co. had the following balance sheet at year-end 2015: In early 2016, the company took out a \($200,000\) two-year bank loan to finance new real estate investments. The loan...
-
1. What conditions appear to have allowed the Parmalat situation to get out of control? 2. What specific audit procedures could have uncovered the Parmalat fraud earlier? 3. What audit steps should...
-
Why did OJ Simpson's deposition and in-court testimony in the civil case not constitute a violation of his right against self-incrimination? A. he protection against self-incrimination only applies...
-
Segment the wind-generated power industry in a way that shows where Windspire Energy, the subject of the You Be the VC 1.1 feature, is located in the industry. How does Windspires awareness of the...
-
A bond has a face value of $1,000 and 15 years until maturity. The bond has a 4% APR coupon with semi-annual coupon payments. Currently, investors seek a 7% APR yield to maturity to hold the bond....
-
As marketing manager for the new Jump! athletic shoe company, you have a lot of work to do in order to compete with athletic shoe giants like Nike and Adidas. Though your company makes various kinds...
-
You estimate that the probability of a newly issued driver having an accident in any given month is 2% and the average loss during an accident is $5,000. Do 1000 simulations for each of these six...
-
Randy sold 1,000 shares of SP, Inc. stock to his son, Stan. Randy initially paid $50 per share for the stock, but sold it to Stan for $30 per share. If Stan sells the stock to an unrelated party for...
-
Explore the organization of a sheriff's department as well as potential career opportunities in the justice system. Part 1: create a organizational chart of your local sheriff's office, to include...
-
Given the first few sorted lines from a historical simulation (with equal weightings) on a portfolio's gains over the past 600 days below,what would be the 99%VaRof this portfolio? Gains ($) -370...
-
1. What is probability? What does it involve with statistics and daily life?
-
Before the 1973 oil embargo and subsequent increases in the price of crude oil, gasoline usage in the United States had grown at a seasonally adjusted rate of 0.57 percent per month, with a standard...
-
Find the volume of the solid generated by revolving the region under the graph of y = 1/(3x-x2) From x = 1 to x = 2 about (a) The x-axis (b) The y-axis
-
In Problems a-c find the Cartesian equations of the graphs of the given polar equations. a. = 1/2 b. r = 3 c. r cos + 3 = 0 d. r - 5 cos = 0
-
Prove that f is continuous at c if and only if limt0 (c + t) = f(c).
-
Key Performance Indicators: The Income Statement. Describe or define the following key performance indicators (KPIs) from the income statement: 1. Operating revenue 2. Gross profit 3. Operating...
-
The return on shareholders equity ratio can be decomposed into three separate financial ratiosthe return on sales, asset turnover, and financial leverage. Define each of the ratios assuming the firm...
-
Some corporate executives have reportedly attempted to manage their firms operating revenues through such actions as front-end loading or rear-end loading of operating revenues. Explain the concepts...
Study smarter with the SolutionInn App