seven roots of an equation

조회 수: 2 (최근 30일)
Eemil Sakki
Eemil Sakki 2021년 11월 15일
댓글: Eemil Sakki 2021년 11월 15일
Hi,
I need to find the seven roots of omega of this equation (picture), but I don't know how to get the summation tool to work with both beta and lambda having six values. The rhoo (reactivity) is input from user and capital lambda is a known value.
code:
s = 10^-4;
reactivity = 'What is the step reactivity in pcm? ';
x = input(reactivity)*10^-5;
b = [24 123 117 262 108 45];
l = [0.0127 0.031 0.116 0.3106 1.4006 3.876];
o=0;
syms k
a = vpasolve(x==o*(s+symsum(b(k)/(o+l(k)),k,1:6)),o)

채택된 답변

John D'Errico
John D'Errico 2021년 11월 15일
편집: John D'Errico 2021년 11월 15일
Your equation is:
What you have done in code is terribly confusing. There is no need to use symsum.
Can we assume that b is beta?
Can we assume that l is the subscripted lambda?
I will guess the variable you called o, which you then set to ZERO? is that your unknown, thus omega?
Is s the value of capital Lambda?
Let me see.in the picture of the equation, we see a capital Lambda, and then a subscripted Lambda.
And of course, you don't tell us what is the reactivity that you would use.
Next, you should learn that 10^-5 is most easily written as 1e-5 and likewise, 10^-4 is just 1e-4.
So let me guess this is what you need to do. But it is a completely wild guess.
reactivity = 17; % I just picked an arbitrary number here
Rho = reactivity*1e-5;
CapLambda = 1e-4;
Beta = [24 123 117 262 108 45];
Lambda = [0.0127 0.031 0.116 0.3106 1.4006 3.876];
Now, your unknown variable is apparently Omega.
syms Omega
Define the equation using Omega, and all of the other values. You should see that symsum was not used. sum is sufficient, as these are just vectors.
EQ = Rho == Omega*(CapLambda + sum(Beta./(Omega + Lambda)))
EQ = 
Note that the symbolic toolbox decided to display those floating point numbers as the ratios of integers. It will do that.
Finally, solve for Omega. Since we know this equation is equivalent to a 7th degree polynomial, we will just use vpasolve, as such a polynomial cannot be factored in algebraic form to find its roots.
OmegaSol = vpasolve(EQ,Omega)
OmegaSol = 
There are the 7 distinct roots of that equation. Only one of them is a positive value.
  댓글 수: 1
Eemil Sakki
Eemil Sakki 2021년 11월 15일
Hi,
Thanks! You understood the assigment perfectly. One can probably see that I haven't used matlab in a while :) and suddenly had a mandatory homework in quite short notice which required a matlab code as answer. Didn't remember even the easiest commands... Will have to start learning again.
Thanks again!

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

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by