Question: Using Python Problem 1: (Numerical differentiation) 110 marks) a) Consider a function f(x) = 1 + tanh(2x) Create a user-defined function,f(x) that returns the value

 Using Python Problem 1: (Numerical differentiation) 110 marks) a) Consider a

Using Python

Problem 1: (Numerical differentiation) 110 marks) a) Consider a function f(x) = 1 + tanh(2x) Create a user-defined function,f(x) that returns the value of 1 + tanh (2x) 2 b) Write a Python program that makes a plot of fth. Insert a-label., label. Denote the x-axis by x and the y axis by fx) c) The analytical formula for the derivative of f(x) is given by f(x)-1 - tanh (2x) Use both the forward difference derivative algorithm and the central difference algorithm to calculate the derivative of the function fco in the range -2sts2. Set h-0.1 d) Make a graph with your numerical result for fx) and the analytical formula for fx) on the same plot. It may help to plot the exact formal a lines and the numerical on as circles (forward al gorithm) and dots (central algorithm) Hint: In Python the tanh function ids found in the numpy package and it's simply tanh

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!