I am trying to create a C++ program that can calculate cube root. I was assigned to use the Newton-Raphson cube root. A website that speaks about it can be found here:
http://www.mathpath.org/Algor/cuberoot/cube.root.newton.htm
Here is my overview taken from that website:
X2 = 2(X1)+a(X1^2)
___________
3
My writing of the formula is pretty rough. Please go on the website above, if you want to see what the formula is actually supposed to look like.
X2 is the next number used in the formula
X1 is the initial guess of the cube root (can be anything – I am using 1)
a is the number we are taking the cube root of
Here is how it plays out for the cube root of 100.
X2 = 2(1)+100(1^2)
___________
3
X2 = 2+100
___________
3
X2 = 102
___________
3
X2 = 34
Now, we are supposed to substitute the X2 we got into the X1 spot and repeat.
X2 = 2(34)+100(34^2)
___________
3
X2 = 68+100/1156
___________
3
X2 = 68.08
___________
3
X2 = 22.69
There is a rule that states every time that you repeat, this occurs: The if you take the difference of the old X1 and the new X1, in this case, 34 and 22.69 which is 11.31, the actual cube root is within 11.31 of the new X1. This means the cube root of 100 should like within 11.31 away from 22.69. It does not. The cube root of 100 is 4.64 which is about 16 away. This is breaking one of the laws that has been used for 100s of years. My program is getting results that are incorrect. Something has gone askew with this.
Can you identify the problem? Is the formula that I got wrong? Am I solving the formula wrong? What has gone askew for these results to occur? My teacher did not have a response, when we showed him this. Please give me any and all information you have about this. Thanks.
http://babbage.clarku.edu/~djoyce/newton/method.html - Please go to that site as it is a very good background for this. I did not examine this site in full yet. I am doing so now. I think it is a good resource. Thanks again.