Vector products: Difference between revisions

Content added Content deleted
(Add Swift)
Line 2,074: Line 2,074:


=={{header|Julia}}==
=={{header|Julia}}==
Julia provides dot and cross products with LinearAlgebra. It's easy enough to use these to construct the triple products.
{{works with|Julia|0.6}}
<lang julia>using LinearAlgebra
Julia provides dot and cross products as built-ins. It's easy enough to use these to construct the triple products.

<lang julia>function scalarproduct(a::AbstractVector{T}, b::AbstractVector{T}, c::AbstractVector{T}) where {T<:Number}
function scalarproduct(a::AbstractVector{T}, b::AbstractVector{T}, c::AbstractVector{T}) where {T<:Number}
return dot(a, cross(b, c))
return dot(a, cross(b, c))
end
end