Answered step by step
Verified Expert Solution
Question
1 Approved Answer
on jupyter notebook Use Newton's method to take the inverse of u = tanh x, that is for a given u, calculate tanh-u= x. Clearly
on jupyter notebook
Use Newton's method to take the inverse of u = tanh x, that is for a given u, calculate tanh-u= x. Clearly this is the root of f(x) = tanh(x) u where u is a constant. Include the function f(x) to evaluate Include a function for f'(x) to evaluate The programming problem is how to pass the value of u to these functions? Python functions can be defined such that they accept a list of arguments in addition to the variable x where they are to be evaluated. For exmaple: def f(x, *args) : u = args return numpy.tanh(x)-u # -- This is the value of u we want to take the arctanh of. # -- args_to_pass wil be passed into both f and fp to help evaluate those funcitons. # -- It is a 'tuple' type container, a collection which is ordered and unchangeable, different from a list. args_to_pass=0.9,) scipy.optimize.newton(f,0.0,fprime=fp, args=args_to_pass) Verify your results with numpy.arctanh. Use Newton's method to take the inverse of u = tanh x, that is for a given u, calculate tanh-u= x. Clearly this is the root of f(x) = tanh(x) u where u is a constant. Include the function f(x) to evaluate Include a function for f'(x) to evaluate The programming problem is how to pass the value of u to these functions? Python functions can be defined such that they accept a list of arguments in addition to the variable x where they are to be evaluated. For exmaple: def f(x, *args) : u = args return numpy.tanh(x)-u # -- This is the value of u we want to take the arctanh of. # -- args_to_pass wil be passed into both f and fp to help evaluate those funcitons. # -- It is a 'tuple' type container, a collection which is ordered and unchangeable, different from a list. args_to_pass=0.9,) scipy.optimize.newton(f,0.0,fprime=fp, args=args_to_pass) Verify your results with numpy.arctanhStep 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