Angle difference between two bearings: Difference between revisions
Content added Content deleted
(→{{header|Excel}}: Added a draft for Excel LAMBDA) |
|||
Line 889: | Line 889: | ||
passed. |
passed. |
||
</lang> |
</lang> |
||
=={{header|Excel}}== |
|||
===LAMBDA=== |
|||
Binding the names ANGLEBETWEENBEARINGS and BEARINGDELTA to the following lambda expressions in the Name Manager of the Excel WorkBook: |
|||
(See [https://www.microsoft.com/en-us/research/blog/lambda-the-ultimatae-excel-worksheet-function/ LAMBDA: The ultimate Excel worksheet function]) |
|||
{{Works with|Office 365 betas 2021}} |
|||
<lang lisp>ANGLEBETWEENBEARINGS |
|||
=LAMBDA(a, |
|||
LAMBDA(b, |
|||
DEGREES( |
|||
BEARINGDELTA( |
|||
RADIANS(a) |
|||
)( |
|||
RADIANS(b) |
|||
) |
|||
) |
|||
) |
|||
) |
|||
BEARINGDELTA |
|||
=LAMBDA(a, |
|||
LAMBDA(b, |
|||
LET( |
|||
ax, SIN(a), |
|||
ay, COS(a), |
|||
bx, SIN(b), |
|||
by, COS(b), |
|||
rem, "Sign * dot product", |
|||
IF(0 < ((ay * bx) - (by * ax)), |
|||
1, |
|||
-1 |
|||
) * ACOS((ax * bx) + (ay * by)) |
|||
) |
|||
) |
|||
)</lang> |
|||
Using the Excel custom number format ###° |
|||
{{Out}} |
|||
{| class="wikitable" |
|||
|- |
|||
|||style="text-align:right; font-family:serif; font-style:italic; font-size:120%;"|fx |
|||
! colspan="5" style="text-align:left; vertical-align: bottom; font-family:Arial, Helvetica, sans-serif !important;"|=ANGLEBETWEENBEARINGS(D2)(E2) |
|||
|- style="text-align:center; font-family:Arial, Helvetica, sans-serif !important; background-color:#000000; color:#ffffff;" |
|||
| |
|||
| A |
|||
| B |
|||
| C |
|||
| D |
|||
| E |
|||
|- |
|||
| style="text-align:center; font-family:Arial, Helvetica, sans-serif !important; background-color:#000000; color:#ffffff" | 1 |
|||
| |
|||
| style="font-weight:bold" | Difference |
|||
| |
|||
| style="font-weight:bold" | b1 |
|||
| style="font-weight:bold" | b2 |
|||
|- |
|||
| style="text-align:center; font-family:Arial, Helvetica, sans-serif !important; background-color:#000000; color:#ffffff" | 2 |
|||
| |
|||
| style="text-align:right; background-color:#cbcefb" | 25° |
|||
| |
|||
| style="text-align:right" | 20° |
|||
| style="text-align:right" | 45° |
|||
|- |
|||
| style="text-align:center; font-family:Arial, Helvetica, sans-serif !important; background-color:#000000; color:#ffffff" | 3 |
|||
| |
|||
| style="text-align:right" | 90° |
|||
| |
|||
| style="text-align:right" | -45° |
|||
| style="text-align:right" | 45° |
|||
|- |
|||
| style="text-align:center; font-family:Arial, Helvetica, sans-serif !important; background-color:#000000; color:#ffffff" | 4 |
|||
| |
|||
| style="text-align:right" | 175° |
|||
| |
|||
| style="text-align:right" | -85° |
|||
| style="text-align:right" | 90° |
|||
|- |
|||
| style="text-align:center; font-family:Arial, Helvetica, sans-serif !important; background-color:#000000; color:#ffffff" | 5 |
|||
| |
|||
| style="text-align:right" | -175° |
|||
| |
|||
| style="text-align:right" | -95° |
|||
| style="text-align:right" | 90° |
|||
|- |
|||
| style="text-align:center; font-family:Arial, Helvetica, sans-serif !important; background-color:#000000; color:#ffffff" | 6 |
|||
| |
|||
| style="text-align:right" | 170° |
|||
| |
|||
| style="text-align:right" | -45° |
|||
| style="text-align:right" | 125° |
|||
|- |
|||
| style="text-align:center; font-family:Arial, Helvetica, sans-serif !important; background-color:#000000; color:#ffffff" | 7 |
|||
| |
|||
| style="text-align:right" | -170° |
|||
| |
|||
| style="text-align:right" | -45° |
|||
| style="text-align:right" | 145° |
|||
|} |
|||
=={{header|F#|F sharp}}== |
=={{header|F#|F sharp}}== |