Jump to content

Vector products: Difference between revisions

Added Easylang
(Undo revision 362544 by Chkas (talk))
(Added Easylang)
Line 1,448:
=={{header|Delphi}}==
See [https://rosettacode.org/wiki/Vector_products#Pascal Pascal].
 
=={{header|EasyLang}}==
<syntaxhighlight>
func vdot a[] b[] .
for i to len a[]
r += a[i] * b[i]
.
return r
.
proc vcross a[] b[] . r[] .
len r[] 3
r[1] = a[2] * b[3] - a[3] * b[2]
r[2] = a[3] * b[1] - a[1] * b[3]
r[3] = a[1] * b[2] - a[2] * b[1]
.
a[] = [ 3 4 5 ]
b[] = [ 4 3 5 ]
c[] = [ -5 -12 -13 ]
#
print vdot a[] b[]
#
vcross a[] b[] r[]
print r[]
#
vcross b[] c[] r[]
print vdot a[] r[]
#
vcross b[] c[] r[]
vcross a[] r[] r[]
print r[]
</syntaxhighlight>
 
{{out}}
<pre>
49
[ 5 5 -7 ]
6
[ -267 204 -3 ]
</pre>
 
=={{header|EchoLisp}}==
2,058

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.