Roots of a fractional polynomial with solve()
Show older comments
Hello everybody,
I'm looking for another method to solve this problem:
I have to find roots of a fractional polynomial:
syms mu real;
sum(lambda./(lambda-mu));
mu=double(solve(sum(lambda./(lambda-mu))/M-1/c==0,mu,'Real', true));
I used the function solve to find its roots. It's good but so slow! My polynom has a degree of 100 and i have to repeat this code in several random experiences.
Does anyone of you know a faster function which could do the same thing? I can't use fzeros().
Thanks for your help!
4 Comments
Mischa Kim
on 12 Jan 2014
Just curious, why can't you use fzero ? Are you required to code it yourself?
GOPAL SINGH
on 1 Nov 2019
plzz provide with some examples?
Walter Roberson
on 2 Nov 2019
GOPAL SINGH as this question is 5 years old now, it would help if you were to explain more what you would like to have some examples of ?
Accepted Answer
More Answers (1)
Mischa Kim
on 12 Jan 2014
Edited: Mischa Kim
on 12 Jan 2014
0 votes
Are you required to find all roots (<= 100!)?
At any rate, I'd recommend plotting the function to get a first impression on where some of the roots are located at and to be able to get starting values for the search(es). I am positive that you can use fzero to find some (if not all of the) roots, possibly in combination with a loop.
10 Comments
Alain
on 12 Jan 2014
Mischa Kim
on 12 Jan 2014
Now I understand. This bit of info just raised the level of complexity of the problem by an order of magnitude. Although MATLAB definitely is the tool to go with it is really the particular algorithm you are looking for to solve this class of problems. Let me see what I can dig up. Definitely one of the most interesting questions I have come across in this forum.
Alain
on 14 Jan 2014
Mischa Kim
on 14 Jan 2014
I might have some sort of a strategy, provided that the polynomials are somewhat well-behaved:
- Find all extrema of the polynomial using, e.g., the method/function presented here. Check out the third figure from the top. With this info you should be able to get good starting values for the searches.
- Solving for the roots of N experiments to me looks like a perfect problem for parallelization. Use the Parallel Computing Toolbox or, even better, the MDCS to speed up your algorithm.
What do you think?
Alain
on 14 Jan 2014
Mischa Kim
on 14 Jan 2014
Edited: Mischa Kim
on 14 Jan 2014
- Yep. Once you have all the extrema, you have pretty good starting values for all the roots. E.g., mid points between extrema. Then simply loop through all the starting values to get the roots with fzero.
- You might have the toolbox on your institution's license. If not you might qualify for a trial.
Let us know how this all panned out.
Mischa Kim
on 15 Jan 2014
Edited: Mischa Kim
on 15 Jan 2014
I see. That's what I meant with well behaved. But I would not give up at this point.
- Could you attach code, or maybe better, a plot of a typical polynomial?
- Do the root locations change "much" when changing parameters?
Alain
on 15 Jan 2014
Bjorn Gustavsson
on 15 Jan 2014
Why give up when finding consecutive extremas lower (or larger) than 0, you still know that the root has to be between two extremas with varying sign, right? It might be unnecessarily time-consuming to find all when you can only utilize some, but it would still have some information you could use...
Categories
Find more on Polynomials in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!