Subtracts two values, using element-by-element subtraction when subtracting a matrix and a number.
value1 .- value2
Menu Location
- Press 2nd MATH to enter the MATH menu.
- Press 4 to enter the Matrix submenu.
- Press K to enter the Element ops submenu.
- Press 2 to select .-.
…frankly, just typing it is way easier.
This command works on all calculators.
1 byte
The .- command works like plain - in most cases, taking the difference of two values. It's distinguished by its application to matrices: in particular, when subtracting a matrix and a scalar (in either order). Normally, the operation will be done along the main diagonal only: as though the value were multiplied by the identity matrix. However, .- does the more intuitive thing (for anyone but an algebraist, anyway) and subtracts the value from every element of the matrix (or, if the matrix is being subtracted, subtracts every element from the scalar value).
:[a,b;c,d]-x
[-x+a b ]
[c -x+d]
:[a,b;c,d].-x
[-x+a -x+b]
[-x+c -x+d]
It doesn't really make much sense to use .- to add other kinds of values, but you can do it if you like.
When subtracting a matrix from a constant number, be warned that the . may be interpreted as a decimal point. You can put spaces to help the calculator figure out what you mean.
:5.-[a,b;c,d]
[-a+5. -b ]
[-c -d+5.]
:5 .+ [a,b;c,d]
[-a+5 -b+5]
[-c+5 -d+5]