Bisection and Newton's Approximation

In summary, "Bisection and Newton's Approximation" discusses two numerical methods for finding roots of functions. The bisection method is a straightforward, iterative approach that narrows down the interval containing a root by repeatedly halving it, ensuring convergence when the function changes signs. Newton's approximation, on the other hand, uses the derivative of the function to provide faster convergence by refining guesses based on the slope at the current estimate. While the bisection method guarantees convergence, Newton's method can be more efficient but requires a good initial guess and may fail if the derivative is zero or if it diverges.
  • #1
arhzz
268
52
TL;DR Summary: Writing functions for Bisection and Newtons Approximation in Mathematica

Hello! I need to write 2 functions in mathematica, to find the roots of functions. The functions are the Bisection methods and Newtons Approximation.

(b1) Write your own function ApproxBisect[a0_,b0_,n_], which starting from an initial interval [a0, b0] approximates a root of the function in n steps. As a result, output the list of the n interval midpoints and the corresponding function values.

(b2) Test your function for the function f over a suitably chosen range and an appropriate number of approximation steps.

The function f(x) is this ## f(x) = \sinh(x) - 2^x + x^4 - 2x^3 - 26x^2 + 4x + 48 ##

Now this is my attempt at the solution (since I dont know how to post mathematica code formatted nicely I will put a screenshot)

plss.png

For Newton I tried this

plz2.png


And I printed all the values as a list (I can post a screenshot of the code if necesarry)

Now my main question is this ; Would you say this is correct ? I have never programmed in mathematica before so it is very new to me and I am not the most skilled programmer as it is. And since this is a team project I really dont want to be the reason we get a bad grade or worst case scenario fail the class.


Secondly, as I've stated that I am a beginner in mathematica, all tipps/tricks/suggestions are welcome; (efficiency,readability etc.) Also any good literature (crashcourse would be ideal) in mathematica is also appreciated.

Thanks in advance!
 
Physics news on Phys.org
  • #2
  • Like
Likes arhzz

FAQ: Bisection and Newton's Approximation

What is the Bisection Method?

The Bisection Method is a numerical technique used to find a root of a continuous function. It works by repeatedly dividing an interval in half and selecting the subinterval that contains the root. The method requires two initial points that bracket the root, meaning the function has opposite signs at these points.

How does Newton's Approximation work?

Newton's Approximation, also known as Newton-Raphson method, is an iterative technique for finding successively better approximations to the roots (or zeroes) of a real-valued function. It starts with an initial guess and uses the function's derivative to refine this guess. The formula is given by x_{n+1} = x_n - f(x_n) / f'(x_n), where f is the function and f' is its derivative.

What are the advantages of the Bisection Method?

The Bisection Method is simple to implement and guarantees convergence if the initial interval is chosen correctly. It is particularly useful for functions that are continuous and can be evaluated easily. Additionally, it does not require the computation of derivatives, making it applicable to a wide range of problems.

What are the limitations of Newton's Approximation?

Newton's Approximation can fail to converge if the initial guess is not close enough to the actual root or if the derivative at the guess is zero. It may also converge to a root that is not the one intended, and it requires the computation of the derivative, which might not be feasible for all functions.

When should I use the Bisection Method over Newton's Approximation?

You should use the Bisection Method when you have a continuous function and can identify an interval where the function changes sign, ensuring the existence of a root. It is also preferable when the derivative of the function is difficult to compute or when you want a guaranteed convergence. In contrast, Newton's Approximation is more efficient when you have a good initial guess and can compute the derivative easily.

Similar threads

Replies
2
Views
2K
Replies
2
Views
2K
Replies
8
Views
2K
Replies
1
Views
9K
Replies
4
Views
3K
Replies
16
Views
3K
Replies
1
Views
2K
Replies
1
Views
1K
Back
Top