# Thread: Derivate function with 2 parameters

1. ## Derivate function with 2 parameters

Hello there, my first time so if it's in bad category please move it where it belongs

In short, I need to create normals for wave, so I use derivative of wave and then make line perpedicular to it. I found that I can make perpedicular using this formula:
$-1/f$

I need to find perpediculars for derivated wave function. And now that's where problem begins. My wave function:
$F(x,t) = y*sin(G(x,t))$
$G(x,t) = 2*PI*f*(x/v-t)$

I have very little knoweledge about derivative, I'm not on university yet and most of what I know is through searching net.. I think I can derivate first function, but second with 2 parameters does real problem. I already tried solve it (found something about partial derivatives on wikipedia), and as I make graphical computation I can compare results and it was not really like solution I'm sure about. So I think I got lost there somewhere derivating G...

I would be glad if someone could solve this one a show me steps also not just solution, so I can learn from it.

2. This post definitely belongs in Calculus, not Differential Equations, just fyi.

Hmm. Typically, with a differentiable function of one variable, $y=f(x),$ the normal line to a point $(x_{0},f(x_{0}))$ on the curve has a slope given by

$m_{n}=-\dfrac{1}{f'(x_{0})}.$

Now, with the problem you've presented, I have one big question: with respect to which variable, $x$ or $t,$ are you trying to find the normal line?

3. Well.. take look here:
Dispersion (water waves) - Wikipedia, the free encyclopedia

Below Wave propagation heading are those 2 formulas:

What I did is that I just modified angle formula.
In what I'm doing, I take sample point at distance $x$ from center of wave, and testing with wave time $t$ if the wave already spread to that point and what phase it's in.

Which variable should I then take in respect? I think it should be time $t$ but I'm not sure about it.

4. I'm afraid I haven't the foggiest notion what you're trying to do. Your OP and your third post seem a bit unrelated. Do me a favor, please: write out the original problem statement from your book or notes or whatever, word-for-word, and leave nothing out. Thank you!

5. I'm sorry for that it's confusing..

Can't re-write it word-for-word because it's just in my head. Anyway one more try.

In computer graphics, there are vectors - normals - of unit length, that computer use to determine how lit the object is. Without normal and using light, you would see everything dark. Those normals are perpedicular to surface.

| <- normal
|
__
^surface

That was something about what I need to create.

Now how to create it:
1. my surface is defined by formulas in third post. Shape of this surface is sinusoid as it's equation of wave.

Back to computer things... In computer, you can't really get ultimately smooth wave, unless using other method than mine. The way I create wave is by creating points close to each other, so close that when you zoom out it's smooth, and connecting them with narrow line. In start they all lye on x-axis, but solving equation from 3rd post for each point in specified time, I get y-axis values. This way I get shape of wave in computer.

2. derivate to find tangents
Next step to find normals is derivating this shape, with which I have problem. When I consider it, maybe it's with respect to $x$, because $t$ is static in specified time. Anyway, derivating this I find tangents in each point (remember it's not smooth it just look smooth and there are points which need normals).

3. lines perpedicular to tangents
Now we have tangents, we are able to convert them into perdepiculars $-1/tangent$ in each point of wave.

4. creating normals
Until now, the lines was specified by slope( $k$), such that $y = k*x$ and it didn't matter where they were laying. But before we position them, we convert them to normals. Remember that normals have unit length? We can write:
$1=x^2 + y^2$
where $x$ is just some x-axis value and $y$ some y-axis value.
We also know that $y = k*x$ and we solved $k$ in step 3.
so using these 2:
$x = squareroot(1-k^2*x^2)$
This can be then solved but as I don't know $k$ yet, I can't simplify it. Calculating $y$ is then trivial.
Armed with unit vector we can position it onto point position (if we were solving for px=2, py = 1, we would then update normal like: x = x+px, y = y + py )

And that's really everything I can tell about it without going deep in computer graphics. It's just finding slope of tangent, finding slope of perpedicular, creating normal and position it.

6. Thanks for clarifying. Knowing the context of light shining on the wave is precisely what I needed in order to be able to tell you the information you're looking for. Context is everything!

Ok, you're definitely after the derivative with respect to the spatial variable $x$. When you compute that partial derivative, it'll still have a $t$ in it, which indicates that it's going to change in time. That's fine. With your wave function

$\eta(x,t)=a\sin(kx-\omega t),$

the partial derivative with respect to $x$ gives you

$\eta_{x}(x,t)=k a \cos(kx-\omega t).$

Use this to compute the spatial slope of the wave function at any time and value of $x$. Then do the procedure you've outlined. Find the slope of the normal, and then use the point on the wave function to determine the intercepts, essentially, of the equation of the normal line.

Make sense?

7. Yes. I'll have to convert it for my modified formula but that involves just some constants to re-write. It's quite late here, I'll post result of testing it later if there will be time as it won't be ordinary day So thanks for your help and if there won't be time Happy New Year!

8. Well it doesn't look alike. Maybe I made some error in my code but I just got something in my head that I need to check on:
that partial derivative is already a slope of tangent, or what it is.
Following wikipedia shows this:

so when I write:
$y = k * x$
and the $k$ is $f'$ I get:
$y1 = k*a*cos(k*x - omega*t) * x1$
where
$x1, y1$ are coordinates of point laying on tangent.
Is that correct?

9. You are assuming that the equation of the tangent line goes through the origin: a very sketchy assumption, I would think. I would add an arbitrary intercept to the equation in order to allow for the possibility that the tangent line will not go through the origin. So you'd have this:

$y_{1} = ak\cos(kx - \omega t) x_{1}+b.$

Here, $x$ is the $x$-coordinate of the point of tangency.

You'll need to solve for $b,$ which you can do by setting this equation of the tangent line equal to what you get in the original equation. That is, do this:

$\eta(x,t)=a\sin(kx-\omega t)=ak\cos(kx - \omega t) x+b,$ and solve for $b.$ It'll almost certainly depend on $t,$ but you'd expect that.

Make sense?

10. Yes, I think... so if we substitute (have to learn how to write those signs in math tag.. don't you have link?)
$alpha = k*x - omega*t$
we can write:
$y1 = x1*k*cos(alpha)*(a+1)+sin(alpha)$
That should do the trick?

11. The best way to get good at LaTeX is to double-click code that produces output you like. On this forum, that will produce a popup box that shows you the code the produced the output you like.

I don't quite agree with your result. Using your definition of $\alpha,$ I get this:

$y_{1}=ak(x_{1}-x)\cos(\alpha)+a\sin(\alpha).$

Do you see how I got this?

12. yeah..made error in first stage when dividng with $a$.. loks like today's not my bast day..

I now got result like you do but there's thing I noticed in your post, I thought you just forgot subscript but you wrote that equation again without it:

in third form of equation shouldn't there been $x_1$ after $cos(\alpha)$ ? Because there
you wrote it with subsrcipt.. but result of that would be then just
$y_1 = a*sin(\alpha)$ as $x_1-x_1 = 0$

13. I was thinking that the subscripted variables represented coordinates that are along the tangent line. This is to distinguish from the coordinates of the point of tangency, for which I used non-subscripted variables. Does that clear that up?

A thought occurred to me: finding the intercept of the tangent line is superfluous, because you're really after the equation of the normal line. For that, all you need is the slope of the normal line (-1/slope of tangent line, as you've said before), and the coordinates of the point of tangency. You go through the usual procedure to find the equation of the line. What do you get?

14. Well that's the first idea I got in fact. But the question now is how to calculate slope of tangent? That question is related to 6th post where I'm asking what result I get derivating my function. Because it's in fact only real number when you substitue numbers for constants and nothing more. So if the result would be slope I get:

$S$ - slope of perpedicular (normal with infinite length)
$S = \frac{-1}{f'}$
$S = \frac{-1}{k*a*cos(\alpha)}$
Now something I need to check but It should be ok to suggest:
-if we are dispatching normal into right position and we really need just direction, we can assume it's crossing origin and that simplifies:
$y_1 = S * x_1$
next equation we can use is that normal have unit length:
$1 = y_1^2 + x_1^2$
$1 = x_1^2*(S^2+1)$
$x_1 = \sqrt{\frac{1}{S^2+1}}$
therefore
$y_1 = S * \sqrt{\frac{1}{S^2+1}}$

substituing for S:

$x_1 = \sqrt{\frac{1}{(\frac{-1}{k*a*cos(\alpha)})^2+1}}$

$y_1 = (\frac{-1}{k*a*cos(\alpha)}) * \sqrt{\frac{1}{(\frac{-1}{k*a*cos(\alpha)})^2+1}}$

In this post $x_1$ and $y_1$ are final values for x and y axis of normal, as in computer 2D space vector is defined by 2 values... So we get final vector and we are ready to place it onto point, we were calculating it for... In fact we don't really do anything more than just calculating $x_1$ and $y_1$, because you just specify to which point normal belong and computer does the rest

15. I agree with your slope of the normal line of

$S=-\dfrac{1}{ak\cos(\alpha)}.$

However, the assumption that the normal line goes through the origin is, I think, a poor one. I would allow for a nonzero intercept, and solve for it by plugging in the coordinates of the point of tangency/normalcy thus:

$y_{n}=-\dfrac{1}{ak\cos(\alpha)}\,x_{n}+b.$

$a\sin(\alpha)=-\dfrac{1}{ak\cos(\alpha)}\,x+b,$ which implies

$b=a\sin(\alpha)+\dfrac{1}{ak\cos(\alpha)}\,x.$ Therefore, the equation of the normal line is

$y_{n}=-\dfrac{1}{ak\cos(\alpha)}\,x_{n}+a\sin(\alpha)+\df rac{1}{ak\cos(\alpha)}\,x.$

You can simplify a little bit:

$y_{n}=\dfrac{1}{ak\cos(\alpha)}\,(x-x_{n})+a\sin(\alpha).$

Here, I've used $(x_{n},y_{n})$ as the coordinates of points along the normal line.

Make sense?

Page 1 of 2 12 Last