0
$\begingroup$

I have a system of nonlinear equations and I want to solve for several variables as a function of $x$. They cannot be algebraically solved (with Solve) and I'm trying to do it in NSolve but I'm wondering if there is a better way as that has not returned any results--just been running for the last 20 minutes or so. The equations are as follows:

eqns = 
{480 (A π^2 + 3375000 E^(1/150 x (-150 + f[x])) Sqrt[2 π] (1/x)^(3/2)) + 24 x f[x] + (1120 π^2 + 51 x) j[x] == 12 x (g[x] + h[x]), 
480 (B π^2 + 3375000 E^(1/150 x (-150 + g[x])) Sqrt[2 π] (1/x)^(3/2)) + 24 x g[x] + (1120 π^2 + 51 x) j[x] == 12 x (f[x] + h[x]), 
480 (F π^2 + 1500000 E^(1/150 x (-100 + h[x])) Sqrt[3 π] (1/x)^(3/2)) + 24 x h[x] + (1120 π^2 + 51 x) j[x] == 12 x (f[x] + g[x]), 
(9 Sqrt[2] E^(1/150 x (-150 + f[x])) + 9 Sqrt[2] E^(1/150 x (-150 + g[x])) + 4 Sqrt[3] E^(1/150 x (-100 + h[x]))) Sqrt[1/x] == 0}

where $A=B=F=10^{-11}$ (for the simplest case, but not equal in general) and I want to solve for $f$, $g$, $h$ and $j$ as functions of $x$. I've tried simply

NSolve[eqns, {f[x], g[x], h[x], j[x]}]

but as I said that didn't return anything. Ideally I'd like to get a numerical solution for $f$, $g$, $h$, $j$ that I can just plug values of $x$ into like you would for a solution with NDSolve. Any ideas? Thanks in advance.

Edit: I reformatted the code to make $eqns$ a function of $x$ and instead removed the $x$-dependence of $f$, $g$, $h$, and $j$, hoping to solve for a few values of $x$ and use InterpolatingFunction, but after 10 or so minutes I get the error "This system cannot be solved with the methods available to NSolve." For example:

eqns[x_] = 
{480 (A π^2 + 3375000 E^(1/150 x (-150 + f)) Sqrt[2 π] (1/x)^(3/2)) + 24 x f + (1120 π^2 + 51 x) j == 12 x (g + h), 
480 (B π^2 + 3375000 E^(1/150 x (-150 + g)) Sqrt[2 π] (1/x)^(3/2)) + 24 x g + (1120 π^2 + 51 x) j == 12 x (f + h), 
480 (F π^2 + 1500000 E^(1/150 x (-100 + h)) Sqrt[3 π] (1/x)^(3/2)) + 24 x h + (1120 π^2 + 51 x) j == 12 x (f + g), 
(9 Sqrt[2] E^(1/150 x (-150 + f)) + 9 Sqrt[2] E^(1/150 x (-150 + g)) + 4 Sqrt[3] E^(1/150 x (-100 + h))) Sqrt[1/x] == 0}

NSolve[eqns[1], {f, g, h, j}]

Are my equations really that complicated? Is there a more powerful method or do I need to look into some different software?

$\endgroup$
  • 2
    $\begingroup$ Tried FindRoot? $\endgroup$ – Marius Ladegård Meyer Sep 20 '16 at 6:59
  • $\begingroup$ fr = FindRoot[eqns[1], {f, 0}, {g, 0}, {h, 0}, {j, 0}] runs fine, note that the fourth equation returns False with eqns[1] /. fr, but it is only 1.57038*10^-21 off. $\endgroup$ – Feyre Sep 20 '16 at 8:07
  • 2
    $\begingroup$ NSolve is originally meant for polynomials or things reducible to polynomials only. Recently it can do more, however. This is useful reading: blog.wolfram.com/2008/12/18/… NSolve and Solve can do this now, I think. But usually it works only if you restrict the domain where to look for the solution. As a first step, look for real solutions only, then look in specific intervals/domains. You have to have a good guess at the domain first. Then there's FindRoot, which uses methods like ... $\endgroup$ – Szabolcs Sep 20 '16 at 8:38
  • $\begingroup$ ... Newton's method. In theory it should give an initial idea. But in practical the biggest problem with your equation is that you are working with extreme numbers and exponentials, which is likely to throw numerical methods off track. As a first step perhaps think about whether you can get rid of this behaviour with some variable changes or whether you can rescale stuff to have things at the order of magnitude of 1 ... then try again. $\endgroup$ – Szabolcs Sep 20 '16 at 8:39
  • $\begingroup$ FindRoot does work, but it gives very inconsistent results depending on AccuracyValue. I do know the approximate domains. I will try to rescale the equations. Thanks! $\endgroup$ – Ecclesiastic Sep 21 '16 at 1:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.