Question: Create Python function DDeriv (f,x,y,h,v) which, for a given function f and given point (x,y), step size h>0 and vector v, computes directional derivative Dfevi(x,y)

 Create Python function DDeriv (f,x,y,h,v) which, for a given function f

Create Python function DDeriv (f,x,y,h,v) which, for a given function f and given point (x,y), step size h>0 and vector v, computes directional derivative Dfevi(x,y) of f at (x,y) in the direction v. Note that we need to normalize v to compute this directional derivate by Deif(x,y)=fx(x,y),fy(x,y)vv where the partial derivatives are computed numerically by central difference formulae: fx(x,y)2hf(x+h,y)f(xh,y)fy(x,y)2hf(x,y+h)f(x,yh) You may want to use method for dot product, and linalg.norm() for the norm of a vector. That is, if is imported with alias (as it is at the beginning of this notebook), then - use for dot product of vectors and (with and being tuples or list objects) - use for the norm of the vector (with being a tuple or a list object) \# your code here raise NotImplementedError "" "Check whether your answer is correct for some functions and at some points and in some directions""" assert np. abs(DDeriv (f=1 lambda x,y:x2+y2+2,x=0.4,y=0.2,h=1e5,v=(0.6,0.8))0.16)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!