Operations on Orientation-Dependent Functions edit page

The common SO3Fun interface lets you calculate with functions much as MATLAB calculates with arrays. This page starts from two functions and uses them for arithmetic, extrema, integration, differentiation and rotation. See Defining Orientation-Dependent Functions first if the representations are unfamiliar.

Two Example Functions

The first function is the Dubna ODF determined from neutron diffraction data. An ODF is an orientation density function.

plottingConvention.default('y↑→x');
SO3F1 = SO3Fun.dubna

close all
plot(SO3F1,'sigma','sections',4)
mtexColorbar
SO3F1 = SO3FunRBF (Quartz → y↑→x)
 
  multimodal components
  kernel: de la Vallee Poussin, halfwidth 5°
  center: 19848 orientations, resolution: 5°
  weight: 1

The unequal colours show that the measured orientations are not uniformly distributed. Several maxima appear across the sigma sections rather than one isolated ideal component.

The second function is a unimodal ODF. It places one radial kernel at the orientation R.

R = orientation.byAxisAngle(vector3d.Y,pi/4,SO3F1.CS);
SO3F2 = SO3FunRBF(R,SO3DeLaValleePoussinKernel)

close all
plot(SO3F2,'sigma','sections',4)
mtexColorbar
SO3F2 = SO3FunRBF (Quartz → y↑→x)
 
  unimodal component
  kernel: de la Vallee Poussin, halfwidth 10°
  center: 1 orientations
 
  Bunge Euler angles in degree
  phi1    Phi   phi2 weight
    90     45    270      1

In contrast to the measured ODF, this plot contains one concentrated component. Its appearance in neighbouring sections is the cross-section of one three-dimensional peak in orientation space.

Arithmetic

Adding functions or scaling them produces another SO3Fun. MTEX can combine different internal representations in the same expression.

combined = 2 * SO3F1 + SO3F2;
shiftedCombined = 1 + combined

close all
plot(combined,'sigma','sections',4)
mtexColorbar
shiftedCombined = SO3FunComposition (Quartz → y↑→x)
 
  uniform component
  weight: 1
 
  multimodal components
  kernel: de la Vallee Poussin, halfwidth 5°
  center: 19848 orientations, resolution: 5°
  weight: 2
 
  unimodal component
  kernel: de la Vallee Poussin, halfwidth 10°
  center: 1 orientations
 
  Bunge Euler angles in degree
  phi1    Phi   phi2 weight
    90     45    270      1

The combined plot retains features of the measured ODF and adds the narrow component from SO3F2. The constant in shiftedCombined raises every value equally, so it does not change the positions of those features.

Basic overloaded operations include -, scalar *, scalar /, pointwise .*, pointwise ./ and pointwise .^. Pointwise abs, sqrt, conj, exp and log also return functions.

Pointwise Minimum and Maximum

With two function arguments, max and min compare values independently at every orientation.

pointwiseMax = max(2*SO3F1,SO3F2);
close all
plot(pointwiseMax,'sigma','sections',4)
mtexColorbar

At every plotted orientation, the colour comes from whichever input has the larger value. The narrow peak survives where it rises above the doubled measured ODF.

pointwiseMin = min(2*SO3F1,SO3F2);
close all
plot(pointwiseMin,'sigma','sections',4)
mtexColorbar

The minimum keeps the lower input instead. It clips each function wherever the other lies below it. Passing one function and one scalar performs the same comparison against a constant threshold.

Inverting the Argument

The inv operation composes a function with inversion. If g = inv(f), then the value of g at a rotation is the value of f at the inverse rotation.

Applying inv directly to the SO3FunRBF SO3F1 does not currently reproduce this identity for the Dubna ODF. Converting to a harmonic representation gives a reliable check.

SO3F1Harmonic = SO3FunHarmonic(SO3F1,'bandwidth',16);
g = inv(SO3F1Harmonic)

testRot = rotation(R);
valueAtR = SO3F1Harmonic.eval(testRot)
inverseValue = g.eval(inv(testRot))
g = SO3FunHarmonic (y↑→x → Quartz)
  bandwidth: 16
  weight: 1
 
valueAtR =
    3.1152
inverseValue =
    3.1152

The two displayed values agree, which checks the relation \(g(\mathbf{R}^{-1}) = f(\mathbf{R})\) for this orientation.

Global and Local Extrema

The number and type of arguments change what min and max return.

  • With one SO3Fun, they return its global extremum and its position.
  • With two functions, they return the pointwise minimum or maximum function shown above.
  • With one function and one scalar, they return a pointwise clipped function.
  • With 'numLocal',n, they return up to n distinct local extrema and their positions.

The following search asks for the two largest local maxima of combined.

close all
plot(combined,'phi2',(0:3)*30*degree)
mtexColorbar

[maxValue,maxNodes] = max(combined,'numLocal',2)
annotate(maxNodes)
maxValue =
  262.2291
  187.9344
 
maxNodes = orientation (Quartz → y↑→x)
  size: 2 × 1
 
  Bunge Euler angles in degree
     phi1     Phi    phi2
  89.7323 44.5573 270.319
   134.38 35.5039 205.572

The annotations mark the two returned orientations. The first value is the global maximum, while the second is the next distinct local maximum.

Integration and Norms

mean returns the normalized integral over \(SO(3)\). It assigns the constant function one an integral of one. sum uses the full rotation-group volume \(8\pi^2\).

normalizedIntegral = mean(SO3F1)
integralFromSum = sum(SO3F1) / (8*pi^2)
normalizedIntegral =
    1.0000
integralFromSum =
    1.0000

These two values agree because dividing sum by \(8\pi^2\) gives the same normalization as mean.

With this normalized measure, the \(L^2\) norm of a function is

\[ \lVert f \rVert_2 = \left( \frac{1}{8\pi^2} \int_{SO(3)} \lvert f(\mathbf{R}) \rvert^2\,\mathrm d\mathbf{R} \right)^{1/2}. \]

It can be assembled from pointwise operations and mean.

normFromDefinition = sqrt(mean(abs(SO3F1).^2))
normFromDefinition =
    4.0270

The dedicated norm command computes the same quantity more efficiently. A small difference between the displayed results comes from the numerical approximations used by the two routes.

directNorm = norm(SO3F1)
directNorm =
    4.0266

Differentiation at One Orientation

The gradient at a particular orientation belongs to the tangent space of \(SO(3)\) at that orientation. MTEX represents it by an SO3TangentVector.

gradientAtR = grad(SO3F1,R)
gradientAtR = SO3TangentVector (y↑→x)
 intern symmetries: Quartz → y↑→x
 tangentSpace: leftVector
   x     y     z
  19 -46.2 -5.75

Roughly speaking, this tangent vector points in the direction of steepest ascent. Following it through the exponential map produces a new rotation. See Tangent Space Representation on SO(3) for that construction.

The Gradient Field

Without an evaluation orientation, grad returns the gradients at all orientations as an SO3VectorFieldHarmonic.

G = grad(SO3F1)

close all
plot(SO3F1,'sigma','sections',4)
hold on
plot(G,'color','black','linewidth',1,'resolution',5*degree)
hold off
G = SO3VectorFieldHarmonic (Quartz → y↑→x)
  bandwidth: 48
  tangent space: leftVector

The section plot lays down a grey arrow field of its own, and the gradient is drawn in black on top of it. Read the black arrows. They are long where the ODF intensity changes quickly and almost invisible where it is nearly constant, and each points along the local direction of steepest ascent represented in that section.

Rotating a Function

rotate moves an orientation-dependent function by a specified rotation. This changes where its features occur. It is not a frame change, which would re-express the same physical function in a different reference frame.

rot = rotation.byEuler(30*degree,0*degree,90*degree,'Bunge');
rotated = rotate(SO3FunHarmonic(combined),rot)

close all
plot(rotated,'sigma','sections',4)
mtexColorbar
rotated = SO3FunHarmonic (Quartz → y↑→x)
  bandwidth: 48
  weight: 3

Compared with the earlier plot of combined, the same pattern is shifted through orientation space. Its amplitudes and internal arrangement are preserved by the rotation.

References

Next

Continue with Plotting Orientation Functions to choose section types, projections and colour ranges for inspecting an SO3Fun.

Citing this page. This page is part of the documentation of MTEX, a free and open source MATLAB toolbox for analyzing and modeling crystallographic textures. It was written by The MTEX Developers and is published at https://mtex-toolbox.github.io/SO3FunOperations.html. If you use MTEX, or reuse text or figures from this page, in your research, please cite

F. Bachmann, R. Hielscher, H. Schaeben: Texture Analysis with MTEX - Free and Open Source Software Toolbox, Solid State Phenomena 160 (2010), 63-68. 10.4028/www.scientific.net/SSP.160.63

BibTeX
@article{bachmann2010mtex,
  author  = {F. Bachmann and R. Hielscher and H. Schaeben},
  title   = {Texture Analysis with MTEX - Free and Open Source Software Toolbox},
  journal = {Solid State Phenomena},
  volume  = {160},
  pages   = {63-68},
  year    = {2010},
  doi     = {10.4028/www.scientific.net/SSP.160.63},
  url     = {https://doi.org/10.4028/www.scientific.net/SSP.160.63}
}

Other papers describing specific MTEX methods are listed under Publications — please cite the one that best fits your application. The MTEX source code is licensed under the GNU General Public License v2.0; the text and figures of this documentation are licensed under CC BY 4.0, which permits reuse — including by automated systems — provided The MTEX Developers and this page are credited.