Question
I can't figure out a working function to use Newton Raphson to approximate arctan(x). I am using f = arctan(x) and df = 1/(1+x^2), and
I can't figure out a working function to use Newton Raphson to approximate arctan(x). I am using f = arctan(x) and df = 1/(1+x^2), and it just keeps converging to 0 or diverging to infinity. Here's the prototype: function [y,terms] = invtanNR( x, tol, numTerms) % [y,terms] = invtanNR(x, tol, numTerms) % % Finds arctan of the number x using NR % using either MaxTerms passes or % having a relative step size < Tolerance % relative step size = abs( yOld y ) / abs( y ) % % input: % x Find arctan of this number % tol Step size % numTerms Max number of terms to use ( 500 ) % % output: % y our resultant (arctan(x)) % terms num of terms %
Step 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