How to make solve stop when a non-trivial solution is first found

5 views (last 30 days)
I have a system of quadratic equations I would like to solve, something like below:
syms q11 q12 q13 q21 q22 q23 q31 q32 q33
[q11_sol, q12_sol, q13_sol, q21_sol, q22_sol, q23_sol, q31_sol, q32_sol, q33_sol] = ...
q11*q22 == q12*q21*((T(1,1)*T(2,2))/(T(2,1)*T(1,2))), ...
q22*q33 == q23*q32*((T(2,2)*T(3,3))/(T(3,2)*T(2,3))), ...
q11*q33 == q13*q31*((T(1,1)*T(3,3))/(T(3,1)*T(1,3))), ...
q31^2 + q32^2 + q33^2 == 1, ...
q21^2 + q22^2 + q23^2 == 1, ...
q11^2 + q12^2 + q13^2 == 1, ...
q21*q31 + q22*q32 + q23*q33 == 0, ...
q11*q31 + q12*q32 + q13*q33 == 0, ...
q11*q21 + q12*q22 + q13*q23 == 0);
where T is some matrix I defined.
My issue is that solving this system takes a long time, and I just want one non-trivial solution (just one solution that doesn't have 0's or 1's or -1's in it).
Is there a way for me to tell the solve function to stop when a non-trivial solution is first found?
Tommi Muller
Tommi Muller on 1 Jun 2020
I mentioned that T is some predefined 3x3 matrix, but let's say for example that:
T = [-2/15, 8, 4; 2/5, -6, 6; -1/30, -1, 1/4];

Sign in to comment.

Accepted Answer

Abhisek Pradhan
Abhisek Pradhan on 5 Jun 2020
solve by default returns one of the many solutions. Now the problem lies in getting a solution which is not trivial. the following, link may help in working with full solution.

More Answers (0)





Community Treasure Hunt

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

Start Hunting!