How to convert any of the three container structures

Assignment Help Mathematics
Reference no: EM13687822

1. Solving nonlinear equations, python modules, arrays, lists, functions, scipy, timing and plotting

In this example we investigate the time it takes to reach a certain accuracy using the Newton method and the secant method. Three test cases are considered: rst, con rm that your own code is second order accurate using the number of Newton iterations as a parameter. Then study scipy's Newton and secant method using the tolerance tol as parameter. Consider the determination of the zero of f(x) = exp( x) x.

First some preparations:

- We will use the modules math, time, scipy, scipy.optimze and scilab which need to be imported

- Then we will require an implementation of the function f(x) and of its derivative f0(x)

- As we are interested in the performance of our method in the case where the function evaluation is very costly we will arti cially increase the time for evaluation of f(x) and its derivative by a substantial amount using the sleep function from the time module

- As we do not know the exact solution, we will use the scipy library Newton method to determine a very accurate approximation as reference solution

- We will use the time function from the time module to determine the time required for the solvers. You might have to do multiple runs of the timing to get an accurate time.

In [ ]: # labbook -- fill in the missing bits see LB

# you will need the modules: math, time, scipy, scipy.optimze and pylab import math as ma

#LB ... fill in the missing bits here ...

# define function and derivative tev = 0.01 # time for one function evaluation (see sleep below)
def f(x):

""" function evaluation """

#LB include the function here as fx = .... tm.sleep(tev) # add some time to mimic a lengthy function evaluation return fx

def df(x):

""" derivative evaluation """

#LB fill in the derivative1.1.1 First experiment: implement very simple Newton method and compare accuracy against time spent.

Second experiment: investigate the tolerance parameter of the scipy newton method

Third experiment: investigating the tolerance parameter for the scipy secant method

Show how to convert any of the three container structures into any other.

What is the shape of an array? How can it be changed? Provide an example.

Reference no: EM13687822

Questions Cloud

Calculate the current long-term rate for one : Calculate the current (long-term) rate for one-, two-, three- and four-year maturity Treasury securities. Plot the resulting yield curve and what is the discount yield, bond equivalent yield and effective annual return on a $1 million Treasury Bill..
Develop an objective function with constraints : Develop an objective function with constraints in capital and labor cost. How many hours can you work before seeing Diminishing Returns? Please explain how you get the answer.
Identify the subject matter : Do you think this is a painting, drawing, print, photograph, or "other"? There are no labels, so make an educated guess.
Determine the monthly break-even volume for the company : The company's fixed monthly cost is $25,000, and its variable cost per pound of fertilizer is $0.15. Evergreen sells the fertilizer for $0.40 per pound. Determine the monthly break-even volume for the company.
How to convert any of the three container structures : Show how to convert any of the three container structures into any other - What is the shape of an array? How can it be changed? Provide an example.
How would the uaw benefit for increased demand for gm : How would the UAW benefit for increased demand for GM and Chrysler vehicles - Each year Forbes magazine lists the multimillion-dollar earnings of top entertainers and professional athletes.
Show running versions of the program : Show three running versions of the program in a single screen shot with 3 different size stop signs - Make the circle a red filled circle. Add 4 buttons below the Left-Right-Up-Down buttons with Red and any three other colours.
Integration of key worldwide money market interest : The literature on the integration of key domestic and international market interest rates is extensive. This literature review includes a select group of studies widely cited
Growth in the strategic role of procurement : A proactive strategic procurement operation can give the organisation it represents a competitive advantage by reducing waste in the value chain.

Reviews

Write a Review

Mathematics Questions & Answers

  Find the centroid of a thin, flat plate covering the region

find the centroid of a thin, flat plate covering the region enclosed by the parabola y^2=x and the line x=2y.

  How should the string be cut so that the sum

A 25-inch piece of string is cut into two pieces. One piece is used to form a circle and the other to form a square. How should the string be cut so that the sum of the areas is a minimum? Round to the nearest tenth, if necessary.

  Draw a quik picture that shows the sentence

write the related multiplication or division sentence. draw a quik picture that shows the sentence.

  What is the maximum height attained by the ball

If a ball is thrown directly upward with a velocity of 48 ft/s, its height (in feet) after t seconds is given by y = 48t - 16t2. What is the maximum height attained by the ball? (Round your answer to the nearest whole number.)

  Calculate the area of idaho

Idaho is shaped like a triangle with a base of approximately 320 miles and a height of approximately 520 miles. Calculate the area of Idaho and write the answer in scientific notation.

  Information about counting principle

A mini license plate for a toy car must consist of three numbers followed by a letter. Each number must be a 3,6, or 9. Repetition of digits is NOT permitted. Each letter must be an A, B, or C.

  What is the value for ssbetween treatments

A two factor analysis of variance produces SSA = 20, SSB = 40 and SSAxB = 90. For this analysis, what is the value for SSbetween treatments?

  Amount of group combinations

A computer programming team has 12 members. How many ways can a group of 7 (out of the 12 members) be chosen to work on a special project? Explain.

  Find the number of sodas sold and the number

At a basketball game, a vendor sold a combined total of 245 sodas and hot dogs. The number of sodas sold was 37 more than the number of hot dogs sold. Find the number of sodas sold and the number of hot dogs sold.

  Application of differential calculus in economics

Application of differential calculus in economics: Profit, Cost and Revenue function - What is the maximum profit if each item is sold for $7? (Assume you sell every thing you produce.)

  The indicated derivative

the indicated derivative

  Find the constant of variation and write an equation of

find the constant of variation and write an equation of direct variation.for the given values of x andnbspy ynbspvaries

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd