Elliptic curve arithmetic: Difference between revisions
Content added Content deleted
m (→{{header|REXX}}: changed whitespace.) |
m (→{{header|Perl 6}}: given how clueless I am on the topic, please retract if I misunderstood anything; apparently the results from previous data set are not correct? for example, x=2, y=3.74165738677394 does not lie on y² = x³ + 7 ?) |
||
Line 965: | Line 965: | ||
} |
} |
||
say my $p = Point.new: x => $_, y => sqrt(abs( |
say my $p = Point.new: x => $_, y => sqrt(abs($_**3 + $A*$_ + $B)) given 1; |
||
say my $q = Point.new: x => $_, y => sqrt(abs( |
say my $q = Point.new: x => $_, y => sqrt(abs($_**3 + $A*$_ + $B)) given 2; |
||
say my $s = $p + $q; |
say my $s = $p + $q; |
||
say "checking alignment: ", abs ($p.x - $q.x)*(-$s.y - $q.y) - ($p.y - $q.y)*($s.x - $q.x);</lang> |
say "checking alignment: ", abs ($p.x - $q.x)*(-$s.y - $q.y) - ($p.y - $q.y)*($s.x - $q.x);</lang> |
||
{{out}} |
{{out}} |
||
<pre>EC Point at x=1, y=2. |
<pre>EC Point at x=1, y=2.8284271247461903 |
||
EC Point at x=2, y=3. |
EC Point at x=2, y=3.872983346207417 |
||
EC Point at x=-1. |
EC Point at x=-1.9089023002066448, y=0.21008487055753378 |
||
checking alignment: |
checking alignment: 0</pre> |
||
=={{header|Phix}}== |
=={{header|Phix}}== |