v1.1
 
How to create a symbolic expression

If a parametric curve is needed to describe the style template, create it using symbolic expressions, for example:

local function_x = "sin(t)"
local function_y = "cos(t)"
CreateParametricCurve2D(function_x, function_y, CoordinateSystem2D.Cartesian, 0, 2 * math.pi)
Curve2D CreateParametricCurve2D(string xFunction, string yFunction, CoordinateSystem2D coordinateSystem, number tStart, number tEnd)
Creates a curve described by parametric functions.
CoordinateSystem2D
Types of coordinate system in two dimensional space.
Definition CoordinateSystem2D.h:26

You can use basic mathematical operations, functions and constants to create a symbolic expression in Renga STDL.

Operations that can be performed on variables, constants, and functions in symbolic expressions:

Operation Description
+ addition
- subtraction
* multiplication
/ division
^ exponentiation
- unary minus

Mathematical functions that can be used in symbolic expressions:

Function Name Description
sin sine with argument in radians
cos cosine with argument in radians
tan tangent with argument in radians
sind sine with argument in degrees
cosd cosine with argument in degrees
tand tangent with argument in degrees
asin arcsine with the result in radians
acos arccosine with the result in radians
atan arctangent with the result in radians
asind arcsine with the result in degrees
acosd arccosine with the result in degrees
atand arctangent with the result in degrees
sqrt square root
exp exponential
ln natural logarithm
lg decimal logarithm
deg function to convert radians to degrees
rad function to convert degrees to radians
abs absolute value

In symbolic expressions, numbers can be represented as unnamed constants, specified as floating-point numbers (a sequence of digits separated by a dot), or as integers.

Symbolic expressions can also include the use of named constants:

Constant Name Description
M_PI π - the ratio of a circle's circumference to its diameter
M_PI_2 π / 2
M_PI_4 π / 4
M_SQRT2 √2
M_E e – the base of the natural logarithm
M_PHI φ – the golden ratio
M_RADDEG 180 / π – conversion factor from radians to degrees
M_DEGRAD π / 180 – conversion factor from degrees to radians

When creating symbolic expressions, the following limitations should be taken into account:

  • Maximum variable length – 512 characters.
  • Maximum expression length – 2048 characters.
  • Integrate, differentiate, and limit operations are not supported.
  • Simplifying mathematical expressions, such as reducing fractions, is not supported.

Because of these limitations, correct calculations for analytical expressions can only be performed for relatively simple mathematical expressions and functions. For example, calculating the value of sin(t)/t at zero can be inaccurate.