Finding a contraction.

82 Views Asked by At

I want to find a function $g$ such that it is a contraction and such that finding its fixed point is the same as finding the zeros of $f(x)=x^3+x-3$ because I have implemented the fixed-point iteration method in MATLAB as follows

function fixedpointt(x0)
%example of fixed point iteration

%zeros of f(x)=x^3+x-3

    tol=10^-6; % tolerance
    itmax=1000; % max number of iterations
    itnum=0; % iterations counter

    %x0=10; % initial condition
    disp([itnum,x0])
    x1=g3(x0);
    itnum=itnum+1;
    disp([itnum,x1,abs((x0-x1)/x0)])

    while abs((x0-x1)/x0)>tol && itnum<itmax
        x0=x1;
        x1=g3(x0);
        itnum=itnum+1;
        disp([itnum,x1,abs((x0-x1)/x0)])
    end

end



function y=g3(x)
    y=3/(x^2+1);
end

The thing is that I figured out $g(x)=\frac{3}{x^2+1}$ but it didn't worked, so Can someone help me to find a function that fits with the above characteristics please?

Thanks a lot in advance.

1

There are 1 best solutions below

7
On

Maybe Newton's method will work. At least it did with starting points 1, or -5. It would be to map $x$ to $x-f(x)/f'(x)$ which is $(2x^3+3)/(3x^2+1).$ It seems you may have been going for this, as your formula has the same denominator but in yours the numerator is the constant 3.

With initial value 1 it took only 4 steps to stabilize to about 1.2134116. With initial value -5 it took more steps, 7 o4 8, but still arrived at the same thing.