Finding Roots of a Function
55 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
If I use fzero to find the roots of a function, in one instance I evaluate when x = 4.2 and get a root of 3.6652. In another instance I evaluate the function at x = 4.3 and get a root of 4.7124. Why might these roots be different at such close numbers?
9 Kommentare
Walter Roberson
am 30 Nov. 2018
You can contact John Kelly to request the removal, but removing it would be against policy. In over 7 years, I only know of one case in which it was done, in a situation involving proprietary information revealed by a (non-Mathworks) employee. Historically, we have refused university professors directly asking for students' questions to be removed.
John D'Errico
am 30 Nov. 2018
Bearbeitet: John D'Errico
am 30 Nov. 2018
Suppose I just bought a new car. A nice shiny new one, that has a speedometer that goes to 150 miles per hour. I paid a lot of money for it, so it is time to use my shiny new toy.
Rev it up, pull out onto the freeway, and push that little baby up to 150 MPH. Of course, the nice policeman does not see it my way, that I claim to have not known the speed limit was only 55 mph seems irrelevant to him. So can you let me go and skip the ticket? Lets just forget it ever happened? Hey, those handcuffs hurt!
As I said, I don't think your instructor should get bent out of shape for asking a mathematical question about something that you did not understand. As I said, this did not appear to be a doiit4me, where you were asking for someone to do your work for you. I'd not have answered it in the first place if you did.
Now I don't know where your question arose, in what context. Suppose your homework assignment was to use fzero, starting at two distinct places, and asking why you get significantly different results each time. Then you posted this question, asking for someone to explain exactly what it was your teacher wanted YOU to explain? Clearly you would deserve jail time, or at least need to stand in front of a judge to receive your sentence.
On the other hand, suppose you were using fzero to solve a problem, and noticed this interesting event, but did not understand what was happening? Then asking a question on this or any site would be encouraged, because it arose from your own curiosity about the code. The two cases are fundamentally different, although your instructor may have a hard line on posting any question at all because too many students have chosen to post their homework.
We cannot know which case this is, and only your instructor can serve a sentence. But hiding it under a rug seems wrong.
Antworten (2)
Walter Roberson
am 22 Sep. 2018
You probably used a Newton-style method. Newton-style methods typically involve a prediction step that can overshoot the true root badly enough that the predicted location ends up closer to a different root. This can happen multiple times from a given starting point, and the exact location ended up in can depend upon the numeric accuracy of the calculations, so you can end up finding a root several roots away from the starting one. The details turn out to be one of the significant ways that fractal images are generated.
For information about some papers that study the topic, see https://math.stackexchange.com/questions/34581/bounding-the-basins-of-attraction-of-newtons-method
0 Kommentare
John D'Errico
am 22 Sep. 2018
Close is a relative thing.
For example, suppose you have the function
f_x = @(x) (x-1).*(x-1.5);
Now it should be perfectly clear that it has two roots, one at x==1, and the second at x==1.5. Are they close? Again, it is all relative.
If you start a root finder close to one of the roots, it will find that root. Start it near the other root, and you get the second root. That the two roots are close is just your perception of what "close" means in context.
fzero(f_x,1.28)
ans =
1
fzero(f_x,1.3)
ans =
1.5
So here, I started fzero at two points that were quite "close", yet it finds a different root. Does that make sense? OF COURSE IT DOES!!!!!
In fact, fzero will find one or the other of those roots if I started it out at any point on the real line. So given two roots, and a solver that can find both of them, depending on where I start it out, then there must be at least one location where if I change my start point by some infinitesimal amount, that tiny change will result in finding the other root.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!