# Numerical solution of a system of two exponential equations

I need to solve this two equations for x and y:

(sum ((i^2)e^(-x i - y i^2)), i = 1 to 6)/sum (e^(-x i - y i^2)), i = 1 to 6) = 12

(sum ((i)e^(-x i - y i^2)), i = 1 to 6)/sum (e^(-x i - y i^2)), i = 1 to 6) = 3


I've tried to use NSolve and find real solutions for x and y

NSolve[
{Sum[k E^(k^2*(-y) - k x), {k, 1, 6}]/Sum[E^(k^2*(-y) - k x), {k, 1, 6}] == 3,
Sum[k^2*E^(k^2*(-y) - k x), {k, 1, 6}]/Sum[E^(k^2*(-y) - k*x), {k, 1, 6}] == 12}, {x, y}, Reals]


but I got the message:

NSolve: Requested precision R is not a machine-sized real number between MinPrecision and MaxPrecision"

How do I proceed?

• Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour and check the faqs! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! – Chris K Oct 25 '18 at 1:22
• Could you add your code, which would help people find the problem? – Chris K Oct 25 '18 at 1:22
• NSolve[{Sum[kE^(k^2*(-y) - kx), {k, 1, 6}]}/{Sum[E^(k^2*(-y) - kx), {k, 1, 6}]} == 3, {x, y}, {Sum[k^2*E^(k^2*(-y) - kx), {k, 1, 6}]}/{Sum[E^(k^2*(-y) - k*x), {k, 1, 6}]} == 12, {x, y}, Reals] – Matheus Oct 25 '18 at 1:34

A few problems with your code:

1. Curly braces {} can't be used as parentheses ().
2. You need a space or * between k and x to multiply them, otherwise Mathematica thinks it's a new variable kx.
3. The syntax of NSolve has a list of equations as the first argument, and a list of unknowns -- {x,y} here -- as the second argument.

The following seems to work:

NSolve[{
Sum[k E^(k^2*(-y) - k x), {k, 1, 6}]/Sum[E^(k^2*(-y) - k x), {k, 1, 6}] == 3,
Sum[k^2*E^(k^2*(-y) - k x), {k, 1, 6}]/Sum[E^(k^2*(-y) - k*x), {k, 1, 6}] == 12},
{x, y}, Reals]
(* {{x -> 0.440365, y -> -0.0399564}} *)