Data update
This commit is contained in:
parent
4d5544505c
commit
4924dd0264
3073 changed files with 55820 additions and 4408 deletions
17
Task/Vector-products/DuckDB/vector-products.duckdb
Normal file
17
Task/Vector-products/DuckDB/vector-products.duckdb
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
create or replace function cross_product(a,b) as table (
|
||||
select [ a[2]*b[3] - a[3]*b[2], a[3]*b[1] - a[1]*b[3], a[1]*b[2]-a[2]*b[1] ]);
|
||||
|
||||
create or replace function scalar_triple_product(a,b,c) as table (
|
||||
select list_dot_product(a, (from cross_product(b, c))) );
|
||||
|
||||
create or replace function vector_triple_product(a,b,c) as table (
|
||||
from cross_product(a, (from cross_product(b, c))) );
|
||||
|
||||
# Examples
|
||||
select [3, 4, 5] as a,
|
||||
[4, 3, 5] as b,
|
||||
[-5, -12, -13] as c,
|
||||
list_dot_product(a, b) as 'a . b',
|
||||
((from cross_product(a, b) )) as 'a x b',
|
||||
((from scalar_triple_product(a, b, c))) as 'a . (b x c)',
|
||||
((from vector_triple_product(a, b, c))) as 'a x (b x c)' ;
|
||||
19
Task/Vector-products/Pluto/vector-products.pluto
Normal file
19
Task/Vector-products/Pluto/vector-products.pluto
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
local vector3 = require "vector3"
|
||||
local fmt = require "fmt"
|
||||
|
||||
local function scalar_tripleproduct(a, b, c) return a:dot(b:crossproduct(c)) end
|
||||
|
||||
local function vector_tripleproduct(a, b, c) return a:crossproduct(b:crossproduct(c)) end
|
||||
|
||||
local a = vector3( 3, 4, 5)
|
||||
local b = vector3( 4, 3, 5)
|
||||
local c = vector3(-5, -12, -13)
|
||||
|
||||
fmt.print("a = %s", a)
|
||||
fmt.print("b = %s", b)
|
||||
fmt.print("c = %s", c)
|
||||
print()
|
||||
fmt.print("a . b = %s", a:dot(b))
|
||||
fmt.print("a x b = %s", a:crossproduct(b))
|
||||
fmt.print("a . b x c = %s", scalar_tripleproduct(a, b, c))
|
||||
fmt.print("a x b x c = %s", vector_tripleproduct(a, b, c))
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
-- 8 May 2025
|
||||
-- 28 Jul 2025
|
||||
include Settings
|
||||
|
||||
say 'VECTOR PRODUCTS'
|
||||
|
|
@ -6,23 +6,20 @@ say version
|
|||
say
|
||||
a = '3 4 5'; b = '4 3 5'; c = '-5 -12 -13'; d = '1 2 3'
|
||||
say 'VALUES'
|
||||
say 'A =' Vlst2Form(a)
|
||||
say 'B =' Vlst2Form(b)
|
||||
say 'C =' Vlst2Form(c)
|
||||
say 'D =' Vlst2Form(d)
|
||||
say 'A =' Lst2FormV(a)
|
||||
say 'B =' Lst2FormV(b)
|
||||
say 'C =' Lst2FormV(c)
|
||||
say 'D =' Lst2FormV(d)
|
||||
say
|
||||
say 'BASICS'
|
||||
say 'A . B =' Vdot(a,b)/1
|
||||
say 'A x B =' Vlst2Form(Vcross(a,b))
|
||||
say 'A . B =' DotV(a,b)/1 '= dot product'
|
||||
say 'A x B =' Lst2FormV(CrossV(a,b)) '= cross product'
|
||||
say
|
||||
say 'BONUS'
|
||||
say 'A . (BxC) =' VscalTrip(a,b,c)/1
|
||||
say 'A x (BxC) =' Vlst2Form(VvectTrip(a,b,c))
|
||||
say '(AxB) . (CxD) =' VscalQuad(a,b,c,d)/1
|
||||
say '(AxB) x (CxD) =' Vlst2Form(VvectQuad(a,b,c,d))
|
||||
say 'A . (BxC) =' ScalTripV(a,b,c)/1 '= scalar triple product'
|
||||
say 'A x (BxC) =' Lst2FormV(VectTripV(a,b,c)) '= vector triple product'
|
||||
say '(AxB) . (CxD) =' ScalQuadV(a,b,c,d)/1 '= scalar quadruple product'
|
||||
say '(AxB) x (CxD) =' Lst2FormV(VectQuadV(a,b,c,d)) '= vector quadruple product'
|
||||
exit
|
||||
|
||||
include Vector
|
||||
include Functions
|
||||
include Constants
|
||||
include Abend
|
||||
include Math
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue