tensors

<< Click to Display Table of Contents >>

Navigation:  Sample Problems > Usage > Misc >

tensors

Previous pageReturn to chapter overviewNext page

{  TENSORS.PDE

 

This example illustrates tensor manipulations. There are no variables or equations,

just definitions and plots. A boundaries section IS needed even though it is not used.

}

 

Title

"vector functions"

 

Definitions

 

 v1 = vector(1,2,3)

 v2 = vector(3,2,1)

 vv = v1*v2 ! vector product

 

 t1 = tensor((1,2,3),(4,5,6),(7,8,9))

 t2 = tensor((1,4,7),(2,5,8),(3,6,9))

 t12 = t1**t2 ! dot product

 

 dot12 = dot(t1,t2)

 dot1v = dot(t1,v1)

 dotv1 = dot(v1,t1)

 dotv2 = dot(v1,t2)

 dot12v = dot(dot12,v1)

 

Boundaries { plot domain always required }

region "dummy"

  start (-1,0) line to (1,0) to (1,1) to (-1,1) to close

 

Plots

summary ("OPERATIONS WITH A TENSOR RESULT :")

  report ""

  report "Vector product V1 * V2"

  report "(1,2,3) * (3,2,1) = ((3,2,1), (6,4,2), (9,6,3))"

  report ""

  report(xxcomp(vv), xycomp(vv), xzcomp(vv)) as "VV xx,xy,xz "

  report(yxcomp(vv), yycomp(vv), yzcomp(vv)) as "VV yx,yy,yz "

  report(zxcomp(vv), zycomp(vv), zzcomp(vv)) as "VV zx,zy,zz "

  report ""

  report "Tensor dot product T1 ** T2"

  report "((1,2,3), (4,5,6), (7,8,9)) ** ((1,4,7), (2,5,8), (3,6,9))"

  report " = ((14,32,50), (32,77,122), (50,122,194))"

  report(xxcomp(t12), xycomp(t12), xzcomp(t12)) as "T12 xx,xy,xz "

  report(yxcomp(t12), yycomp(t12), yzcomp(t12)) as "T12 yx,yy,yz "

  report(zxcomp(t12), zycomp(t12), zzcomp(t12)) as "T12 zx,zy,zz "

  report ""

  report "Tensor dot product DOT( T1, T2 )"

  report "((1,2,3), (4,5,6), (7,8,9)) ** ((1,4,7), (2,5,8), (3,6,9))"

  report " = ((14,32,50), (32,77,122), (50,122,194))"

  report ""

  report(xxcomp(dot12), xycomp(dot12), xzcomp(dot12)) as "DOT12 xx,xy,xz "

  report(yxcomp(dot12), yycomp(dot12), yzcomp(dot12)) as "DOT12 yx,yy,yz "

  report(zxcomp(dot12), zycomp(dot12), zzcomp(dot12)) as "DOT12 zx,zy,zz "

  report "Alternatively :"

  report(xcomp(xcomp(dot12)), ycomp(xcomp(dot12)), zcomp(xcomp(dot12))) as "DOT12 x(x),x(y),x(z) "        

  report(xcomp(ycomp(dot12)), ycomp(ycomp(dot12)), zcomp(ycomp(dot12))) as "DOT12 y(x),y(y),y(z) "

  report(xcomp(zcomp(dot12)), ycomp(zcomp(dot12)), zcomp(zcomp(dot12))) as "DOT12 z(x),z(y),z(z) "

 

summary ("OPERATIONS WITH A VECTOR RESULT :")

  report ""

  report "Vector Tensor dot product DOT( V1, T1 )"

  report "DOT( (1,2,3), ((1,2,3), (4,5,6), (7,8,9)) ) = (30,36,42)"

  report(xcomp(dotv1), ycomp(dotv1), zcomp(dotv1)) as "DOTV1 "

  report ""

  report "Vector Tensor dot product DOT( V1, T2 )"

  report "DOT( (1,2,3), ((1,4,7), (2,5,8), (3,6,9)) ) = (14,32,50)"

  report(xcomp(dotv2), ycomp(dotv2), zcomp(dotv2)) as "DOTV2 "

  report ""

  report "Tensor Vector dot product DOT( T1, V1 )"

  report "DOT( ((1,2,3), (4,5,6), (7,8,9)), (1,2,3) ) = (14,32,50)"

  report(xcomp(dot1v), ycomp(dot1v), zcomp(dot1v)) as "DOT1V "

  report ""

  report "Tensor Vector dot product DOT( DOT12, V1 )"

  report "DOT( ((14,32,50), (32,77,122), (50,122,194)), (1,2,3) ) = (228,552,876)"

  report(xcomp(dot12v), ycomp(dot12v), zcomp(dot12v)) as "DOT12V "

 

End