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

I How to word a 3D function?

Tags:
  1. Mar 19, 2016 #1
    I have, say, an ellipse in the x-y plane: (x^2/a^2) + (y^2/b^2) = 1

    I want a 3d (e.g. z) function where inside the ellipse z=+1, outside z=0; the function is not continuous.

    so in effect what I'm left with is a large plane where z= 0, and a small ellipse cut out raised to z=1.

    How do I write what I want in terms that i can implement it in computations.

    %this problem comes from describing quantum dots in 2 and 3 dimensions.
     
  2. jcsd
  3. Mar 19, 2016 #2

    Mark44

    Staff: Mentor

    How about this?
    $$f(x, y) = \begin{cases} 1, & \frac{x^2}{a^2} + \frac{y^2}{b^2} \le 1 \\
    0, & \frac{x^2}{a^2} + \frac{y^2}{b^2} > 1\end{cases}$$
     
  4. Mar 19, 2016 #3
    that looks perfect tbh. Do you have any idea how i could implement that into a program?
    for instance if i have two vectors representing my x and y space, how would i go about describing this function in matlab or fortran or something?
     
  5. Mar 19, 2016 #4

    Mark44

    Staff: Mentor

    Your vectors are really points in the x-y plane. For a given point (x, y), calculate ##b^2x^2 + a^2y^2##. If this is greater than ##a^2b^2##, your function should return 0. Otherwise, it should return 0.
     
  6. Mar 19, 2016 #5
    thanks you have been an amazing help
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted



Similar Discussions: How to word a 3D function?
Loading...