next up previous 530
Next: Calculating Intermediate Values
Up: Using MathMaps
Previous: Using MathMaps

Defining Transformation Functions

A MathMap's transformation functions are defined by a set of character strings holding Fortran-like expressions. If the required Mapping has Nin input axes and Nout output axes, you would normally supply the Nout expressions for the forward transformation. For instance, if Nout is 2 you might use:

      'R = SQRT( X * X + Y * Y )'
      'THETA = ATAN2( Y, X )'

which defines a transformation from Cartesian to polar co-ordinates. Here, the variables that appear on the left of each expression (R and THETA) provide names for the output variables and those that appear on the right (X and Y) are references to input variables.

To complement this, you must also supply expressions for the inverse transformation. In this case, the number of expressions given would normally match the number of MathMap input co-ordinates, Nin. If Nin is 2, you might use:

      'X = R $*$ COS( THETA )'
      'Y = R $*$ SIN( THETA )'

which expresses the transformation from polar to Cartesian co-ordinates. Note that here the input variables (X and Y) are named on the left of each expression, and the output variables (R and THETA) are referenced on the right.

Normally, you cannot refer to a variable on the right of an expression unless it is named on the left of an expression in the complementary set of functions. Therefore both sets of functions (forward and inverse) must be formulated using the same consistent set of variable names. This means that if you wish to leave one of the transformations undefined, you must supply dummy expressions which simply name each of the output (or input) variables. For example, you might use:

      'X'
      'Y'

for the inverse transformation above, which serves to name the input variables but without defining an inverse transformation.


next up previous 530
Next: Calculating Intermediate Values
Up: Using MathMaps
Previous: Using MathMaps

KAPPA --- Kernel Application Package
Starlink User Note 95
Malcolm J. Currie & David S. Berry
2013 February 14
E-mail:starlink@jiscmail.ac.uk

Copyright © 2013 Science and Technology Facilities Council