30 lines
539 B
Matlab
30 lines
539 B
Matlab
clc
|
|
syms l
|
|
X = [1/(3+l); (-1)/(1-l); (-1)/(2-l)]
|
|
|
|
a1 = (3+l)^2;
|
|
a2 = (1-l)^2;
|
|
a3 = (2-l)^2;
|
|
|
|
t1 = a2*a3
|
|
t2 = a1*a3
|
|
t3 = a1*a2
|
|
t4 = a1*a2*a3
|
|
|
|
c1 = (coeffs(t1, 'All'))
|
|
c2 = (coeffs(t2, 'All'))
|
|
c3 = (coeffs(t3, 'All'))
|
|
c4 = (coeffs(t4, 'All'))
|
|
|
|
ctot = coeffs(t1+t2+t3-t4, 'All')
|
|
|
|
sol = double(solve(t1+t2+t3-t4==0, l, 'Real', true))
|
|
|
|
for i=1:size(sol, 1)
|
|
Xi = double(subs(X,l,sol(i)))
|
|
Li = sol(i);
|
|
Ci = norm(Xi, 2)^2 - 1;
|
|
Yi = sum(Xi .* Xi .* [-3;1;2]) + sum(2 * Xi);
|
|
fprintf("lambda=%.03f ci=%g y=%g", Li, Ci, Yi);
|
|
end
|
|
|