Derived Variables are variables that are created from other variables using an expression. For example, you might create a numeric derived variable to show the sum of the values stored in two or more other numeric variables that you have collected from a device. Incredible, huh?
Sometimes users are not sure about the math functions allowed from the Derived Variables in Ubidots. Don't worry more about it! This guide is here to show you all the math functions available with Ubidots Derived Variables:
- ceil(x): Returns the ceiling of x as a float, the smallest integer value greater than or equal to x.
- floor(x): Returns the floor of x as a float, the largest integer value less than or equal to x.
- tan(x): Returns the tangent of x radians.
- cos(x): Returns the cosine of x radians.
- sin(x): Returns the sine of x radians.
- log(x[, base]): Returns the natural logarithm of x (by default base = e).
- sqrt(x): Returns the square root of x.
- abs(x): Returns the absolute value of x.
- round(x [, ndigits]): Returns the floating point value number rounded to "n" digits after the decimal point.
- previous(x): returns the value previous to the last value.
- diff_acu(x): returns the difference between current value and the last value (x_new - x_prev). If the value is returned as greater than the previous value, it will become the new derived value. If the new value is less than previously derived value than then resulting new value will repeat of the former greatest derived value.
Also, the math operations allowed are:
- Addition: +
- Subtraction: -
- Division: /
- Multiplication: *
- Exponentiation: **
- Module: %
Now you're ready to start with the Derived Variables, if you get ant issue using the variables please report to the Ubidots Community for assistance from not only Ubidots but also your fellow users.