Solve overdetermined system of nonlinear symbolic equations with square root

1 view (last 30 days)
Hi all,
I have a problem with the symbolic solve function for a system of non-linear symbolic. It doesn't yield a solution in a very specific case concerning a square root, which I don't understand. I hope someone can shed some light as to what is the problem. Problem is in eq1.
Equations 2-5 show what comparable systems do yield solutions. The difference between eq 1 and 5 is taking the absolute value of x and y under the square root, but since the values can be directly found from the rest of the system, I don't see why this should matter. Passing 'IgnoreAnalyticConstraints', true to solve does not solve the problem, and the order of equations is also not important. Comparable systems that do not involve square roots also don't have this problem.
syms x y z
% This does NOT yield a solution
solve([(x^2 + y^2)^(1/2)==5; x == 3; y==z; z==4]) % eq1 Square root, redundant equations
% This does yield solutions
solve([(x^2 + y^2)==25; x==3; y==4]) % eq2 No square root, no redundant equations
solve([(x^2 + y^2)==25; x==3; y==z; z==4]) % eq3 No square root, redundant equations
solve([(x^2 + y^2)^(1/2)==5; x==3; y==4]) % eq4 Square root, no redundant equations
solve([hypot(x, y)==5; x==3; y==z; z==4]) % eq5 Hypot expands into square root of sum of squares of ABSOLUTE values
So, what intricacies of the solver am I missing that don't allow a correct solution to be found?
Kind regards,
Joost Meulenbeld

Answers (1)

Walter Roberson
Walter Roberson on 12 Mar 2018
Without the sqrt(), the symbolic engine can use its polynomial solvers, which are designed to find all solutions.
With the sqrt() you have a nonlinear equation. With nonlinear equations "If at first you don't succeed, give up."

Community Treasure Hunt

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

Start Hunting!