# A function describing a tilted tube

1. Jun 7, 2013

### Niles

Hi

I have a function, which is cylindrical symmetric given by
$$f(x, y, z) = \exp(-x^2-z^2)$$
For a given $y$, the function $\exp(-x^2-z^2) = c$ traces out a circle (where c is a constant). A contourplot of $f(x, 0, z)$ is attached.

However, this is for $y=0$ (currently, I get the same plot for an arbitrary value of y). I am interested in constructing a function, which is identical to $f$, but where the center of the above circle increases linearly with y. In other words, at $y=y'$ I want my function to have the same contour plot as attached, but its center should be at $y=y'$.

Is it possible to construct such a function? I guess this is merely a tube, which is tilted.

File size:
15.4 KB
Views:
65
2. Jun 7, 2013

### tiny-tim

Hi Niles!

Essentially, this is a function of r, where in the simple case r is the distance from the y-axis,

ie r2 = x2 + z2.

In the slanted case, r is the distance (parallel to the x-z-plane) from (ky',y',0),

so r2 = (x - ky')2 + z2.

3. Jun 9, 2013

### Niles

Thanks tiny-tim, that is a good explanation.

4. Jun 9, 2013

### Niles

If I want to rotate this function by an angle α around the y-axis (for a given slope k), then I need to invoke the rotation matrix. So we now have
$$f(x, y, z) = \exp(-(x-ky)^2)\exp(-z^2)$$
and in order to rotate it I would use
$$f(x\cos(\alpha) - z\sin(\alpha), y, x\sin(\alpha) + z\cos(\alpha))$$
Is this correct?

Last edited: Jun 9, 2013
5. Jun 9, 2013

### tiny-tim

Hi Niles!

Yes, that looks ok.

6. Jun 9, 2013

### Niles

Thanks. However, I think I am not 100% correct - simply because we're not rotating the function along the $y$-axis (which is what I suggested above), but along the line $ky=x$. I'll have to work on this a little more.... I can let you know how it turns out.

By the way, can I slant $f$ independenty in both $x$ and $z$? So if I want a gradient in both of these dimensions, I am allowed to make the trivial extension
$$f(x, y, z) = \exp(-(x-k'y)^2)\exp(-(z-k''z)^2)$$
I believe so, because the two dimensions are independent of eachother.

7. Jun 9, 2013

### tiny-tim

let's see …

that makes r the distance from (x,y,z) to (k'y,y,k''z),

so yes, that would be from the axis x/k' = z'k'' = y, but slanted so as to be parallel to the x-z plane

8. Jun 10, 2013

### Niles

Thanks, that's also what I thought.. I'm interested in seeing how to generalize this result to ellipses. I'll best create a new thread in order to keep things organized, but I will refer to this thread.

Last edited: Jun 10, 2013