<< Click to Display Table of Contents >> vector_functions |
{ VECTOR_FUNCTIONS.PDE
This example illustrates the vector functions
VECTOR
MAGNITUDE
DOT
CROSS
NORMAL
TANGENTIAL
}
title
"vector functions"
select
elevationgrid=500
{no variables}
definitions
u= exp(-x^2+ y) { A scalar potential, perhaps }
f= grad(u) { F = grad(u) is a vector }
df= div(f) { Divergence of F is a scalar}
cf= curl(f) { Curl of F is a new vector }
vx= -sin(y) vy= 2*sin(x) { vector components }
v= vector(vx,vy) { Another vector }
mv= magnitude(v) { Magnitude of v }
cv= curl(v)
ccv= curl(curl(v))
tvv = v*v { v*v is a tensor }
divtx = 2*vx*dx(vx)+vx*dy(vy)+vy*dy(vx) {x-component of div(t) }
divty = vx*dx(vy)+vy*dx(vx)+2*vy*dy(vy) {y-component of div(t) }
divt = vector(divtx,divty)
{no equations}
{plot domain -- required}
boundaries
region 1
start "Outer" (-1,0)
line to (1,0) to (1,1) to (-1,1) to close
feature
start "inner" (-1/2,1/2) line to (1/2,1/2)
plots
vector(f) as "f = grad(-x^2+y)"
elevation(normal(f)) on "Outer"
elevation(tangential(f)) on "inner"
contour(df) as "Div F"
vector(v) as "V = (-sin(y), 2*sin(x))"
contour(mv) as "Magnitude V"
contour(dot(v,vector(x,0)))
contour(zcomp(cross(f,v)))
contour(zcomp(cv)) as "Zcomp(Curl V)"
vector(ccv) as "Curl Curl V"
vector(div(v*v)) as "Div(V*V) inline"
vector(divt) as "Div(V*V) expanded"
vector(div(tvv)) as "Div(V*V) tensor parameter"
end