Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Rearranging Two-Dimensional Gaussian Function.

  1. Aug 7, 2010 #1
    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.

    1983171154842b0b061fc42aa5eb7642.png [PLAIN]http://upload.wikimedia.org/wikipedia/en/thumb/c/ce/Gaussian_2d.png/300px-Gaussian_2d.png [Broken]
    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. jcsd
  3. Aug 8, 2010 #2

    statdad

    User Avatar
    Homework Helper

    I would start by writing

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

    and then remember that

    [tex]
    \ln{e^{\text{Expression1 } + \text{ Expression2}}} = \text{ Expression1 } + \text{ Expression2}
    [/tex]

    to get your variables out of the exponent.
     
  4. Aug 8, 2010 #3
    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
     
  5. Aug 8, 2010 #4

    Mute

    User Avatar
    Homework Helper

    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.
     
  6. Aug 8, 2010 #5
    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
  7. Aug 9, 2010 #6

    statdad

    User Avatar
    Homework Helper

    As stated above, you know that [itex] 0 < f(x,y) < 1 [/itex], so its logarithm is negative. Think about

    [tex]
    \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*}
    [/tex]

    Your situation for re-arranging is similar to this.
     
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook