# Rearranging Two-Dimensional Gaussian Function.

1. Aug 7, 2010

### Xtensity

I'm not sure if this is the right place to post this. Let me say, this is not for any homework.

I've been asking all over the internet with help for this, and no one seems to be able to know.

I am applying this function to a Program I am writing in Delphi. I have no trouble applying it how it is in the picture, though what I need to do next is Isolate the variable "X" or "Y" by itself on one side of the equation. This reason I am doing this is so I can input a generated percentage value, a Y or X value, and get the corresponding variable to complete the point which matches in the generated accuracy relative to the Center Point.

Here the coefficient A is the amplitude, xo,yo is the center and σx, σy are the x and y axis radii.

All I need help with is moving the X or the Y into isolation on one side of the equation. I say X OR Y for the fact that, the way the equation is layed out, once I have an equation with X on one side, I can just swap all the X vars with the Y vars and apply it the same way.

I have tried numerous times and asked on numerous forums.. People either misunderstood what I was asking or didn't understand and never replied. I have tried multiple times but keep running into errors like attempting to square root a negative.

I haven't been in a math class in around 1 year and a half so I've probably forgotten some important methods for rearranging equations. (Ironically enough, my overwheleming interested in mathematics didn't develop until over the summer, I wish I had the interest a year ago lol) I know one thing is....... at some point in the equation there will be a ± for the answer since the accuracy of the formula is derived from circles. Meaning, there will be multiple points with the same accuracy, probably around 4 for each actual accuracy.

Does anyone have an idea?

Also, if anyone gets it, can you please post any special exception rules I should beware of (in this problem) to prevent me from making future mistakes.

Last edited by a moderator: May 4, 2017
2. Aug 8, 2010

I would start by writing

$$e^{-\left(\frac{(x-x_0)^2)}{\sigma^2_x} + \frac{(y-y_0)^2}{\sigma_y^2}\right)} = \frac{f(x,y)}{A}$$

and then remember that

$$\ln{e^{\text{Expression1 } + \text{ Expression2}}} = \text{ Expression1 } + \text{ Expression2}$$

to get your variables out of the exponent.

3. Aug 8, 2010

### Xtensity

I know that much about ln :P. But that negative that the E is raised to is throwing me off... because I inevitably try to take the square root of a negative. As I said, I haven't been in a math class for a year or so and my interest in mathematics didn't develop until recently... meaning I have forgotten a lot of the rules for rearranging equations.

Which is why I am posting here for help :P

I know that much of ln(e^x) = x

4. Aug 8, 2010

### Mute

Keep in mind that f(x,y)/A is always going to be less than or equal to 1, so ln(f(x,y)/A) < 0. This means when you take the square root you won't necessarily be taking the root of a negative number.

5. Aug 8, 2010

### Xtensity

I should mention. The way I am applying the equation, I do not even use the A variable(meaning more or less, it's 1, so I leave it out completely)

Last edited: Aug 8, 2010
6. Aug 9, 2010

As stated above, you know that $0 < f(x,y) < 1$, so its logarithm is negative. Think about
\begin{align*} e^{-\left(s^2 + t^2\right)} & = w(s,t) \\ \ln{e^{-\left(s^2 + t^2\right)}} & = \ln{w(s,t)} \\ -\left(s^2 + t^2\right) & = \ln{w(s,t)} \\ s^2 + t^2 & = -\ln{w(s,t)} \\ s^2 & = -\ln{w(s,t)} - t^2 \end{align*}