Vector: Difference between revisions

Line 2,628:
</pre>
 
=={{header|RPL}}==
Basic vector (and matrix) handling is wired in RPL.
{{in}}
<pre>
[10,20,30] [1,2,3] +
[10,20,30] [1,2,3] -
[10,20,30] 5 *
[10,20,30] 5 /
</pre>
{{out}}
<pre>
4: [ 11 22 33 ]
3: [ 9 18 27 ]
2: [ 50 100 150 ]
1: [ 2 4 6 ]
</pre>
If the user wants to handle 2D vectors with possibility to use either polar or rectangular coordinates, vectors must be expressed as complex numbers, for which RPL provides <code>R→P</code> and <code>P→R</code> conversion instructions
(1,2) R→P
1: (2.2360679775,1.10714871779)
=={{header|Ruby}}==
<syntaxhighlight lang="ruby">class Vector
1,151

edits