Provide a definition of the exp function

Assignment Help Computer Engineering
Reference no: EM131097893

E19: Numerical Methods for Engineering Applications Spring 2016 - HOMEWORK 9

1. Second-order forward difference approximation to the first derivative

Derive the approximation

f'(x) ≈ 1/2h(-3f(x) + 4f(x+h) - f(x+2h))

and show that it has asymptotic error of O(h2).

2. Dual numbers and partial derivatives

Extend the dual.py code we wrote in class to to use dual numbers to automatically evaluate both partial derivatives of the following function f(x, y):

def f(x, y): return -2.0*x * exp(-(x**2 + y**2)/(4.0))

You should evaluate the function and its derivatives at (x, y) = (0.5, 1.5).

Here are two possible strategies:

  • Easier: Call the function f twice, each time with one Dual object as an argument, and one normal floating point number.
  • Harder: Extend the Dual class so that self.eps is a flat numpy array of length two where the infinitessimal parts correspond to the partials in x and y.

In either case, you will need to provide a definition of the exp function which handles dual numbers correctly (see sqrt and cos in dual.py for examples).

Write a test function to show that your program computes the correct derivatives by comparing to the numerical central difference approximations for the first derivative. Submit a printout of your program and its output.

3. Integrating quadratics and cubics with Simpson's rule

It turns out that for some functions, the adaptive Simspson's integrator we looked at in class doesn't need to do too much work.

a. Why does the code always hit the base case (i.e. does not recurse) when the function f(x) being integrated is any quadratic function?

b. Furthermore, why does the code always hit the base case when the function f(x) being integrated is a cubic function?

4. A new twist on 2D integration

I extended the 2D integral function we worked on in class to create simpsons2d_mystery.

a. What is this function good for? What does it provide that simpsons2d does not?

b. Using traditional calculus notation, write down the 2D integral which is assigned to the mystery variable at the bottom of the program (you need not solve the integral analytically, but it might help you figure out what's going on here).

Attachment:- Assignment.rar

Reference no: EM131097893

Questions Cloud

Average inflation rates tend to be higher in countries : Average inflation rates tend to be higher in countries that have relatively weak judicial systems and property rights (remember chapter 1 and the importance of secure property rights?). Why do you think this is the case? Would you expect these countr..
Write the results statistical : What are the F critical values for A effect, B effect, and the interaction - Which effects are significant? Write the results statistical
What is a market failure : What is a market failure? It refers to a breakdown in a market economy because of widespread corruption in government.
Original amount of the mortgage loan : A mortgage loan is repaid with annual installment payments payable at the end of each year for 30 years. Each subsequent payment is 2% higher than the previous one. The interest rate charged on the loan balance is:
Provide a definition of the exp function : E19: Numerical Methods for Engineering Applications Spring 2016 - HOMEWORK 9. In either case, you will need to provide a definition of the exp function which handles dual numbers correctly (see sqrt and cos in dual.py for examples)
Respectable economic motive for selling of state-owned firms : Explain the possible problems for consumers of each of the following ways of dealing with a natural monopoly: Why do most economists argue that the money raised by selling off state-owned firms is not an especially good argument for selling them? Wha..
New contract with the federal government : Congratulations! Your company just won a lucrative new contract with the Federal Government to supply widgets for a total value of $50 million. If you perform well and on time on this job it will open the door to hundreds of millions more of futur..
Create the folders and files that appear in the file layout : Create the folders and files that appear in the attached file layout. Define at least two styles in your CSS file. These styles are completely up to you. You can change the body font, or create a header class, or format something in the footer.
Problem regarding the career opportunities : Write a 2-3 page paper. In your paper include the following: Discuss positions that are available for people with a knowledge of finance? Provide 3 examples of occupations that also use finance. Give a brief description of each.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Create a program that calculates fat grams and calories

john raymond was so pleased with the program you created for his clients that he regers you to his coworker,a nutrionist in the same facility.

  How to convert 2d array to 1d array

how to convert 2d array to 1d array for instance

  Write the code for an ordered linked list module

Select Makefile from the file list and hit Compile/Validate. This will compile ordereList.c and main.c, producing an executable named main. If you double click main, the program will execute and should produce the output shown in the example below..

  Problem definitionrural areas do not have proper internet

problem definitionrural areas do not have proper internet access and are unable to manage downloading anything. certain

  Define the best possible scenario for an organization

If in a hypothetical situation your company was capable to hire only either technically sound managers with weak leadership skills OR strong leaders with less knowledge/interest in routine management, that would you opt for and why.

  Design should show each object''s encapsulated methods

make a class diagram (in Visual Studio 2008 C#) based on the following scenario: When constructing classes that will represent objects in a system, it is important to ensure the integrity of those objects and be able to define the types of relatio..

  Stop-and-wait arq

Assume that each router utilizes the stop-and-wait ARQ and offer one buffer (large enough for one packet) for every VC in every direction of traffic.

  Make a `show me'' button that displays the number

Write down a GUI program that is a game to be played by the user. A new employee is working on a classified mission and the program will randomly pick an expected profit to be guessed by the user. The program must randomly select a number within r..

  Design and populate tables within a database

Employees all have employee ID's, first names, last names, middle initials, street addresses, city, state, postal codes, and a date of birth.

  Gem infosys a small software company has decided to better

gem infosys a small software company has decided to better secure its computer systems after a malware attack shut down

  What are the latest advancements in cabling

Why would a company want a network on its premises? How will a department or company benefit by having a network.

  Proposal for cloud-based to manage acl realty services

You have been assigned the task of providing ACL Realty a proposal for cloud-based to manage and running most of ACL Realty services.

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