# The inverse of a function numerically with N-terms

조회 수: 16(최근 30일)
BeeTiaw 2019년 1월 28일
편집: BeeTiaw 2019년 1월 28일
The correct answer has been provided that is by multipying the function with the highest exponent. For example, this function can be transformed into polynomial by multpying it by the highest exponent of ζ, i.e. , which will gives The solution for can be easily obtained using "roots".
Now, if the function is written in its generalised form How do we find the generalised form of function, for example for or ?
I am trying to write a code that can take any number of terms.

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

### 채택된 답변

Torsten 2019년 1월 28일
p = [b*fliplr(m((N+2)-N:(2*N)-N)),b+a*m(1),-z,a+b*m(1),b*m(N-(N-2):N-0)];
roots(p)
##### 댓글 수: 2표시숨기기 이전 댓글 수: 1
BeeTiaw 2019년 1월 28일
Torsten this is correct!
just one minor mistake that the frist component should be multiply with instead of So, the correct code is
p = [a*fliplr(m((N+2)-N:(2*N)-N)),b+a*m(1),-z,a+b*m(1),b*m(N-(N-2):N-0)];
roots(p)
I have tried it even for N = 5, it gives me the correct coefficient!
Even for N = 11 and N = 17!
Thanks!
This is the real reason why I posted the question. It is not the same question as before! you have proved it!

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

### 추가 답변(1개)

John D'Errico 2019년 1월 28일
편집: John D'Errico 2019년 1월 28일
I'm confused as to what your question is, since I answered the last question. Then you asked essentially the same question.
There is no general solution to this problem. In fact, it can be proved there can never be an analytical solution in general for an equation of degree 5 or higher. Why? because you can always resove the problem by multiplying by the largest negative exponent, which is valid as long as zeta is non-zero.
The result will be some general polynomial equation, but if the degree is higher than 4 (i.e., 5 or larger) then the Abel-Ruffini theorem comes into play, where it was proven that no algebraic solution will exist for that problem in terms of radicals. (Yes, there can be some relatively rare cases where a higher order polynomial does have a solution in terms of radicals. But those cases will be rare.)
So the very best you can do is multiply by some power of zeta. Colllect coefficients. Then call roots for any value of z you wish. There can be NO better solution. NO more general solution can ever exist, as long as the polynomial degree of your problem is 5 or greater.
Sorry, but asking the same question will not get you a better answer.
##### 댓글 수: 5표시숨기기 이전 댓글 수: 4
BeeTiaw 2019년 1월 28일
But the the general solution has been given by Torsten above.
Using his proposed solution, we can find the coefficient directly, without doing the algebra, for any number of N.
I have tried it even for N = 11 and it works.
This one is the general solution. Just one liner and it does the job.
p = [a*fliplr(m((N+2)-N:(2*N)-N)),b+a*m(1),-z,a+b*m(1),b*m(N-(N-2):N-0)];
roots(p)

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

### Community Treasure Hunt

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

Start Hunting!