Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Business Process Driven Database Design With Oracle PL SQL

Authors: Rajeev Kaula

1st Edition

1795532386, 978-1795532389

More Books

Students also viewed these Databases questions

Question

Which form of proof do you find most persuasive? Why?

Answered: 1 week ago