Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

On f(x)=x

  1. Mar 27, 2005 #1
    Suppose f is a function. How can we solve the equation f = x? I think I've found an interesting new way, I'm not sure it's correct however. Say we want to solve the equation cos(x)=x, then a suitable way to solve this equation is to use Newton-Raphson to get a solution. But I think I've found a method that also converges, not as quickly however. Make a guess x0 for cos(x)=x. Calculate cos(x0) = x1, calculate cos(x1) = x2, calculate cos(x2) = x3 and so on. So we use x_(n + 1) = f(n). To demonstrate this method I solve the following equation:

    1. cos(x)=x, start with a seed, I chose x0=-100 just to show that it does in deed seem to converge. This gives with the first 10 calculations:



    2. ln(x)=x, start with a seed, I chose x0 = 1000. This gives:


    This is quite good x-ln(x) = 0.00095307601525015884-0.01187533532322322971i

    3. cos(x)^2=x, seed x=1000, gives:

    This isn't good, since cos(x)^2-x = -0.1719 ..., however calculating more terms, like 100 terms gives cos(x)^2 - x = 0.00004448970614357726

    I want to know if this is new and if it does in fact converge to a root of the equation?
    Last edited: Mar 27, 2005
  2. jcsd
  3. Mar 27, 2005 #2
    have you tried this method for [tex] f(x) = x^2 [/tex]
  4. Mar 27, 2005 #3


    User Avatar
    Science Advisor
    Homework Helper
    Gold Member
    Dearly Missed

    What you're doing is well known; cool that you discovered it on your own.
  5. Mar 27, 2005 #4


    User Avatar
    Science Advisor
    Homework Helper

    Oh right I see, I was a silly confused what he was applying there.

    I suggest you try this itteration mathod:

    [tex]x_n = x_{n-1} + A(\cos x_{n-1} - x_{n-1})[/tex]

    For different values of A to try and see which ones converge quickly, some converge at a very fast rate, some converge at a slow rate like your example (some diverge at a very fast rate)
  6. Mar 27, 2005 #5

    I doesn't converge to a root if |x0| > 1. If I choose |x0| < 1 it does in fact converge to a root. So it's basicially useless for polynomials, since you need to know how big the seed needs to be for it to converge.


    I'm aware of the fact that it is slow. However I was just playing around with some functions and noticed it seemed to converge. To:

    "What do you know about these sort of algorithms? What kind of methods do you think are most effective? I struggle to belive the Newton-Raphson method appropriately used converges so close, have you tried checking the gradient of the function around the area to make sure it's appropriate?"

    I hardly understand half of the words you use, I don't know what methods are the most effective methods. I don't know what a gradient is (at least I don't know what the word means in English, I might know it in Swedish however).


    So this isn't new? I thought it was, since I had never seen it before. Do you know the name of this method for solving equations? I would like to read more, to actually see why it works. I might not understand why it works, but I would like to have a look at it. I agree with you that it's cool to discover things, and I often discover things by just playing around.
  7. Mar 27, 2005 #6
    Looks a lot like fixed point iteration.
  8. Mar 27, 2005 #7


    User Avatar
    Science Advisor
    Homework Helper
    Gold Member
    Dearly Missed

    If I remember correctly, the convergence criterion should be
    [tex]|f(x_{n})-f(x_{n-1})|<k|x_{n}-x_{n-1}|<1, n=1,\cdots[/tex]
    something like that, anyways.
    Last edited: Mar 28, 2005
  9. Mar 27, 2005 #8


    User Avatar
    Science Advisor
    Homework Helper

    I'm sorry but my Swedish isn't that brilliant, I'll ask one of my friends in a couple of days in my maths class if any of them can type in swedish, I'm sure I remember one or 2 of them being able to.
  10. Mar 27, 2005 #9


    User Avatar
    Science Advisor
    Homework Helper
    Gold Member
    Dearly Missed

    Gradienten heter dessverre "gradienten" på svensk..
  11. Mar 27, 2005 #10


    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    for a fixed point scheme to work you need to have |f'(x)|<1 on an interval that contains your initial guess and the solution.

    There is a lot of literature aobut fixed point iteration schemes, just do a google search on fixed point.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook