Previous Up Next

2.42.2  Addition and substraction of two matrices : + - .+ .-

The infixed operator + or .+ (resp - or .-) are used for the addition (resp substraction) of two matrices.
Input :

[[1,2],[3,4]] + [[5,6],[7,8]]

Output :

[[6,8],[10,12]]

Input :

[[1,2],[3,4]] - [[5,6],[7,8]]

Output :

[[-4,-4],[-4,-4]]

Remark
+ can be used as a prefixed operator, in that case + must be quoted (’+’).
Input :

’+’([[1,2],[3,4]],[[5,6],[7,8]],[[2,2],[3,3]])

Output :

[[8,10],[13,15]]

Previous Up Next