Skip to content

Functions

Liam Riddell edited this page Aug 23, 2023 · 2 revisions

The Functions Arithmetic Provider builds upon the foundation of the Basic Arithmetic Provider, enhancing the capabilities of Obsidian Solve.

This advanced set of mathematical functions allows you to perform more complex calculations and manipulations, all seamlessly integrated into your note-taking experience.

Each function in this provider extends the range of mathematical operations you can perform within Obsidian Solve. From trigonometric functions to logarithmic operations, these functions offer a versatile toolkit for your mathematical needs.

Additionally, here's a quick example showcasing the integration of functions into the Basic Provider:

// Example
100 + 20 - max(10, 20, 30)

In this example, the expression 100 + 20 - max(10, 20, 30) evaluates to 90. This demonstrates how you can seamlessly integrate advanced mathematical functions into your calculations within Obsidian Solve.

Supported Functions

Explore the list below to quickly navigate to the specific functions you're interested in:

degToRad Function

The degToRad function converts degrees to radians.

// Example
degToRad(45)

In this example, degToRad(45) converts 45 degrees to radians, resulting in approximately 0.7854 radians.


radToDeg Function

The radToDeg function converts radians to degrees.

// Example
radToDeg(1.5708)

In this example, radToDeg(1.5708) converts 1.5708 radians to degrees, resulting in approximately 90 degrees.


sinh Function

The sinh function calculates the hyperbolic sine of a number.

// Example
sinh(2)

In this example, sinh(2) computes the hyperbolic sine of 2, resulting in approximately 3.62686.


sin Function

The sin function computes the sine of a number.

// Example
sin(degToRad(30))

In this example, sin(degToRad(30)) calculates the sine of 30 degrees, which is 0.5.


abs Function

The abs function returns the absolute value of a number.

// Example
abs(-5)

In this example, abs(-5) yields 5, the absolute value of -5.


acosh Function

The acosh function calculates the inverse hyperbolic cosine of a number.

// Example
acosh(1.5)

In this example, acosh(1.5) computes the inverse hyperbolic cosine of 1.5, resulting in approximately 0.9624.


acos Function

The acos function calculates the arccosine (inverse cosine) of a number.

// Example
acos(0.5)

In this example, acos(0.5) computes the arccosine of 0.5, which is approximately 1.0472 radians or 60 degrees.


asinh Function

The asinh function calculates the inverse hyperbolic sine of a number.

// Example
asinh(2)

In this example, asinh(2) computes the inverse hyperbolic sine of 2, resulting in approximately 1.4436.


asin Function

The asin function calculates the arcsine (inverse sine) of a number.

// Example
asin(0.5)

In this example, asin(0.5) computes the arcsine of 0.5, which is approximately 0.5236 radians or 30 degrees.


atan2 Function

The atan2 function calculates the arctangent of the quotient of its arguments.

// Example
atan2(1, 1)

In this example, atan2(1, 1) calculates the arctangent of the quotient 1/1, resulting in approximately 0.7854 radians or 45 degrees.


atanh Function

The atanh function calculates the inverse hyperbolic tangent of a number.

// Example
atanh(0.5)

In this example, atanh(0.5) computes the inverse hyperbolic tangent of 0.5, resulting in approximately 0.5493.


atan Function

The atan function calculates the arctangent (inverse tangent) of a number.

// Example
atan(1)

In this example, atan(1) computes the arctangent of 1, resulting in approximately 0.7854 radians or 45 degrees.


cbrt Function

The cbrt function calculates the cube root of a number.

// Example
cbrt(27)

In this example, cbrt(27) calculates the cube root of 27, resulting in 3.


ceil Function

The ceil function rounds a number up to the nearest integer.

// Example
ceil(4.2)

In this example, ceil(4.2) rounds up to 5.


clz32 Function

The clz32 function counts the number of leading zeros in the 32-bit binary representation of a number.

// Example
clz32(1)

In this example, clz32(1) counts the leading zeros in the binary representation of 1, which is 31.


cosh Function

The cosh function calculates the hyperbolic cosine of a number.

// Example
cosh(2)

In this example, cosh(2) computes the hyperbolic cosine of 2, resulting in approximately 3.7622.


cos Function

The cos function calculates the cosine of a number.

// Example
cos(degToRad

(60))

In this example, cos(degToRad(60)) calculates the cosine of 60 degrees, which is 0.5.


expm1 Function

The expm1 function calculates the exponential minus 1 of a number.

// Example
expm1(1)

In this example, expm1(1) calculates e^1 - 1, resulting in approximately 1.7182.


exp Function

The exp function calculates the exponential of a number.

// Example
exp(2)

In this example, exp(2) computes e^2, resulting in approximately 7.3891.


floor Function

The floor function rounds a number down to the nearest integer.

// Example
floor(4.8)

In this example, floor(4.8) rounds down to 4.


fround Function

The fround function rounds a number to the nearest single-precision float point value.

// Example
fround(1.234567)

In this example, fround(1.234567) rounds to the nearest single-precision float point value.


hypot Function

The hypot function calculates the square root of the sum of squares of its arguments.

// Example
hypot(3, 4)

In this example, hypot(3, 4) calculates the square root of 3^2 + 4^2, resulting in 5.


imul Function

The imul function performs 32-bit integer multiplication.

// Example
imul(5, 6)

In this example, imul(5, 6) performs 32-bit integer multiplication, resulting in 30.


log10 Function

The log10 function calculates the base 10 logarithm of a number.

// Example
log10(100)

In this example, log10(100) computes the base 10 logarithm of 100, resulting in 2.


log1p Function

The log1p function calculates the natural logarithm of 1 + x.

// Example
log1p(2)

In this example, log1p(2) calculates the natural logarithm of 1 + 2, resulting in approximately 1.0986.


log2 Function

The log2 function calculates the base 2 logarithm of a number.

// Example
log2(8)

In this example, log2(8) computes the base 2 logarithm of 8, resulting in 3.


log Function

The log function calculates the natural logarithm of a number.

// Example
log(Math.E)

In this example, log(Math.E) calculates the natural logarithm of e, resulting in 1.


max Function

The max function returns the maximum value among its arguments.

// Example
max(5, 10, 2)

In this example, max(5, 10, 2) returns 10, the maximum value among the arguments.


min Function

The min function returns the minimum value among its arguments.

// Example
min(5, 10, 2)

In this example, min(5, 10, 2) returns 2, the minimum value among the arguments.


pow Function

The pow function raises a number to a specified power.

// Example
pow(2, 3)

In this example, pow(2, 3) raises 2 to the power of 3, resulting in 8.


random Function

The random function generates a random floating-point number between 0 (inclusive) and 1 (exclusive).

// Example
random()

In this example, random() generates a random floating-point number.


round Function

The round function rounds a number to the nearest integer.

// Example
round(4.6)

In this example, round(4.6) rounds to 5.


sign Function

The sign function returns the sign of a number.

// Example
sign(-7)

In this example, sign(-7) returns -1, indicating a negative value.


sqrt Function

The sqrt function calculates the square root of a number.

// Example
sqrt(25)

In this example, sqrt(25) calculates the square root of 25, resulting in 5.


tanh Function

The tanh function calculates the hyperbolic tangent of a number.

// Example
tanh(1)

In this example, tanh(1) computes the hyperbolic tangent of 1, resulting in approximately 0.7616.


tan Function

The tan function calculates the tangent of a number.

// Example
tan(degToRad(45))

In this example, tan(degToRad(45)) calculates the tangent of 45 degrees, which is 1.


trunc Function

The trunc function removes the decimal part of a number, leaving the integer part.

// Example
trunc(4.9)

In this example, trunc(4.9) truncates to 4.