Vector products: Difference between revisions
Content added Content deleted
m (→{{header|REXX}}: removed STYLE from the PRE html tag.) |
m (→{{header|Sidef}}: minor code simplification) |
||
Line 2,665: | Line 2,665: | ||
<lang ruby>class Vector(x, y, z) { |
<lang ruby>class Vector(x, y, z) { |
||
method ∙(vec) { |
method ∙(vec) { |
||
self[:x |
self[:x..:z] »*« vec[:x..:z] [+]; |
||
} |
} |
||
method ⨉(vec) { |
method ⨉(vec) { |
||
Vector(self[:y]*vec[:z] - self[:z]*vec[:y], |
|||
self[:z]*vec[:x] - self[:x]*vec[:z], |
|||
self[:x]*vec[:y] - self[:y]*vec[:x]); |
|||
); |
|||
} |
} |
||