Number.Sinh

D

T

The M Code Behind the Power Query M function Number.Sinh

What is Hyperbolic Sine?

Before we dive into the M code, let’s briefly discuss what hyperbolic sine is. The hyperbolic sine of a number is a mathematical function that describes the shape of a hanging cable or chain, among other things. It’s defined as:

sinh(x) = (e^x – e^-x) / 2

Where e is the mathematical constant approximately equal to 2.71828, and x is the input value.

The hyperbolic sine function has a range of values from negative infinity to positive infinity and is an odd function, meaning that:

sinh(-x) = -sinh(x)

The M Code for Number.Sinh

The M code behind the Number.Sinh function is relatively simple. Here’s what it looks like:

(x) => Number.Sinh(x)

In this code, we define a parameter x, which represents the input value. We then call the built-in Number.Sinh function, passing in x as the argument.

How the Code Works

When you use the Number.Sinh function in Power Query, you provide a single argument, which is the number you want to find the hyperbolic sine of. Power Query then uses the M code we just discussed to return the result.

For example, if you had a table of values that you wanted to find the hyperbolic sine of, you could use the following M code:

let

Source = Table.FromRows({{1}, {2}, {3}}, {“Number”}),

#”Added Custom” = Table.AddColumn(Source, “Hyperbolic Sine”, each Number.Sinh([Number]))

in

#”Added Custom”

In this code, we first create a table with three rows and one column called “Number”. We then add a custom column called “Hyperbolic Sine” using the Table.AddColumn function. In the each clause of this function, we call the Number.Sinh function, passing in the value of the “Number” column for each row.

The result of this code would be a new table with two columns, “Number” and “Hyperbolic Sine”, where the “Hyperbolic Sine” column contains the hyperbolic sine of each value in the “Number” column.

The Number.Sinh function is a useful tool in Power Query for finding the hyperbolic sine of a given number. Understanding the M code behind this function can help you better understand how Power Query works and how you can create your own custom functions using the M language.

Power Query and M Training Courses by G Com Solutions (0800 998 9248)

Upcoming Courses

Contact Us

    Subject

    Your Name (required)

    Company/Organisation

    Email (required)

    Telephone

    Training Course(s)

    Your Message

    Upload Example Document(s) (Zip multiple files)