0

I am currently trying to locate the roots of the function

f(x)=Re[(-1 + e^(2 i x))^8 (-i + e^(2 i x) x)^8]=0

numerically using python 2.7. By studying the book 'Numerical methods in engineering with python 3" I have employed a root search which locates values x1 and x2 of x between which the function changes sign. I have plotted the function in Mathematica and my program correctly locates most of the roots (I would include a plot of this function but I haven't got the reputation points).

However it fails to locate the 'double roots', (in the case of f(x)=0, they are located at -Pi and Pi). Clearly this is because around these roots the function doesn't change sign. In fact I suppose in general, this method fails to locate roots with even multiplicity.

Is there any way I can locate double roots of functions such as this without calculating the derivative f'(x) (I.e. using Newton Raphson method)? I realise in this case, the derivative is very easy to calculate. However, I will be dealing with much more complex functions for which calculating the derivative is not feasible.

Any help would be greatly appreciated!

nhahtdh
  • 55,989
  • 15
  • 126
  • 162
  • While I'm by no means an expert on numerical methods, I think you could calculate your "derivative" numerically, by subtracting a very small amount from the independent variable and evaluating the function there. Of course, that only works if the function is "stable" enough in that region – loopbackbee Sep 04 '14 at 11:30
  • Thanks for your help! Do you mean that I could calculate the "gradient" at each point? I see how I could obtain a large set of gradients for my function. But the Newton-Raphson method requires a symbolic expression for the derivitive. – ggarforth Sep 04 '14 at 12:25
  • Or do you mean using some estimate. Eg. f'(x)=(f(x+0.001)-f(x-0.001))/(2*0.001) – ggarforth Sep 04 '14 at 12:32
  • I think you will find that the Newton-Raphson method requires that you can calculate the derivative at a given x. You are right that you can do this 'accurately' if you can identify the derivative function at point x (if one exists), but you can us the numeric value, by calculating x-d and x+d and calculating the gradient - so long as d is small this will be accurate (if your formula is stable). – Tony Suffolk 66 Sep 04 '14 at 12:37
  • Great. Yes, I understand. Just to clarify, my limited understanding of the Newton-Raphson method is that it does not require functions to intersect the x axis (i.e for there to be a change of sign) in order to find roots; that is double roots can be found. Is this correct? – ggarforth Sep 04 '14 at 12:51

0 Answers0