The inverse of a function numerically with N-terms
10 次查看(过去 30 天)
显示 更早的评论
Hi, this is an extension of this post https://uk.mathworks.com/matlabcentral/answers/441843-how-to-find-the-inverse-of-a-function-numerically
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.
0 个评论
采纳的回答
更多回答(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 个评论
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.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Number Theory 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!