Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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 tanhStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started