Skip to content

Instantly share code, notes, and snippets.

@aktech
Created March 4, 2015 19:30
Show Gist options
  • Save aktech/f7194d0ad58d723a0a81 to your computer and use it in GitHub Desktop.
Save aktech/f7194d0ad58d723a0a81 to your computer and use it in GitHub Desktop.
Solve by LambertW

This can be solved using properties of LambertW Function.

x + exp(x**2) = 0
1 = -x*exp(-x**2)
squarring both sides
1 = (x**2)*(exp(-2*x**2))
Multiply by -2 on both sides
-2 = (-2*x**2)*(exp(-2*x**2))
Taking LambertW on both sides:
LambertW(-2) = LambertW((-2*x**2)*(exp(-2*x**2)))
LambertW(-2) = -2*x**2
x = I*sqrt(LambertW(-2)/2)  # Answer!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment