%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %STUDENTS OF 412 ARE ENTITLED TO USE A VARIATION OF THIS FILE FOR %THEIR ASSIGNMENT. IF YOU DO THAT, REPORT THAT FACT ON THE %ASSIGNMENT (WRITE : `I USED THE CODE AT CLASS ACCOUNT AS MY BASE CODE') %YOU MAY WISH, HOWEVER, TO WRITE SOMETHING A BIT MORE SOPHISTICATED %++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %in this file, we try to solve the equation x^3=sin(x) %using four different fixed point algorithms. %rat is the (estimated) ratio between the current error and the previous one. %only one iteration is performed. %before you use this file, type `n=1'. This will initialize the %parameters in the code, and will also keep a counter on the number %of iterations. the value of rat after one iteration is meaningless. %note that the solution is around .9 n=1 n = 1 fixed_point rat = -0.0559 -0.1585 -0.1585 -0.0645 x = 0.9441 0.8415 0.8415 0.9355 fixed_point rat = 0.2134 -1.3345 -0.9449 0.0878 x = 0.9322 1.0530 0.9913 0.9299 fixed_point rat = 0.2275 -1.2735 -0.9167 0.1811 x = 0.9294 0.7836 0.8540 0.9289 fixed_point rat = 0.2306 -1.3580 -0.9551 0.1898 x = 0.9288 1.1495 0.9851 0.9287 fixed_point rat = 0.2313 -1.2541 -0.9351 0.1914 x = 0.9287 0.6906 0.8625 0.9286 fixed_point rat = 0.2315 -1.4055 -0.9614 0.1917 x = 0.9286 1.3356 0.9804 0.9286 fixed_point rat = 0.2315 -1.2255 -0.9462 0.1917 x = 0.9286 0.5452 0.8688 0.9286 fixed_point rat = 0.2315 -1.5177 -0.9659 0.1917 x = 0.9286 1.7447 0.9766 0.9286 fixed_point rat = 0.2315 -1.1848 -0.9536 0.1917 x = 0.9286 0.3236 0.8738 0.9286 fixed_point rat = 0.2315 -1.9093 -0.9691 0.1917 x = 0.9286 3.0370 0.9734 0.9286 fixed_point rat = 0.2315 -1.1151 -0.9589 0.1917 x = 0.9286 0.0113 0.8779 0.9286 formatlong ??? Undefined function or variable 'formatlong'. format long fixed_point rat = 0.23151341695496 -29.18636973947528 -0.97167580046495 0.19172756220239 x = 0.92862631028634 88.31909972374159 0.97069299656834 0.92862630881575 fixed_point rat = 0.23151341189675 -1.00012771055615 -0.96295031931709 0.19172746264867 x = 0.92862630909165 0.00004450190562 0.88133974318030 0.92862630874784 fixed_point rat = 1.0e+02 * 0.00231513453551 -2.54429213859449 -0.00973692285536 0.00191727252069 x = 1.0e+04 * 0.00009286263088 2.24709478334029 0.00009683423167 0.00009286263087 exit