Q:

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?

A:

A few problems with your code:

Curly braces {} can't be used as parentheses ().
You need a space or * between k and x to multiply them, otherwise Mathematica thinks it's a new variable kx.
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}} *)

