The inverse of a function numerically with N-terms

10 次查看(过去 30 天)
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".
Follow up question
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
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 个评论
BeeTiaw
BeeTiaw 2019-1-28
编辑: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
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 个评论
John D'Errico
John D'Errico 2019-1-28
No matter what, you need to do some algebra, although the symbolic toolbox can do that for you of course. Lacking the symbolic toolbox, you could actually do much of this work with my own sympoly toolbox, as found on the file exchange for free download. But using syms:
syms a m1 m2 zeta z b
E = -z + a*(1/zeta + m1*zeta + m2*zeta^2) + b*(zeta + m1/zeta + m2/zeta^2);
collect(E*zeta^2,zeta)
ans =
a*m2*zeta^4 + (b + a*m1)*zeta^3 - z*zeta^2 + (a + b*m1)*zeta + b*m2
If a, b, m1, m2 have values, you could have substituted them.
flip(coeffs(collect(E*zeta^2,zeta),zeta))
ans =
[ a*m2, b + a*m1, -z, a + b*m1, b*m2]
So this is a form that roots could use, as long as all of the coefficients are fully numeric, thus double precision.
The above would have worked for higher orders too. Of course, be VERY careful in just trying to do this for high degree polynomials. You need to not jump into the deep section of the pool too fast here. For example, when I see this:
a = -2.0800
that tends to imply to me that a is a number, known only to within +/- 0.00005. But then you have a problem, because solving for the roots of a high degree polynomial, when the coefficients are not known to a high precision will be an ill-posed problem, in the sense that it may greatly amplify any uncertainties in the coefficients.
BeeTiaw
BeeTiaw 2019-1-28
编辑: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)

请先登录,再进行评论。

类别

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