VOOZH about

URL: https://www.nuget.org/packages/magic.lambda.math/

⇱ NuGet Gallery | magic.lambda.math 17.2.0




👁 Image
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
 
 
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="magic.lambda.math" Version="17.2.0" />
 
 
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="magic.lambda.math" Version="17.2.0" />
 
Directory.Packages.props
<PackageReference Include="magic.lambda.math" />
 
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add magic.lambda.math --version 17.2.0
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: magic.lambda.math, 17.2.0"
 
 
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package magic.lambda.math@17.2.0
 
 
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=magic.lambda.math&version=17.2.0
 
Install as a Cake Addin
#tool nuget:?package=magic.lambda.math&version=17.2.0
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

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 net5.0 was computed.  net5.0-windows net5.0-windows was computed.  net6.0 net6.0 was computed.  net6.0-android net6.0-android was computed.  net6.0-ios net6.0-ios was computed.  net6.0-maccatalyst net6.0-maccatalyst was computed.  net6.0-macos net6.0-macos was computed.  net6.0-tvos net6.0-tvos was computed.  net6.0-windows net6.0-windows was computed.  net7.0 net7.0 was computed.  net7.0-android net7.0-android was computed.  net7.0-ios net7.0-ios was computed.  net7.0-maccatalyst net7.0-maccatalyst was computed.  net7.0-macos net7.0-macos was computed.  net7.0-tvos net7.0-tvos was computed.  net7.0-windows net7.0-windows was computed.  net8.0 net8.0 was computed.  net8.0-android net8.0-android was computed.  net8.0-browser net8.0-browser was computed.  net8.0-ios net8.0-ios was computed.  net8.0-maccatalyst net8.0-maccatalyst was computed.  net8.0-macos net8.0-macos was computed.  net8.0-tvos net8.0-tvos was computed.  net8.0-windows net8.0-windows was computed.  net9.0 net9.0 was computed.  net9.0-android net9.0-android was computed.  net9.0-browser net9.0-browser was computed.  net9.0-ios net9.0-ios was computed.  net9.0-maccatalyst net9.0-maccatalyst was computed.  net9.0-macos net9.0-macos was computed.  net9.0-tvos net9.0-tvos was computed.  net9.0-windows net9.0-windows was computed.  net10.0 net10.0 was computed.  net10.0-android net10.0-android was computed.  net10.0-browser net10.0-browser was computed.  net10.0-ios net10.0-ios was computed.  net10.0-maccatalyst net10.0-maccatalyst was computed.  net10.0-macos net10.0-macos was computed.  net10.0-tvos net10.0-tvos was computed.  net10.0-windows net10.0-windows was computed. 
.NET Core netcoreapp2.0 netcoreapp2.0 was computed.  netcoreapp2.1 netcoreapp2.1 was computed.  netcoreapp2.2 netcoreapp2.2 was computed.  netcoreapp3.0 netcoreapp3.0 was computed.  netcoreapp3.1 netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 netstandard2.0 is compatible.  netstandard2.1 netstandard2.1 was computed. 
.NET Framework net461 net461 was computed.  net462 net462 was computed.  net463 net463 was computed.  net47 net47 was computed.  net471 net471 was computed.  net472 net472 was computed.  net48 net48 was computed.  net481 net481 was computed. 
MonoAndroid monoandroid monoandroid was computed. 
MonoMac monomac monomac was computed. 
MonoTouch monotouch monotouch was computed. 
Tizen tizen40 tizen40 was computed.  tizen60 tizen60 was computed. 
Xamarin.iOS xamarinios xamarinios was computed. 
Xamarin.Mac xamarinmac xamarinmac was computed. 
Xamarin.TVOS xamarintvos xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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 1,873 1/22/2024
17.1.7 401 1/12/2024
17.1.6 379 1/11/2024
17.1.5 389 1/5/2024
17.0.1 426 1/1/2024
17.0.0 575 12/14/2023
16.11.5 503 11/12/2023
16.9.0 458 10/9/2023
16.7.0 766 7/11/2023
16.4.1 650 7/2/2023
16.4.0 637 6/22/2023
16.3.1 537 6/7/2023
16.3.0 547 5/28/2023
16.1.9 870 4/30/2023
15.10.11 697 4/13/2023
15.9.1 832 3/27/2023
15.9.0 658 3/24/2023
15.8.2 708 3/20/2023
15.7.0 607 3/6/2023
15.5.0 1,858 1/28/2023
Loading failed