Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
13
Task/Vector-products/FunL/vector-products.funl
Normal file
13
Task/Vector-products/FunL/vector-products.funl
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
A = (3, 4, 5)
|
||||
B = (4, 3, 5)
|
||||
C = (-5, -12, -13)
|
||||
|
||||
def dot( u, v ) = sum( u(i)v(i) | i <- 0:u.>length() )
|
||||
def cross( u, v ) = (u(1)v(2) - u(2)v(1), u(2)v(0) - u(0)v(2), u(0)v(1) - u(1)v(0) )
|
||||
def scalarTriple( u, v, w ) = dot( u, cross(v, w) )
|
||||
def vectorTriple( u, v, w ) = cross( u, cross(v, w) )
|
||||
|
||||
println( "A\u00b7B = ${dot(A, B)}" )
|
||||
println( "A\u00d7B = ${cross(A, B)}" )
|
||||
println( "A\u00b7(B\u00d7C) = ${scalarTriple(A, B, C)}" )
|
||||
println( "A\u00d7(B\u00d7C) = ${vectorTriple(A, B, C)}" )
|
||||
Loading…
Add table
Add a link
Reference in a new issue