How to Speed Up Code for Solving Complex Equations. As shown in the figure below, the code takes nearly 10 minutes to obtain a solution. How can I improve the running efficiency?
Converting to an equivalent computational process and using a custom function for the calculation is much faster. Thank you — that’s an excellent method, and it has solved the problem.
I suppose I should have mentioned that what guided me was old-Mathematica, when polynomial systems and systems that could be converted to polynomial systems were the principal strength of Mathematica in symbolic equation-solving. The complex (numbers) function Abs[] that appears in Norm[] adds a level of complexity that apparently invokes a lot of algebra or a lot of checking, or both. While equation-solving has greatly improved over the years, this drawback of using Norm[] in real-algebraic equations has persisted. Similarly, Sqrt[] means extra branch-checking and extra time. The Reals specification means that Reduce[] has to check that the value of each Sqrt[] is real in its operations.