2
$\begingroup$

I am trying to solve a system of equations of the form:

NSolve[{fs1[{x, y, z}] - 2*l*x == 0, fs2[{x, y, z}] - 2*l*y == 0, fs3[{x, y, z}] - 2*l*z == 0, x^2 + y^2 + z^2 == 1}, {x, y, z, l}, Reals]

where $f_{s1}$, $f_{s2}$ and $f_{s3}$ are polynomials of order $N=192$ in $x,y$ and $z$. Obviously there are a lot of solutions and Mathematica will take a long time to find all of them. However, I'm not interested in finding every solution, just 'enough'.

Is there any way I can terminate NSolve after say $7200$ seconds ($2$ hours) and get Mathematica to return the solutions that it found up to that point? I previously attempted to use TimeConstrained[NSolve[...],7200] but that just returns $Aborted.

Below is an example of fs1 etc.:

fs1[\[Xi]_] := 
 1/n*Sum[Sum[GegenbauerC[\[Nu] - 1, 1.5, 
      Dot[\[Xi], {terX[[i]], terY[[i]], 
        terZ[[i]]}]]*terX[[i]], {\[Nu], 1, Subscript[N, 
     s]}], {i, 1, n}]

fs2[\[Xi]_] := 
 1/n*Sum[Sum[GegenbauerC[\[Nu] - 1, 1.5, 
      Dot[\[Xi], {terX[[i]], terY[[i]], 
        terZ[[i]]}]]*terY[[i]], {\[Nu], 1, Subscript[N, 
     s]}], {i, 1, n}]


fs3[\[Xi]_] := 
 1/n*Sum[Sum[GegenbauerC[\[Nu] - 1, 1.5, 
      Dot[\[Xi], {terX[[i]], terY[[i]], 
        terZ[[i]]}]]*terZ[[i]], {\[Nu], 1, Subscript[N, 
     s]}], {i, 1, n}]

where $N_s=192, n=4500$ and terX, terY and terZ are just vectors containing $n$ coefficients.

$\endgroup$
3
  • $\begingroup$ @Bill, FindInstance, seems to find an analytical solution. I can't find anything in the documentation about making it find a numerical solution instead. $\endgroup$ Commented May 14, 2024 at 12:57
  • $\begingroup$ @Bill, I've just edited the question to include the form of the functions $\endgroup$ Commented May 29, 2024 at 16:40
  • 1
    $\begingroup$ updated in 14.0: NSolve has a MaxRoots option to specify the number of roots you want to find $\endgroup$ Commented May 29, 2024 at 21:06

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.