YC Math

Hello,
Since the creation of the YC, I have this little thing in stock and I know the Math column is limited.
The idea is to create a literal mathematical formula and convert it to a number
Angle calculations are in radians or degrees.
Personal correction: mod for modulo
Addition: sum (x, y, …)


/***************************************************************************
* Calculation of a literary mathematical formula.
*
* Arithmetic operator (+ - / *)
* -----------------------------
* a % b = integer remainder of a division
* a ** b = power
* a % b = modulo !!! but use the correction : mod(a, b)
*
* Binary operator
* ---------------
* a & b = AND
* a AND b = AND
* a | b = OR
* a OR b = OR
* ~ a = NOT
* NOT(a) = ~ a (not)
* a << b = Binary shift to the left
* a >> b = Binary shift to the right
* a >>> b = Binary shift to the right when padding with zeros
*
* Math operator
* -------------
* abs(x), acos(x), acosh(x), asin(x), asinh(x), atan(x), atanh(x), atan2(y, x),
* cbrt(x), ceil(x), clz32(x), cos(x),
* exp(x), expml(x),
* floor(x), fround(x),
* hypot(x, y, ...),
* imul(x,y)
* log(x), loglp(x), log10(x), log2(x),
* max(x, y, ...), min(x, y, ...),
* pow(x, y), pi
* random(), round(x),
* sign(x), sin(x), sinh(x), sqrt(x),
* tan(x), tanh(x), trunc(x)
*
* Specific characters
* -------------------
* √(a) = Square root
* a ^ b = power
*
* Add
* ---
* mod(x, y) = x modulo y (correction)
* sum(x, y, ...) = Sum
*
* Multiple variables
* ------------------
* !!!!!!!!!!! attention: the variables are not reset
* a = 1 + 1; b = 50 * 2; a + b
*
* Restriction
* -----------
* You must not use [] or {} as a parenthesis
*
*****************************************************************************/

link for YC:
https://Math.manun2.repl.co

Source:

5 Likes

What are you using this for, specifically?

Hello,
I found myself a little limited compared to the Math column.

For example the min and max only accept 2 parameters, or you have to do a Min (2, Min (3, Min (4)))
and I know from memory that I wanted to do a calculation once, but I gave up for lack of function.

So, when I made this code I completed the basic functions and I especially had a thought for @Jeff_Hager who spent a month creating a calculator application, so I said to myself that it could be useful to others.

4 Likes

Here is a comment from a specialist on the subject.

I think there is not much missing from the Math column.

1 Like

Argg
It also lacks a Toogle function (boolean)

bool =! bool;

3 Likes

Yes, allowing a math column to dynamically take in different formulas would be awesome! In addition to simplifying how I created my calculator app, this could allow an end user to type in a math formula to get a result, or you could have an IF column that returns several different formulas, based on different conditions, that you could plug into a single math column instead of several different math columns for each condition.

2 Likes

Do you have a specific use case for a user having to enter a formula, outside of an actual calculator app?

2 Likes

When my users request a csv I send the missing bits of a formula to generate a report.

I.e. dates, person

In this case the user is not entering the formula (I enter it for them)

1 Like

Can you expand on that a bit? ie. what’s the relation between math formulas and CSV?

I suppose the only math function I am using is =sumif

The reports I need to generate come from a sheet with far too many rows so I use a filter formula with conditions filled by user input.

My current setup uses 4 different GSheet tabs and a few named ranges…with YC it could probably be one column I was thinking.

Just out of curiosity, how many is too many?

Growing by around ~5k rows /month

FYI, Excel Formula Column - #35 by Mark should also provide most of these features.

3 Likes

No, at the moment I don’t have a specific use case where a user would enter a formula themselves. I think if I ever had a use case, it would involve a dynamic math formula where portions of the formula would be added, removed, or changed depending on certain conditions. I don’t have anything specific at this time…just the idea for a math column to work more like a template column, in that it can source the template from another column.

1 Like