14.03.2014 Views

Scripting Guide - SAS

Scripting Guide - SAS

Scripting Guide - SAS

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

226 Programming Methods Chapter 8<br />

Additional Numeric Operators<br />

y = numDeriv(Normal Distribution(1));<br />

z = Num deriv2(normal distribution(1));<br />

Table 8.10 Derivative functions<br />

Function Syntax Explanation<br />

Derivativ<br />

e<br />

Derivative(expr,<br />

{name, ...})<br />

Returns the derivative of the expr with respect to name. Note that<br />

the second argument can be specified in a list with braces { } or<br />

simply as a variable if there is only one. Give two lists of names to<br />

take second derivatives.<br />

NumDeriv NumDeriv(expr) Returns the first numeric derivative of the expr with respect to the<br />

first argument in the expression.<br />

NumDeriv2 NumDeriv2(expr) Returns the second numeric derivative of the expr with respect to<br />

the first argument in the expression.<br />

Algebraic Manipulations<br />

JSL provides a way of algebraically unwinding an expression (essentially, solving for a variable). It is<br />

accomplished through the Invert Expr() function.<br />

Invert Expr(expression, name, y)<br />

where<br />

• expression is the expression to be inverted, or the name of a global containing the expression<br />

• name is the name inside expression to unwind the expression around<br />

• y is what the expression was originally equal to<br />

For example,<br />

Invert Expr(sqrt(log(x)),x,y)<br />

is wound around the name x (which should appear in the expression only once), and results in<br />

exp(y^2)<br />

It is performed exactly as you would when doing the algebra by hand<br />

y = sqrt(log(x))<br />

y 2 = log(x)<br />

exp(y 2 )=x<br />

Invert Expr supports most basic operations that are invertible, and makes assumptions as necessary, such<br />

as assuming you are interested only in the positive roots, and that the trigonometric functions are in<br />

invertible areas so that the inverse functions are legal.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!