magic.lambda.math
17.2.0
dotnet add package magic.lambda.math --version 17.2.0
NuGet\Install-Package magic.lambda.math -Version 17.2.0
<PackageReference Include="magic.lambda.math" Version="17.2.0" />
paket add magic.lambda.math --version 17.2.0
#r "nuget: magic.lambda.math, 17.2.0"
// Install magic.lambda.math as a Cake Addin #addin nuget:?package=magic.lambda.math&version=17.2.0 // Install magic.lambda.math as a Cake Tool #tool nuget:?package=magic.lambda.math&version=17.2.0
magic.lambda.math - Performing math from Hyperlambda
This project provides math functions to Magic. More specifically, it provides the following slots.
- [math.multiply] - Multiplication
- [math.divide] - Division
- [math.add] - Addition
- [math.subtract] - Subtraction
- [math.modulo] - Modulo
- [math.decrement] - Decrements a node's value, optionally by [step], defaulting to 1
- [math.increment] - Increments a node's value, optionally by [step], defaulting to 1
- [math.dot] - Returns the dot product of two lists, where each list must be a
double
value - [math.max] - Returns the max value
- [math.min] - Returns the min value
All of the above besides the two last slots can be given any number of arguments, including as its value, and will treat the first argument as the "base", and performing the rest of the arguments self assigning the base as it proceeds. For instance, the following code will first divide 100 by 4, then divide that result by 5 again, resulting in 5.
math.divide:int:100
:int:4
:int:5
The value of the above [math.divide] node after evaluating the above Hyperlambda will be 5. All of the above slots will also evaluate the children collection as a lambda, before starting the actual math function, allowing you to recursively raise signals to retrieve values that are supposed to be mathematically handled somehow. This allows you to recursively nest math operations, such as for instance.
.one:int:5
.two:int:2
math.multiply
.:int:3
math.add
get-value:x:@.one
get-value:x:@.two
The above of course will first add 5 and 2, then multiple the result of that with 3, resulting in 21.
Incrementing and decrementing values
The above [math.increment] and [math.decrement] slots, will instead of yielding a result, inline modify the value of the node(s) it is pointing to, assuming its value is an expression. In addition these two slots can take an optional "step" argument, allowing you to declare how much the incrementation/decrementation process should add/reduce the original node's value by. Below is an example that decrements the value found in its expression by 2.
.value:int:5
math.decrement:x:-
.:int:2
After executing the above, the result of [.value] will be 3. The default "step" value if ommitted will be 1. Below is an example.
.value:int:5
math.increment:x:-
Notice - You can use any slot invocation to retrieve the step value for the increment/decrement slots, including for instance an invocation to [get-value], or your custom slots. This is dues to that the first argument supplied to these slots will be assumed to be the "step" value you want.
How to use [math.multiply]
This slot multiplies two or more values with each other, and can be given as many arguments as you wish, such as the following illustrates.
.arg:int:5
math.multiply
get-value:x:@.arg
.:int:3
It accepts both slot invocations, retrieving some value by invoking a slot, in addition to static values such as illustrated above where we provide the number 3 as one of its values.
How to use [math.divide]
This slot divides two or more values with each other, and can be given as many arguments as you wish, such as the following illustrates.
.arg:int:5
math.divide
get-value:x:@.arg
.:int:2
It accepts both slot invocations, retrieving some value by invoking a slot, in addition to static values such as illustrated above where we provide the number 3 as one of its values.
How to use [math.add]
This slot adds two or more values with each other, and can be given as many arguments as you wish, such as the following illustrates.
.arg:int:5
math.add
get-value:x:@.arg
.:int:2
How to use [math.subtract]
This slot subtracts two or more values with each other, and can be given as many arguments as you wish, such as the following illustrates.
.arg:int:5
math.subtract
get-value:x:@.arg
.:int:2
It accepts both slot invocations, retrieving some value by invoking a slot, in addition to static values such as illustrated above where we provide the number 3 as one of its values.
How to use [math.modulo]
This slot calculates the modulo of two or more values with each other, and can be given as many arguments as you wish, such as the following illustrates.
.arg:int:5
math.modulo
get-value:x:@.arg
.:int:2
It accepts both slot invocations, retrieving some value by invoking a slot, in addition to static values such as illustrated above where we provide the number 3 as one of its values.
How to use [math.decrement]
This slot decrements the value of some expression in place, by mutating the value of the node its expression is leading to.
.arg:int:5
math.decrement:x:@.arg
It can optionally be given a [step] argument, such as illustrated below.
.arg:int:5
math.decrement:x:@.arg
.:int:2
How to use [math.increment]
This slot increments the value of some expression in place, by mutating the value of the node its expression is leading to.
.arg:int:5
math.increment:x:@.arg
It can optionally be given a [step] argument, such as illustrated below.
.arg:int:5
math.increment:x:@.arg
.:int:2
How to use [math.min]
This slot returns the min value of its input.
math.min
.:int:5
.:int:7
How to use [math.max]
This slot returns the max value of its input.
math.max
.:int:11
.:int:12
How to use [math.dot]
This slot returns the dot product of two lists.
.list1
.:double:0.5
.:double:0.7
.:double:0.1
.list2
.:double:0.56
.:double:0.89
.:double:0.33
math.dot
get-nodes:x:@.list1/*
get-nodes:x:@.list2/*
This slot is useful for calculating similarities between two different objects in Machine Learning, where each list is an "embedding" or a vector.
Magic's GitHub project page
Magic is 100% Open Source and you can find the primary project GitHub page here.
Project website for magic.lambda.math
The source code for this repository can be found at github.com/polterguy/magic.lambda.math, and you can provide feedback, provide bug reports, etc at the same place.
Copyright and maintenance
The projects is copyright Thomas Hansen 2023 - 2024, and professionally maintained by AINIRO.IO.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- magic.node.extensions (>= 17.2.0)
- magic.signals.contracts (>= 17.2.0)
- Microsoft.CSharp (>= 4.7.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on magic.lambda.math:
Package | Downloads |
---|---|
magic.library
Helper project for Magic to wire up everything easily by simply adding one package, and invoking two simple methods. When using Magic, this is (probably) the only package you should actually add, since this package pulls in everything else you'll need automatically, and wires up everything sanely by default. To use package go to https://polterguy.github.io |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
17.2.0 | 444 | 1/22/2024 |
17.1.7 | 191 | 1/12/2024 |
17.1.6 | 162 | 1/11/2024 |
17.1.5 | 188 | 1/5/2024 |
17.0.1 | 224 | 1/1/2024 |
17.0.0 | 355 | 12/14/2023 |
16.11.5 | 360 | 11/12/2023 |
16.9.0 | 342 | 10/9/2023 |
16.7.0 | 544 | 7/11/2023 |
16.4.1 | 432 | 7/2/2023 |
16.4.0 | 432 | 6/22/2023 |
16.3.1 | 364 | 6/7/2023 |
16.3.0 | 371 | 5/28/2023 |
16.1.9 | 669 | 4/30/2023 |
15.10.11 | 508 | 4/13/2023 |
15.9.1 | 616 | 3/27/2023 |
15.9.0 | 481 | 3/24/2023 |
15.8.2 | 522 | 3/20/2023 |
15.7.0 | 414 | 3/6/2023 |
15.5.0 | 1,591 | 1/28/2023 |
15.2.0 | 715 | 1/18/2023 |
15.1.0 | 1,186 | 12/28/2022 |
14.5.7 | 717 | 12/13/2022 |
14.5.5 | 831 | 12/6/2022 |
14.5.1 | 670 | 11/23/2022 |
14.5.0 | 625 | 11/18/2022 |
14.4.5 | 734 | 10/22/2022 |
14.4.1 | 798 | 10/22/2022 |
14.4.0 | 656 | 10/17/2022 |
14.3.1 | 1,285 | 9/12/2022 |
14.3.0 | 660 | 9/10/2022 |
14.1.3 | 965 | 8/7/2022 |
14.1.2 | 678 | 8/7/2022 |
14.1.1 | 695 | 8/7/2022 |
14.0.14 | 753 | 7/26/2022 |
14.0.12 | 677 | 7/24/2022 |
14.0.11 | 696 | 7/23/2022 |
14.0.10 | 672 | 7/23/2022 |
14.0.9 | 669 | 7/23/2022 |
14.0.8 | 729 | 7/17/2022 |
14.0.5 | 807 | 7/11/2022 |
14.0.4 | 786 | 7/6/2022 |
14.0.3 | 714 | 7/2/2022 |
14.0.2 | 713 | 7/2/2022 |
14.0.0 | 888 | 6/25/2022 |
13.4.0 | 2,095 | 5/31/2022 |
13.3.4 | 1,472 | 5/9/2022 |
13.3.0 | 975 | 5/1/2022 |
13.2.0 | 1,219 | 4/21/2022 |
13.1.0 | 1,039 | 4/7/2022 |
13.0.0 | 777 | 4/5/2022 |
11.0.5 | 1,437 | 3/2/2022 |
11.0.4 | 796 | 2/22/2022 |
11.0.3 | 794 | 2/9/2022 |
11.0.2 | 823 | 2/6/2022 |
11.0.1 | 787 | 2/5/2022 |
10.0.21 | 790 | 1/28/2022 |
10.0.20 | 774 | 1/27/2022 |
10.0.19 | 766 | 1/23/2022 |
10.0.18 | 735 | 1/17/2022 |
10.0.15 | 968 | 12/31/2021 |
10.0.14 | 583 | 12/28/2021 |
10.0.7 | 1,463 | 12/22/2021 |
10.0.5 | 779 | 12/18/2021 |
9.9.9 | 1,679 | 11/29/2021 |
9.9.3 | 914 | 11/9/2021 |
9.9.2 | 662 | 11/4/2021 |
9.9.0 | 774 | 10/30/2021 |
9.8.9 | 717 | 10/29/2021 |
9.8.7 | 683 | 10/27/2021 |
9.8.6 | 675 | 10/27/2021 |
9.8.5 | 726 | 10/26/2021 |
9.8.0 | 1,383 | 10/20/2021 |
9.7.9 | 652 | 10/19/2021 |
9.7.8 | 647 | 10/19/2021 |
9.7.5 | 1,260 | 10/14/2021 |
9.7.0 | 838 | 10/9/2021 |
9.6.6 | 1,237 | 8/14/2021 |
9.2.0 | 6,284 | 5/26/2021 |
9.1.4 | 1,294 | 4/21/2021 |
9.1.0 | 1,055 | 4/14/2021 |
9.0.0 | 884 | 4/5/2021 |
8.9.9 | 1,025 | 3/30/2021 |
8.9.3 | 1,566 | 3/19/2021 |
8.9.2 | 1,012 | 1/29/2021 |
8.9.1 | 1,018 | 1/24/2021 |
8.9.0 | 1,133 | 1/22/2021 |
8.6.9 | 3,031 | 11/8/2020 |
8.6.6 | 1,963 | 11/2/2020 |
8.6.0 | 4,021 | 10/28/2020 |
8.5.0 | 1,931 | 10/23/2020 |
8.4.0 | 5,566 | 10/13/2020 |
8.3.1 | 2,662 | 10/5/2020 |
8.3.0 | 1,233 | 10/3/2020 |
8.2.2 | 2,025 | 9/26/2020 |
8.2.1 | 1,349 | 9/25/2020 |
8.2.0 | 1,374 | 9/25/2020 |
8.1.19 | 3,231 | 9/21/2020 |
8.1.18 | 1,290 | 9/15/2020 |
8.1.17 | 3,414 | 9/13/2020 |
8.1.16 | 624 | 9/13/2020 |
8.1.15 | 1,923 | 9/12/2020 |
8.1.11 | 2,516 | 9/11/2020 |
8.1.10 | 1,362 | 9/6/2020 |
8.1.9 | 1,331 | 9/3/2020 |
8.1.8 | 1,352 | 9/2/2020 |
8.1.7 | 1,197 | 8/28/2020 |
8.1.4 | 1,212 | 8/25/2020 |
8.1.3 | 1,326 | 8/18/2020 |
8.1.2 | 1,251 | 8/16/2020 |
8.1.1 | 1,305 | 8/15/2020 |
8.1.0 | 607 | 8/15/2020 |
8.0.1 | 2,695 | 8/7/2020 |
8.0.0 | 1,218 | 8/7/2020 |
7.0.1 | 1,366 | 6/28/2020 |
7.0.0 | 1,263 | 6/28/2020 |
5.0.0 | 7,436 | 2/25/2020 |
4.0.4 | 7,874 | 1/27/2020 |
4.0.3 | 1,263 | 1/27/2020 |
4.0.2 | 1,438 | 1/16/2020 |
4.0.1 | 1,412 | 1/11/2020 |
4.0.0 | 1,359 | 1/5/2020 |
3.1.0 | 6,298 | 11/10/2019 |
3.0.0 | 3,888 | 10/23/2019 |
2.0.1 | 8,271 | 10/15/2019 |
2.0.0 | 1,604 | 10/13/2019 |
1.1.8 | 1,387 | 10/11/2019 |
1.1.7 | 1,313 | 10/10/2019 |
1.1.6 | 604 | 10/9/2019 |
1.1.5 | 599 | 10/6/2019 |
1.1.4 | 601 | 10/6/2019 |
1.1.3 | 596 | 10/5/2019 |
1.1.2 | 621 | 10/5/2019 |
1.0.0 | 659 | 9/26/2019 |