*
operators
math
The *
operator consumes two parameters from the top of the stack and pushes back the result of multiplying both of them.
If you want to multiply two matrices together, they have to be of the same size.
* is available since version 1.0.0.
See also
Signatures
Examples
//
// Multiplying numbers
//
10 10 *
10.0 10 *
10.9 10.9 *
5 45.4 *
//
// Multiplying vectors
// Vectors are not printable so we convert them into a list for the example using VEC->
//
[ 1 2 3 ] ->VEC 'vector1' STORE
10 $vector1 * VEC->
$vector1 1.5 * VEC->
//
// Multiplying matrices
// Matrices are not printable so we convert them into a list for the example using MAT->
//
[ 1 2 3 ] ->VEC 'vector1' STORE
[ [ 1 2 ] [ 3 4 ] ] ->MAT 'matrix1' STORE
[ [ 1.5 2.5 ] [ 3.5 4.5 ] ] ->MAT 'matrix2' STORE
[ [ 1 2 3 ] [ 4 5 6 ] [ 7 8 9 ] ] ->MAT 'matrix3' STORE
[ [ 7 8 9 ] [ 4 5 6 ] [ 1 2 3 ] ] ->MAT 'matrix4' STORE
$matrix1 $matrix2 * MAT->
$matrix3 $matrix4 * MAT->
10 $matrix1 * MAT->
$matrix4 3.14 * MAT->
$matrix3 $vector1 * VEC->