How to solve a fourth order algebraic equation?

190 次查看(过去 30 天)
How to solve the value of x for the equation 2x^4+x=34.
Can we solve the fourth order algebraic equations using solve command?
Thanks
  2 个评论
Jaan Raa
Jaan Raa 2020-8-20
How to solve the value of x for the equations: a_0*x^n + a_1*x^(n-1) +...+ a_(n-1)*x + a_n = 0
Can we solve the nth degree using solve commands?
Walter Roberson
Walter Roberson 2020-8-21
For degree 5 or higher, solve() will typically return a data structure the "stands in" for the roots. There are some polynomials of degree 5 or higher that solve() is able to provide exact solutions for, but most of them it cannot handle. This is not due to a limitation of solve() : it has been mathematically proven that degree 5 and higher is not certain to have solutions that are "algebraic numbers"
For degree 3 and degree 4, solve() will sometimes return exact solutions, and other times it will returns the kind of data structure mentioned above that "stands in" for the roots. In the cases where it does not return exact roots, you can pass 'MaxDegree', 3 or 'MaxDegree', 4 to solve() to get exact solutions. However exact solutions for degree 4 are long and there are very few humans that can make sense of the resulting expressions just by reading them.
For degree 2, solve() nearly always returns exact solutions, but every once in a while returns the kind of data structure mentioned above.
In most cases, the data structure "standing in" for the roots is more useful to carry around, at least until you need final answers.

请先登录,再进行评论。

采纳的回答

Star Strider
Star Strider 2015-2-12
It’s easier than that. Create a vector of its coefficients and use the roots function:
% 2x^4+x=18 -> 2x^4 + x -18 = 0
coefvct = [2 0 0 1 -18]; % Coefficient Vector
x = roots(coefvct) % Solution
produces:
x =
-1.7732e+000 + i
41.6666e-003 + 1.7326e+000i
41.6666e-003 - 1.7326e+000i
1.6899e+000 + i
Two real and two complex roots.
  6 个评论
Star Strider
Star Strider 2015-2-13
R7 DR’s ‘Answer’ moved here...
Hi Thanks for the reply.
My equation got changed, now I have to solve two varying constants.
For example
ax^4+x=C
C=20,22,24,26,28,30........50
a=1,2,3...16
Could you please tell me, how to find the 'x' value at different 'C' and 'a' values.
I wrote the code like this...
C = [20:2:50]; % Define ‘C’
X = nan(4, length(C));
a=[1:1:length(C)] % Define ‘a’
for i = 1:length(C)
X(:,i) = roots([a(i) 0 0 1 -C(i)]); % Coefficient Matrix
end
Thanks
Star Strider
Star Strider 2015-2-13
My pleasure.
Don’t use ‘i’ and ‘j’ as variables. MATLAB uses them for its imaginary operators, and using them as variables will cause confusion.
This is easy. You need two nested loops and a redefined preallocation:
C = [20:2:50]; % Define ‘C’
a = 1:16; % Define ‘a’
X = nan(4, length(C), length(a)); % Preallocate ‘X’
for k1 = 1:length(C)
for k2 = 1:length(a)
X(:,k1,k2) = roots([a(k2) 0 0 1 -C(k1)]); % Coefficient Matrix
end
end

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by