I tried to use Solve
to solve a set of nonlinear equations and got this error:
Solve was unable to solve the system with inexact coefficients or the system obtained by direct rationalization of inexact numbers present in the system. Since many of the methods used by Solve require exact input, providing Solve with an exact version of the system may help.
Has anyone encountered this problem before? I am new to Mathematica and don't know how to fix it.
d = 0.02;
l = 1.5*10^(-4);
a = Exp[-2*Pi*k*d/l];
c = 4*Pi*n*d/l;
R = ((n - 1)^2 + k^2)/((n + 1)^2 + k^2);
Solve[{(a^2*(1 - R)^2)/(1 - 2*a^2*R*Cos[c] + a^4*R^2) == 0.56,
R (1 + a^4 - 2*a^2*Cos[c])/(1 - 2*a^2*R*Cos[c] + a^4*R^2) == 0.06},
{n, k}, Reals]
1/2
rather than floating point numbers such as0.5
. $\endgroup$Solve
actually return a solution? Did it return unevaluated?Solve
is mainly useful for polynomial equations and other relatively simple equations for which there are closed forms. IfSolve
doesn't work, you can always tryReduce
,NSolve
, orFindRoot
. $\endgroup$FindRoot
, because your functions are complicated enough that numerical solutions are required. However, the way that you've defined your parameters makes the functions numerically intractable, given that there are exponentials that look likeExp[-3000 k]
that vary a lot with changes ink
. I recommend re-scaling your variables to make this nicer. $\endgroup$Pind
andPikd
. $\endgroup$