1
$\begingroup$

I'm trying to solve the following for x and y, but the evaluated cell just gives me back what I tried to solve, just a little more simplified. If both x and y were bounded from [0,5], how would I solve for them with this equation?

NSolve[(-(100/33)
         E^(-4 ((-4.5` + x)^2 + (-1.5` + y)^2)) (-4.5` + x) + 
      95/264 E^(-(-2.8` + x)^2 - (-3.7` + y)^2) (-2.8` + x) - 
      0.9166666666666666` E^(-1.21` ((-1 + x)^2 + (-3.5` + 
            y)^2)) (-1 + x) - (50 (-4.25` + x))/(
      33 (1 + 4 ((-4.25` + x)^2 + (-4.1` + y)^2))^(3/2)) + (
      0.00946969696969697` (-2.75` + x))/Sqrt[
      1 + 0.25` ((-2.75` + x)^2 + (-3.75` + y)^2)] - (
      0.6875` (-3 + x))/(1 + 1.21` ((-3 + x)^2 + (-2 + y)^2))^2 - (
      0.8522727272727273` (-2.5` + x))/(1 + 
        2.25` ((-2.5` + x)^2 + (-1.8` + y)^2))^2 - (
      2.392992424242424` (-1 + x))/(1 + 
        3.61` ((-1 + x)^2 + (-1 + y)^2))^(
      3/2))*(450 (-2.4` + y)) - (-((50 (-4.1` + y))/(
       33 (1 + 4 ((-4.25` + x)^2 + (-4.1` + y)^2))^(3/2))) + (
      0.00946969696969697` (-3.75` + y))/Sqrt[
      1 + 0.25` ((-2.75` + x)^2 + (-3.75` + y)^2)] + 
      95/264 E^(-(-2.8` + x)^2 - (-3.7` + y)^2) (-3.7` + y) - 
      0.9166666666666666` E^(-1.21` ((-1 + x)^2 + (-3.5` + 
            y)^2)) (-3.5` + y) - (
      0.6875` (-2 + y))/(1 + 1.21` ((-3 + x)^2 + (-2 + y)^2))^2 - (
      0.8522727272727273` (-1.8` + y))/(1 + 
        2.25` ((-2.5` + x)^2 + (-1.8` + y)^2))^2 - 
      100/33 E^(-4 ((-4.5` + x)^2 + (-1.5` + y)^2)) (-1.5` + y) - (
      2.392992424242424` (-1 + y))/(1 + 
        3.61` ((-1 + x)^2 + (-1 + y)^2))^(3/2))*(121 (-4 + x) + 
      121 (-1 + x)) == 0, {x, y}, Reals]

Even if i just try solving for x or y it gives the same equation back, so i'm not sure how to fix this.

$\endgroup$
  • 2
    $\begingroup$ I only see one equation. One equation can not be solved for two unknowns. $\endgroup$ – m_goldberg Nov 15 '19 at 0:21
  • $\begingroup$ Well, you can solve it but the question is what you expect as the solution. Assume you have a simple equation x^2 + y^2 - 1 == 0. The solutions are all points that lie on the circle with radius 1. So NSolve can, at the most, give you one specific solution which is only one example of the infinite set of solutions. I'm not sure the OP is aware of this and their equation is vastly more complex. $\endgroup$ – halirutan Nov 15 '19 at 0:28
6
$\begingroup$

As noted in the comments, this is only a single equation, and it cannot be solved exactly for $x$ and $y$. But if you want, you can see all the possible solutions in a particular portion of the $xy$-plane by using ContourPlot:

ContourPlot[(-(100/33)
         E^(-4 ((-4.5` + x)^2 + (-1.5` + y)^2)) (-4.5` + x) + 
      95/264 E^(-(-2.8` + x)^2 - (-3.7` + y)^2) (-2.8` + x) - 
      0.9166666666666666` E^(-1.21` ((-1 + x)^2 + (-3.5` + 
            y)^2)) (-1 + x) - (50 (-4.25` + x))/(
      33 (1 + 4 ((-4.25` + x)^2 + (-4.1` + y)^2))^(3/2)) + (
      0.00946969696969697` (-2.75` + x))/Sqrt[
      1 + 0.25` ((-2.75` + x)^2 + (-3.75` + y)^2)] - (
      0.6875` (-3 + x))/(1 + 1.21` ((-3 + x)^2 + (-2 + y)^2))^2 - (
      0.8522727272727273` (-2.5` + x))/(1 + 
        2.25` ((-2.5` + x)^2 + (-1.8` + y)^2))^2 - (
      2.392992424242424` (-1 + x))/(1 + 
        3.61` ((-1 + x)^2 + (-1 + y)^2))^(
      3/2))*(450 (-2.4` + y)) - (-((50 (-4.1` + y))/(
       33 (1 + 4 ((-4.25` + x)^2 + (-4.1` + y)^2))^(3/2))) + (
      0.00946969696969697` (-3.75` + y))/Sqrt[
      1 + 0.25` ((-2.75` + x)^2 + (-3.75` + y)^2)] + 
      95/264 E^(-(-2.8` + x)^2 - (-3.7` + y)^2) (-3.7` + y) - 
      0.9166666666666666` E^(-1.21` ((-1 + x)^2 + (-3.5` + 
            y)^2)) (-3.5` + y) - (
      0.6875` (-2 + y))/(1 + 1.21` ((-3 + x)^2 + (-2 + y)^2))^2 - (
      0.8522727272727273` (-1.8` + y))/(1 + 
        2.25` ((-2.5` + x)^2 + (-1.8` + y)^2))^2 - 
      100/33 E^(-4 ((-4.5` + x)^2 + (-1.5` + y)^2)) (-1.5` + y) - (
      2.392992424242424` (-1 + y))/(1 + 
        3.61` ((-1 + x)^2 + (-1 + y)^2))^(3/2))*(121 (-4 + x) + 
      121 (-1 + x)) == 0, {x,0,5}, {y,0,5}]

enter image description here

Any point on the blue line is a solution to your equation.

| improve this answer | |
$\endgroup$
  • $\begingroup$ And approximated values of solutions ({x, y}) to the OP's equation can be taken from this plot as plot[[1, 1, 1,]]. $\endgroup$ – Alx Nov 15 '19 at 2:06
  • $\begingroup$ @BobHanlon: Fixed, thanks. $\endgroup$ – Michael Seifert Nov 15 '19 at 16:58

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.