Dataplot Vol 2 Vol 1

# PERCDIF

Name:
PERCDIF (LET)
Type:
Library Function
Purpose:
Return the percent difference of two numbers.
Description:
The definition of the percent difference between X1 and X2 used by Dataplot is:

Dataplot also supports the alternative formula

Syntax 1:
LET <y> = PERCDIF(<y1>,<y2>)             <SUBSET/EXCEPT/FOR qualification>
where <y1> is a variable or a parameter;
<y2> is a variable or a parameter;
<y> is a variable or a parameter (depending on what <y1> and <y2> are) where the computed percent difference values are stored;
and where the <SUBSET/EXCEPT/FOR qualification> is optional.

This syntax implements the first formula given above (the denominator is the maximum of the two values).

Syntax 2:
LET <y> = PERCDIF(<y1>,<y2>)             <SUBSET/EXCEPT/FOR qualification>
where <y1> is a variable or a parameter;
<y2> is a variable or a parameter;
<y> is a variable or a parameter (depending on what <y1> and <y2> are) where the computed percent difference values are stored;
and where the <SUBSET/EXCEPT/FOR qualification> is optional.

This syntax implements the second formula given above (the denominator is the average of the two values).

Examples:
LET A = PERCDIF(14,10)
LET A = PERCDIF(A1,A2)
LET X2 = PERCDIF(X1,X4)
LET X2 = PERCDIF(X1-4,X2+6)
Default:
None
Synonyms:
None
Related Commands:
 RELDIF = Compute the relative difference of two numbers. RELERR = Compute the relative error of two numbers. PERCERR = Compute the percent error of two numbers. MIN = Compute the minimum of two numbers. MAX = Compute the maximum of two numbers. ABS = Compute the absolute value of a number.
Applications:
Data Management
Implementation Date:
2010/12
Program:
```
LET X = SEQUENCE 0.1  0.1  3
LET Y1 = X**2
LET Y2 = X**(1/2)
LET Y3 = PERCDIF(Y1,Y2)
SET WRITE DECIMALS 5
PRINT Y1 Y2 Y3
```
The following output is generated:
```
---------------------------------------------
Y1             Y2             Y3
---------------------------------------------
0.01000        0.31622       96.83772
0.04000        0.44721       91.05572
0.09000        0.54772       83.56832
0.16000        0.63245       74.70177
0.25000        0.70710       64.64466
0.36000        0.77459       53.52419
0.49000        0.83666       41.43379
0.64000        0.89442       28.44582
0.81000        0.94868       14.61850
1.00000        1.00000        0.00000
1.21000        1.04880       13.32158
1.44000        1.09544       23.92742
1.69000        1.14017       32.53399
1.96000        1.18321       39.63183
2.25000        1.22474       45.56689
2.56000        1.26491       50.58941
2.89000        1.30384       54.88441
3.24000        1.34164       58.59133
3.61000        1.37840       61.81703
4.00000        1.41421       64.64466
4.41000        1.44913       67.13973
4.84000        1.48323       69.35455
5.29000        1.51657       71.33128
5.76000        1.54919       73.10428
6.25000        1.58113       74.70177
6.76000        1.61245       76.14716
7.29000        1.64316       77.45997
7.84000        1.67332       78.65663
8.41000        1.70293       79.75102
```

Date created: 01/06/2011
Last updated: 01/06/2011