Numerical Approximation in Java I am trying to solve an equation which I believe cannot be done analytically, but can use a numerical approximation to get a result. The equation is:
$$\frac{2*\sqrt{\pi}*h*s*e^{m^{2}/(2*s^2)}}{\sqrt{2}} = a$$
where $h, m,$ and $a$ are given constants. This is for a project that I'm writing in Java, and it would be infeasible to grab the solution output from another program such as Matlab, Mathematica, or some other scientific computing language for a couple reasons, one of which is that I will have to solve this equation hundreds of times with different values. Basically I am wondering if anybody knows of a library I can easily import and use for this kind of problem, and to possibly spell out how I would go about doing that. So far I have been looking through math libraries such as Apache Commons Math but cannot find out if they are appropriate. Thanks!
You are asking how to solve $e^{ax^2}=b$ for $x$, given constants $a,b$.  The solution is $x=\sqrt{\frac{1}{a} \log b}$, which can be computed (approximately) using standard algorithms for computing the log and the square root.

In particular, your specific equation has the solution

$$m = \sqrt{2s^2 \log (a/(\sqrt{2\pi} hs))}.$$

You can verify the correctness of this solution by plugging into the equation and verifying it works.