I am trying to numerically find the root of a function that looks a bit like: 1/x - (SchurDecomposition[A[x]][[2]])[[1]], where A is some matrix using the syntax
FindRoot[f[x], {x,3}],
where
f[x_?NumericQ] = 1/x - (SchurDecomposition[A[x]][[2]])[[1]]
However when I monitor the values of x evaluated using the option StepMonitor :> Print[x], the first value that appears is far away (e.g. 6) from my specified start point (i.e. 3). Does anybody understand why it is doing this? This is an issue since the value being used (in my example 6) lies far away from the attractor basin of the function and hence FindRoot is giving me a wrong result. The initial starting value (in my example 3) lies very close to the root as I can see by plotting the function. In practice my numbers are a bit different and the function to calculate the matrix A quite complicated, however these have been extensively verified and I am sure they are working correctly.
Thanks for your help.
FindRootdoes what any good general-purpose root finder will do: it begins by attempting to bracket a root, any root. (One method is to search to the left and right of a starting point, doubling the step size at each stage, until the function attains values of opposite signs.) You can control this by specifying a bracket yourself via the optionMethod -> "Brent": see the help page. – whuber Mar 11 at 15:40FindRoot[lhs==rhs,{x,Subscript[x, start],Subscript[x, min],Subscript[x, max]}]searches for a solution, stopping the search ifxever gets outside the rangeSubscript[x, min]toSubscript[x, max]. – Stephen Luttrell Mar 11 at 15:433 - f[3]/f'[3](the first step in Newton's Method)? WithoutAno one can really test your code. – Michael E2 Mar 11 at 15:46SchurDecompositionterm and then use this in the definition off[x]instead. – Matthew Mar 11 at 16:53