Increase the precision of the finding roots

조회 수: 3 (최근 30일)
Atta Oveisi
Atta Oveisi 2011년 11월 17일
댓글: Walter Roberson 2018년 11월 21일
Hi I have written a m file in which I'm trying to find ROOTs of a polynomial of of 6'th degree.I do this in a cycle using "do" because a parameter in the coefficients of the polynomial have to change in each step and the ROOTs should be calculated and saved for further mathmatical calculations. The problem is that in this exact case of mine the real part of each root is very small so that matlab ignores them in some steps and doesnt ignore in other cases(by cases I mean change of that parameter).and this cause the results to oscillate.I know that this real part despite it's smallness is'nt zero. HOW CAN I INCREASE THE PRECISION IN THIS EXACT CASE? thanks for your attention.

채택된 답변

Walter Roberson
Walter Roberson 2011년 11월 17일
If the function uses its own precision, then we would need to see the function in order to see how to increase the precision. There is not just one method for doing extended precision calculations.
If you have access to the symbolic toolbox, consider using that for the calculations.
Note: in any finite precision calculation scheme, there are calculations that will oscillate in the manner you describe.
  댓글 수: 4
Dima
Dima 2018년 11월 21일
Try
roots(conv(conv([1 -2 1],[1 -2 1]),[1 -2 1]))
There is still a problem with multiple roots.
Walter Roberson
Walter Roberson 2018년 11월 21일
You are correct that roots does not do a good job on that . solve(poly2sym()) of the vector produces exact solutions though .

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Andrew Newell
Andrew Newell 2011년 11월 17일
Unless this is an exercise, you could just use roots to solve your problem.
  댓글 수: 3
Andrew Newell
Andrew Newell 2011년 11월 17일
I'm just saying that if you don't have any compelling reason to write the m file yourself, you'd be better off using the MATLAB function.
Atta Oveisi
Atta Oveisi 2011년 11월 17일
I myself want to use "root" but the roblem is this function use it's own number of precision.my question is how to increase this.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Number Theory에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by