DIFF returns the derivative in a location in a two- or more dimensional space
Syntax
- DIFF(Pno%, Ndim%, "ColLab$_1,.., "ColLab$_Ndim%", Xint_1, ..., Xint_Ndim%-1, [DirivNo%])
- DIFF(0, Npoints%, x_1, y_1, x_2, y_2,…, x_n, y_n, Xint, [DirivNo%=1]) (only in 2D)
- DIFF(@ObjFn(..), Ndim%, @ObjColPar_1,.., @ObjColPar_Ndim%, Xint_1, ..., Xint_Ndim%-1, [DirivNo%])
- DIFF(Telitab$, Ndim%, "ColLab$_1",.., "ColLab$_Ndim%", Xint_1, ..., Xint_Ndim%-1, [DirivNo%])
Arguments
- Pno% is the number that refers to the TeLiTab sets in the Data slot. Pno% should be an integer value or a parameter which is assigned an integer value and is the number of the TeLiTab set in the expressions' data slot.
- Npoints% is the number of points (x,y) that are given in direct definition.
- @ObjFn() refers to the Object from which data will be used.
- TeLiTab$ refers to the string parameter that contains the TeLiTab.
- Ndim% is the number of dimensions (or columns in the table...).
- "ColLab$_1" and @ObjColPar_1 refer to the column that will be used as the first parameter in the differentiation.
- "ColLab$_2" and @ObjColPar_2 refer to the column that will be used as the second parameter in the differentiation.
- Xint are the coordinates on which to compute the derivative dx/dy.
- DirivNo% is an optional argument by which can be indicated for which index of x_i the differential dx_i has to be computed. In y=f(x) DirivNo% should either be one (1) or omitted. If omitted or larger than Ndim%-1, the x_Ndim%-1 is assumed as differential
Remarks
- See also Telitab access for a generic description on the use of TeLiTab data
- Similar to other Data analysis functions, the DIFF is a convenient way to evaluate data. Please also look at these functions for syntax examples
- Please realise the dataset provided to DIFF should be a function. Every x-value should have one y-value. Furthermore, in case of a multi-dimensional dataset you should provide a matrix of coordinates.
- Extrapolation outside the x-range is performed parabolically.
Examples
Syntax 1: TeLiTab in Dataslot
In this example, the TeLiTab is addressed in the Dataslot. The function y is defined as y = DIFF(1, 2, "XC", "YC", x, 1) With the following Telitab set in the Data slot:
|DIFF1|
0
2
"XC" "YC"
"1" 1 1
"2" 2 4
"3" 3 9
"4" 4 16
"5" 5 25
"6" 6 36
"7" 7 49
"8" 8 64
"9" 9 81
"10" 10 100|
For x = 2.5, the function returns
y=5 NOTE: In case you apply the symbolic addressing of the columns for the description of the point on the curve or surface to compute the differential for, e.g. "Par_x" and "Par_y", please make sure that your Telitab set contains these names. If not, an error message is generated and the calculation is stopped.
Syntax 2: Direct definition
In direct definition, the points of the curve are stated in the Relation itself. This method can only be used for 2D derivatives, the syntax is: DIFF(Pno%, Ndim%, "ColLab$_1,.., "ColLab$_Ndim%", Xint, [DirivNo%]) If Pno%=0 then all x_i and y_i values should be numeric expressions. The minimum number of x,y data points Ndim% in the list is 2 in which case the interpolation (and differentiation) is performed linear. Let the function y be defined as
y = DIFF(0, 4, 1, 1, 2, 4, 3, 9, 4, 16, x, 1) For x=2.5, this function returns
y=5
Syntax 3: TeLiTab in string
We have a relation:
DataSet2# = TEXTITEM$(1)
With in its dataslot:
TEXTITEM1= |0
3 "X" "Y" "Z"
"1" 1 1 2
"2" 1 4 8
"3" 1 9 18
"4" 1 16 32
"5" 1 25 50
"6" 1 36 72
"7" 1 49 98
"8" 1 64 128
"9" 1 81 162
"10" 1 100 200
"11" 2 1 12
"12" 2 4 18
"13" 2 9 118
"14" 2 16 132
"15" 2 25 150
"16" 2 36 172
"17" 2 49 198
"18" 2 64 1128
"19" 2 81 1162
"20" 2 100 1200
"21" 3 1 22
"22" 3 4 28
"23" 3 9 218
"24" 3 16 232
"25" 3 25 250
"26" 3 36 272
"27" 3 49 298
"28" 3 64 2128
"29" 3 81 2162
"30" 3 100 2200|
And use the following relation to determine the derivative:
Calculated_Value=DIFF(DataSet2#,3,"X","Y","Z", Input_Value_x, Input_Value_y, OptionalDirivNo)
With Input_Value_x = 1, Input_Value_y = 2 and OptionalDirivNo = 2 this gives Calculated_Value=2
Quick links: Functions overview | Attribute overview | Constants overview | Dimensions overview