# Dataplot Solution to the Mathematics Problem

Problem Setup An analyst wishes to examine the function x*exp(-x) + sin(x**2) over the interval 0 to 3. Plot the function over the interval. Determine any roots in the interval. Determine its definite integral over the interval.
Dataplot Program This is demonstrated with the following Dataplot program
LET FUNCTION F = X*EXP(-X) + SIN(X**2)
TITLE X*EXP(-X) + SIN(X**2)
PLOT F FOR X = 0 0.1 3
LET R = ROOTS F WRT X FOR X = 0 TO 3
LET INT = INTEGRAL F WRT X FOR X = 0 TO 3
Dataplot Output generated the following output

```
********************************************
**  LET R = ROOTS F WRT X FOR X = 0 TO 3  **
********************************************

ROOTS OF AN EQUATION
FUNCTION--(X*EXP(-X)+SIN(X**2))
ROOT VARIABLE                     = X
SPECIFIED LOWER LIMIT OF INTERVAL =         0.0000000000
SPECIFIED UPPER LIMIT OF INTERVAL =         3.0000000000

NUMBER OF ROOTS FOUND IN INTERVAL =        3

ROOT     1 =   0.0000000E+00
ROOT     2 =   0.1853708E+01
ROOT     3 =   0.2464136E+01

THE NUMBER OF VALUES GENERATED FOR THE VARIABLE R        =        3

THE FIRST          COMPUTED VALUE OF R        =   0.0000000E+00 (ROW     1)
THE LAST (    3TH) COMPUTED VALUE OF R        =   0.2464136E+01 (ROW     3)

THE CURRENT COLUMN FOR THE VARIABLE R         =        1
THE CURRENT LENGTH OF  THE VARIABLE R         =        3

THE COMPUTED VALUE OF THE CONSTANT   NROOTS   =   0.3000000E+01

*************************************************
**  LET INT = INTEGRAL F WRT X FOR X = 0 TO 3  **
*************************************************

INTEGRAL EVALUATION
FUNCTION--(X*EXP(-X) + SIN(X**2))
SPECIFIED LOWER LIMIT OF INTEGRAL  =         0.0000000000
SPECIFIED UPPER LIMIT OF INTEGRAL  =         3.0000000000
NUMBER OF VARIABLES OF INTEGRATION =        1

NUMBER OF    *       VALUE OF
PARTITIONS   *       INTEGRAL
-------------*--------------------

1     *   0.1574414E+01
2     *   0.1574414E+01

INTEGRAL VALUE        =   0.1574414E+01

THE COMPUTED VALUE OF THE CONSTANT   INT      =   0.1574414E+01

```

NIST is an agency of the U.S. Commerce Department.

Date created: 06/05/2001
Last updated: 09/28/2016

Please email comments on this WWW page to alan.heckert@nist.gov.