Geometric algebra: Difference between revisions
→{{header|raku}}: minor simplification
(→{{header|Raku}}: modernize) |
(→{{header|raku}}: minor simplification) |
||
Line 2,095:
}
sub infix:<·>(Vector $x, Vector $y) returns Real is export { (($x*$y + $y*$x)/2){0} }▼
multi infix:<+>(::?CLASS $A, ::?CLASS $B) returns ::?CLASS is export {
return ::?CLASS.new-from-pairs: |$A.pairs, |$B.pairs;
Line 2,158 ⟶ 2,160:
constant N = 10;
plan 5;
▲sub infix:<·>(Vector $x, Vector $y) { ($x*$y + $y*$x)/2 }
subtest "Orthonormality", {
Line 2,175:
my @coeff = (.5 - rand) xx 5;
my $v = [+] @coeff Z* @e[^5];
ok ($v**2).narrow ~~ Real, 'contraction';</syntaxhighlight>
=={{header|Visual Basic .NET}}==
|