Finding non trivial solution for a system of equations
19 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Jean Vasco
il 13 Feb 2023
Modificato: John D'Errico
il 13 Feb 2023
I have a system of homogeneous equations and my code is pretty simple:
syms C1 C2 b
% Define the equations
eq1 = C1*(sinh(b)-sin(b))+C2*(cosh(b)-cos(b)) == 0;
eq2 = C1*(cosh(b)-cos(b))+C2*(sinh(b)+sin(b)) == 0;
% Solving the equations
sol = solve(eq1, eq2, C1, C2);
% Printing results
disp(sol.C1);
disp(sol.C2);
The problem is that matlab is only returning the trivial solutions C1 = 0 and C2 = 0 and I need the non trivial solution for the values of C1 and C2.
What should I do?
2 Commenti
Risposta accettata
John D'Errico
il 13 Feb 2023
Modificato: John D'Errico
il 13 Feb 2023
This is called a Homogeneous linear system of equations. They are explicitly linear in the unknowns C1 and C2.
What that means is typically they will have a trivial solution, thus C1 == C2 == 0. But finding the non-trivial solution is not so trivial. That requires a bit more effort, and understanding of the linear algebra. When can a solution exist?
syms b
A = [sinh(b)-sin(b) , cosh(b)-cos(b);
cosh(b)-cos(b) , sinh(b)+sin(b)]
Only when the matrix A is SINGULAR, thus is rank deficient, can ANY solution exist other than the trivial solution with C1=C2=0. This is basic linear algebra. A is a nice, symmetric matrix. It will be singular only of it has a zero eigenvalue. What are the eigenvalues?
lambda = simplify(eig(A))
Next, we can look at those functions. Are they ever zero? The simplest thing to do is plot them. They look very much the same, except that one is a mirror image of the other.
fplot(lambda(1),[-6,1])
fplot(lambda(2),[-1,15])
It looks as if something interesting happens at b==0, but a root clearly exists there. As well, there is a solution at other non-zero locations, where one of the eigenvalues is zero.
B(1) = 0;
B(2) = vpasolve(lambda(1) == 0,-5);
B(3) = vpasolve(lambda(2) == 0,5);
B(4) = vpasolve(lambda(2) == 0,11);
B(5) = vpasolve(lambda(2) == 0,15);
B(6) = vpasolve(lambda(2) == 0,18);
B.'
(I checked. These are not just a simple multiples of pi.) However, the difference between roots will approach pi.
vpa(B.'/pi)
As you can see, the roots approach approximate multiples of pi, actually they rapidly approach the form:
(n+1/2)*pi
What are the values of C1 and C2 at those solutions?
At the trivial solution with b == 0, there are actually two basic solutions, or if you wish, infinitely many solutions, since then A is the matrix of all zeros.
subs(A,b,0)
So any values at all for C1 and C2 will satisfy the problem. But at the other positive solutions for b, we find:
format long g
C12 = zeros(2,4);
for i = 1:4
C12(:,i) = null(double(subs(A,b,B(i+2))));
end
I'll normalize the solutions so that C1 == 1 always, since a homogeneous solution can be arbitrarily scaled by any constant.
C12 = C12./C12(1,:)
As you should see, the solutions rapidly approach C1 = 1, C2 = -1 as we choose larger roots for b. So there are infinitely many solutions.
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Linear Algebra in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!