Group Abstract Group Abstract

Message Boards Message Boards

1
|
7.5K Views
|
5 Replies
|
6 Total Likes
View groups...
Share
Share this post:

How to improve the choice for the starting point in NSolve and FindRoot??

Posted 11 years ago
POSTED BY: Daniel Branco
5 Replies

The claim about starting points is baffling (and certainly not carefully tested). Try printing the starting point at each iteration. You will notice below that starting points in each iteration come from immediately prior results.

In[74]:= FoldList[(Print[#1]; 
   x /. FindRoot[x^2 - #2*x + 1, {x, #1}]) &, .5, Range[3, 6]]

During evaluation of In[74]:= 0.5

During evaluation of In[74]:= 0.38196601125

During evaluation of In[74]:= 0.267949192431

During evaluation of In[74]:= 0.208712152522

Out[74]= {0.5, 0.38196601125, 0.267949192431, 0.208712152522, \
0.171572875254}
POSTED BY: Daniel Lichtblau
Posted 11 years ago

I didn't use explicitly the Print function, what I did was:

In[41]:= FoldList[x /. FindRoot[x - #1, {x, #1}] &, .5, Range[3, 6]]
Out[41]= {0.5, 0.5, 0.5, 0.5, 0.5}

The solution of the equation inside FindRoot is #1, and, looking the output, #1 is always 0.5... What is wrong with this reasoning??

POSTED BY: Daniel Branco

It's a different set of equations from before. In this case each one has .5 as solution and each has .5 as starting point. Since solutions and starting points are all the same, I have no idea what conclusion might be drawn from this in regards to whether the starting point is selected from prior solutions or from the initial starting point.

POSTED BY: Daniel Lichtblau
Posted 11 years ago
POSTED BY: Daniel Branco

FoldList can be useful for this sort of thing.

FoldList[x /. FindRoot[x^2 - #2*x + 1, {x, #1}] &, .5, 
 Range[3, 6]]

(* Out[76]= {0.5, 0.38196601125, 0.267949192431, 0.208712152522, \
0.171572875254} *)
POSTED BY: Daniel Lichtblau
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard