该帮助的版本不再更新,请参见https://www.jmp.com/support/help/zh-cn/15.2 获取最新的版本.


Remove( Expr( A + B + C + D ), 2 ); // results in the expression A + C + D
b = Substitute( Expr( Log( 2 ) ^ 2 / 2 ), 2, 3 ); // results in the expression Log( 3 ) ^ 3 / 3
polynomial = Expr( a * x ^ 2 + b * x + c );
Insert Into( polynomial, Expr( d * x ^ 3 ), 1 );
Show( polynomial );
For the not-in-place functions, you must either state the expression directly or else quote a name that evaluates to an expression using NameExpr. Such functions do not have From or Into in their names. They return manipulated lists or expressions without changing the original list or expression given in the first argument.
cubic = Insert( Expr( a * x ^ 2 + b * x + c ), Expr( d * x ^ 3 ), 1 );
quadratic = Expr( a * x ^ 2 + b * x + c );
cubic = Insert( Name Expr( quadratic ), Expr( d * x ^ 3 ), 1 );
Substituting is extremely powerful; please review the earlier discussion Substituting. Here are a few notes regarding substituting for expressions.
Substitute(pattern,name,replacement) substitutes for names in expressions
NameExpr() looks through the name but copies instead of evaluates:
a = Expr(
Distribution( Column( x ), Normal Quantile Plot )
Show( Name Expr( a ) );
Substitute() evaluates all its arguments, so they must be quoted correctly:
b = Substitute( Name Expr( a ), Expr( x ), Expr( :weight ) );
Show( Name Expr( b ) );
SubstituteInto() needs an L-value, so the first argument is not quoted:
Substitute Into( a, Expr( x ), Expr( :weight ) );
Show( Name Expr( a ) );
Substitute() is useful for changing parts of expressions, such as in the following example that tests the Is functions:
data = {1, {1, 2, 3}, [1 2 3], "abc", x, x( y )};
m = J( N Items( data ), N Items( ops ), 0 );
test = Expr(
For( r = 1, r <= N Items( data ), r++,
For( c = 1, c <= N Items( ops ), c++,
Eval( Substitute( Name Expr( test ), Expr( _op ), ops[c] ) )
Show( m );
You can use SubstituteInto() to have JMP solve quadratic equations. The following example solves 4x2 - 9 = 0:
x = {Expr(
(-b + Sqrt( b ^ 2 - 4 * a * c )) / (2 * a)
), Expr(
(-b - Sqrt( b ^ 2 - 4 * a * c )) / (2 * a)
Substitute Into( x, Expr( a ), 4, Expr( b ), 0, Expr( c ), -9 );
Show( x ); // see the result of substitution
Show( Eval Expr( x ) ); // see the solution
x = Remove(list |expr)
x = Remove(list |expr, position)
x = Remove(list |expr, {positions})
x = Remove(list |expr, position, n)
Copies the list or expression, deleting the item(s) at the indicated position. If position is omitted, items are deleted from the end. Position can be a list of positions. An extra argument, n, deletes n items instead of just 1.
Remove From(list |expr, position)
Remove From(list |expr)
Remove From(list |expr, position, n)
x = Insert(list |expr, item, position)
x = Insert(list |expr, item)
Inserts a new item into the list or expression at the given position. If position is not given, it is inserted at the end.
Insert Into(list |expr, item, position)
Insert Into(list |expr, item)
Same as Insert, but does it in place. List or expression must be an L-value.
x = Shift(list |expr)
x = Shift(list |expr, n)
Shift an item or n items from the front to the back of the list or expression. Shift items from back to front if n is negative.
Shift Into(list |expr)
Shift Into(list |expr, n)
x=Reverse(list |expr)
Reverse the order of elements of a list or terms of an expression.
Reverse Into(list |expr)
Reverse the order of elements of a list or terms of an expression in place.
x=Sort List(list |expr)
Sort the elements of a list or the terms of an expression. Numbers sort low, followed by the name value of names, strings, or operators. For example 1+2 is lower than 1-2 because the name value Add sorts lower than the name value Subtract. {1,2} sorts lower than {1,3}, which sorts lower than {1,3,0}. {1000} sorts lower than {“a”}, but {a} and {“a”} sort as equal.
Sort List Into(list |expr)
Sort the elements of a list or terms of an expression in place.
Sort Ascending(list |matrix)
Returns a copy of a list or matrix with the items in ascending order.
Sort Descending(list |matrix)
Returns a copy of a list or matrix with the items in descending order.
Creates a matrix of subscript positions where the values in matrix A match the values in matrix B. A must be a matrix sorted in ascending order.
R = Substitute(list |expr, Expr(pattern), Expr(replacement), ...)
Finds all matches to the pattern in the list or expression, and replaces them with the replacement expression. Each pattern must be a name. The second and third arguments are evaluated before they are applied, so most of the time you must quote them with an Expr function. To delay evaluating an argument, use Name Expr instead of Expr. You can list multiple pattern-replacement pairs for multiple substitutions in one statement.
Substitute Into(list |expr, Expr(pattern), Expr(replacement), ...)