Function: math[vals] - creates a value table of a function in one real
Calling Sequence:
vals(f, L);
vals(f, L, 'flag');
Parameters:
f - any expression in one real or the name (or a combination of names) of a function
L - a list of values or a vector
'flag' - the name
Description:
vals prints a table of function values by applying a function f to each element in L = [
, ...,
].
1) If f is a term then in the first form, vals prints the name `fn` and a column vector L on the left-hand side, and the corresponding function values as another column vector [f(
), f(
), ..., f(
)] on the right-hand side of an equation.
2) If f is a term then in the second form, vals substitutes each occurrence of the indeterminate in f with the column vector L, prints the converted term on the left-hand side and the corresponding function values as a column vector on the right-hand side of an equation.
3) If f is a function name or a combination of function names (including composita) then in the first form, vals behaves like described in 1), but prints the name f instead of `fn`.
4) If f is a function name or a combination of function names (including composita) then in the second form, vals behaves like described in 2).
Note that column vectors are only used to improve formatting, i.e. to compare the arguments of a function with the corresponding function values.
The result of vals is always NULL.
vals internally uses print/vector in order to display vectors vertically.
This function is part of the math package, and so can be used only after performing the command with(math) or with(math, vals).
Examples:
> with(math):
> vals(x^2, [seqby(x, x=1 .. 2, 1/4)]);
> vals(x^2+x+1, [seqby(x, x=1 .. 2, 1/4)], 'flag');
> f := x -> x^2:
> g := x -> ln(x+1):
> vals(f, [1, 2, 3]);
> vals(f@g, [1., 2., 3., 4.]);
> vals(f*g, [1, 2, 3], 'flag');
> v := V(a, b, c);
> vals(x^2, v, flag);
> linalg[multiply](v, v);
> map(x -> x^2, v);
See Also:
print/vector .
Version History:
Version 1.0 - March 14, 1998