FNC Math Components in TMS Analytics & Physics 3.2
TMS Analytics & Physics library is a set of classes that provide functionality for building powerful math applications with Delphi. In the new version 3.2 of the library, we introduced special FNC math components. The components bring new possibilities to develop and tune your math application in design-time with standard IDE tools. In this article, we’ll consider the base concepts of the FNC math components and provide information on how to work with functions, derivatives, and integrals. All FNC math components are nonvisual. Each component implements some math concept and provides properties to manipulate and tune it in design- and run-time. Let’s consider the following components: TFNCProvider – creates math environment; allows introducing variables and parameters for function evaluations, symbolic derivatives, and integrals. TFNCFunction1D – introduces a symbolic function of one variable; allows evaluating the function for the specified variable value. TFNCDerivative1D – introduces a symbolic derivative of a math expression; allows evaluating the derivative for the specified variable value. TFNCIntegral1D – introduces a symbolic integral of a math expression; allows evaluating the integral for the specified variable value. To begin any FNC math application we first need to put a TFNCProvider component on the form. The component has two published properties: Variables (TVariableCollection) – a collection of variables that can be used as arguments of functions. Parameters (TParameterCollection) – a collection of parameters that can be used in the math environment to build functions, derivatives, integrals, and other math expressions. When you put a TFNCProvider on the form in design-time, it automatically creates a default variable ‘x’ for your math application. You can change the name of the variable or add/delete variables at design- and run-time. For the simplest math application, the default environment with one variable ‘x’ is enough. So, let’s go forward and consider the next FNC component TFNCFunction1D and its properties: Provider (TFNCProvider) – a math environment for the function. Variable (TVariableProperty) – a variable specifying the argument of the function. Formula (TFormulaProperty) – a formula specifying the math expression of the function. Placing a TFNCFunction1D on the form, it assigns the default value ‘x’ to the Variable property. We need to set up the Provider property and the expression for the Formula property, say ‘5*sin(6*x)’ in the Object Inspector. The resulting properties are shown in the picture below: The function is ready to use. What can we do with it? The first idea is to draw the function and see what it looks like. We have the TFNCFunction1DPlotter component especially developed for this purpose: TFNCFunction1DPlotter – a binding for an FNC function component and an FNC Chart; allows drawing any FNC function on the chart. The component has several published properties that we can use to tune it and show a function on the FNC Chart: Provider (TFNCProvider) – a math environment for the component. Min (TValueProperty) – the minimal value of the variable range to plot the function. Max (TValueProperty) – the maximal value of the variable range to plot the function. PointCount (Integer) – number of points to plot the function. AFunction (TFNCBaseFunction1D) – a FNC function to plot. AssignLegend (Boolean) – if true, assigns the function’s expression to the serie’s legend. Chart (TTMSFNCChart) – an FNC chart to draw the function. First, we need to assign the appropriate Provider property. The Min […]
