Sine Waves, Normals and Tangents

advertisement
Sine Waves, Normals and Tangents
Sine Waves, Normals and Tangents
References
I
George B. Thomas, Maurice D. Weir and Joel Hass, Thomas’
Calculus, Addison Wesley, 12th Edition, 2009
I
James Stewart, Calculus, 7th edition, 2011
Sine Waves, Normals and Tangents
2D Sine Waves
A simple 2D sine wave (sinusoid) is given by the equation
y = sin(x)
1
sin(x)
0
-2π
-3π/2
-π
-π/2
0
π/2
π
3π/2
-1
Sine Waves, Normals and Tangents
2π
Dot Product and Orthogonal Vectors
I
The dot product a.b between two vectors a =< a1 , a2 > and
b =< b1 , b2 > is defined as
a.b = |a||b|cosθ
and is calculated as
a.b =< a1 , a2 > . < b1 , b2 >= a1 b1 + a2 b2
I
Two vectors are orthogonal, i.e. at right angles, if their dot
product is zero - as cosθ will be zero
Sine Waves, Normals and Tangents
Tangents and Normals: Functions of One Variable
From calculus we know that the derivative gives the slope/gradient
of a tangent line
n
t
m=dy/dx
m
1
y=f(x)
I
I
I
Thus a tangent vector t at a point is given by
t =< 1, dy /dx >.
And a normal vector n, which is orthogonal to the tangent
vector, is given by n =< −dy /dx, 1 >.
Note: there is a another normal in the direction
< dy /dx, −1 >.
Sine Waves, Normals and Tangents
Sine Wave Tangent and Normal
So for a sine wave
y
dy
dx
= sin(x)
= cos(x)
and
t = < 1, cos(x) >
n = < −cos(x), 1 >
Sine Waves, Normals and Tangents
Normals and Tangents: Functions of Two Variables
Where functions are of the form z = f (x, y ) i.e. of two variables,
the principle for finding tangent and normal vectors is similar.
However, in 3D a point on a surface has a tangent plane to which
the normal is orthogonal, instead of a (single) tangent line.
z
n
P
tx
ty
surface S
z=f(x,y)
tangent plane
y
x
Sine Waves, Normals and Tangents
Tangent Vectors
The normal to a tangent plane can found using two tangent vectors
each of which lie in the tangent plane: one in the x direction and
one in the y direction, which are found using partial derivatives
z
z
tx
∂z/∂x
P
P
1
tx
x
y
x
Sine Waves, Normals and Tangents
Partial Derivatives
I
I
I
I
I
Partial derivatives are used for functions of two (or more)
variables.
Similar to the derivative they give the slope of a tangent line but in the x or y direction.
For a function z = f (x, y ) have ∂z/∂x and ∂z/∂y
A partial derivative is found using the same sorts of rules for
differentation as functions of one variable - except that other
than the variable which the partial derivative is being taken,
variables are treated as constants.
Examples
z = 4x 2 + 3y 2 ,
z = sin(x) + sin(y ),
∂z
∂z
= 8x,
= 6y
∂x
∂y
∂z
∂z
= cos(x),
= cos(y )
∂x
∂y
Sine Waves, Normals and Tangents
Tangent Vectors
Tangent vectors in the x and y directions are then given by
tx
ty
∂z
>
∂x
∂z
= < 0, 1,
>
∂y
= < 1, 0,
Examples
z = 4x 2 + 3y 2 , tx =< 1, 0, 8x >, ty =< 0, 1, 6y >
z = sin(x) + sin(y ), tx =< 1, 0, cos(x) >, ty =< 0, 1, cos(y ) >
Sine Waves, Normals and Tangents
Cross Products
The cross product of two vectors a and b is a third vector n
perpendicular to a and b whose direction is determined by the
right-hand rule and whose length is |a × b| = |a||b|sinθ.
n=a⨯b
b
θ
a
Sine Waves, Normals and Tangents
Computing Cross Products
The cross product n of two vectors a =< a1 , a2 , a3 > and
b =< b1 , b2 , b3 > may be computed by evaluating the following
3 × 3 determinant
n = a×b
i
j k = a1 a2 a3 b1 b2 b3 a2 a3 a1 a3 a1 a2 = i
− j
+ k
b2 b3 b1 b3 b1 b2 = i(a2 b3 − a3 b2 ) − j(a1 b3 − a3 b1 ) + k(a1 b2 − a2 b1 )
Sine Waves, Normals and Tangents
Tangent Plane Normal
So a normal vector to a tangent plane, i.e. the normal to a point
on surface, may be found by taking the cross product of two
vectors found using partial derivatives:
n = tx × ty
∂z
∂z
> × < 0, 1,
>
∂x
∂y
∂z
∂z
= < − ,− ,1 >
∂x
∂y
= < 1, 0,
Sine Waves, Normals and Tangents
3D Sine Wave
For 3D sine waves, e.g. z = sin(x) + sin(y ) then have
n = tx × ty
= < 1, 0, cos(x) > × < 0, 1, cos(y ) >
= < −cos(x), −cos(y ), 1 >
For a more complex sine wave, which allows animation,
z = Asin(kx + ωt) + Asin(ky + ωt)
we have
n =< −kAcos(kx + ωt), −kAcos(ky + ωt), 1 >
Sine Waves, Normals and Tangents
Download