How to resolve the algorithm Array concatenation step by step in the Maple programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Array concatenation step by step in the Maple programming language
Table of Contents
Problem Statement
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Array concatenation step by step in the Maple programming language
Source code in the maple programming language
> A := Array( [ 1, 2, 3 ] );
A := [1, 2, 3]
> B := Vector['row']( [ sin( x ), cos( x ), tan( x ) ] );
B := [sin(x), cos(x), tan(x)]
> ArrayTools:-Concatenate( 1, A, B ); # stack vertically
[ 1 2 3 ]
[ ]
[sin(x) cos(x) tan(x)]
> ArrayTools:-Concatenate( 2, A, B ); # stack horizontally
[1, 2, 3, sin(x), cos(x), tan(x)]
> M := << a, b, c ; d, e, f >>; # a matrix
[a b c]
M := [ ]
[d e f]
> ArrayTools:-Concatenate( 1, M, A );
[a b c]
[ ]
[d e f]
[ ]
[1 2 3]
> ArrayTools:-Concatenate( 1, A, M );
[1 2 3]
[ ]
[a b c]
[ ]
[d e f]
> L1 := [ 1, 2, 3 ];
L1 := [1, 2, 3]
> L2 := [ a, b, c ];
L2 := [a, b, c]
> [ op( L1 ), op( L2 ) ];
[1, 2, 3, a, b, c]
> [ L1[], L2[] ]; # equivalent, just different syntax
[1, 2, 3, a, b, c]
You may also check:How to resolve the algorithm Image convolution step by step in the Common Lisp programming language
You may also check:How to resolve the algorithm Non-decimal radices/Convert step by step in the Icon and Unicon programming language
You may also check:How to resolve the algorithm Catalan numbers step by step in the ERRE programming language
You may also check:How to resolve the algorithm Bitwise IO step by step in the C# programming language
You may also check:How to resolve the algorithm First class environments step by step in the Perl programming language