Bisection and Newton's Approximation

Click For Summary
The discussion focuses on creating functions in Mathematica for the Bisection method and Newton's Approximation to find roots of a specific function, f(x) = sinh(x) - 2^x + x^4 - 2x^3 - 26x^2 + 4x + 48. The user seeks validation of their implementation and is concerned about their programming skills as a beginner. Suggestions include testing the functions with known polynomials, improving code efficiency and readability, and exploring resources for learning Mathematica. The discussion emphasizes the importance of accuracy in a team project to avoid negatively impacting grades. Overall, the user is looking for guidance and reassurance in their coding efforts.
arhzz
Messages
284
Reaction score
58
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
Thread 'Full bridge circuit with inductor and resistor'
The above is the circuit i am calculating the inductor current. During the positive half of the sine input D1 and D3 are conducting so the circuit becomes My calculations are as below Are the above equations ok? When transitioning from +Ve cycle to -Ve sine wave does the above equations still applicable? During the negative cycle the diodes D2 and D4 are conducting and the current direction is going into the inductor same as when diodes D1 and D3 are conducting. According to me the same...

Similar threads

  • · Replies 2 ·
Replies
2
Views
2K
Replies
4
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 4 ·
Replies
4
Views
4K
Replies
2
Views
3K
  • · Replies 16 ·
Replies
16
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 13 ·
Replies
13
Views
5K