# YC Math

**URL:** https://community.glideapps.com/t/yc-math/29952
**Category:** Ask for Help
**Tags:** custom-code
**Created:** [August 3, 2021, 9:31pm UTC](https://community.glideapps.com/t/yc-math/29952 "2021-08-03T21:31:51Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![Manu.n](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/manu.n/32/11679_2.png) [@Manu.n](https://community.glideapps.com/u/Manu.n)
#### Post date: [August 3, 2021, 9:31pm UTC](https://community.glideapps.com/t/yc-math/29952/1 "2021-08-03T21:31:51Z")

</div>

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, …)

```auto

/ ***************************************************************************
* 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
*
***************************************************************************** /

```

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/9/0/9091395dcd3a476febe81ab22add4bfeabd83878.png)

link for YC:  
[https://Math.manun2.repl.co](https://Math.manun2.repl.co)

Source:

---

<div class="post-metadata">

### Author: ![Mark](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mark/32/125_2.png) [@Mark](https://community.glideapps.com/u/Mark)
#### Post date: [August 3, 2021, 10:33pm UTC](https://community.glideapps.com/t/yc-math/29952/2 "2021-08-03T22:33:59Z")

</div>

What are you using this for, specifically?

---

<div class="post-metadata">

### Author: ![Manu.n](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/manu.n/32/11679_2.png) [@Manu.n](https://community.glideapps.com/u/Manu.n)
#### Post date: [August 3, 2021, 10:43pm UTC](https://community.glideapps.com/t/yc-math/29952/3 "2021-08-03T22:43:31Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Manu.n](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/manu.n/32/11679_2.png) [@Manu.n](https://community.glideapps.com/u/Manu.n)
#### Post date: [August 3, 2021, 10:57pm UTC](https://community.glideapps.com/t/yc-math/29952/4 "2021-08-03T22:57:14Z")

</div>

Here is a comment from a specialist on the subject.

> [@On another topic](https://community.glideapps.com/t/28870/107):
>
> I wish the math column was like that and would allow us to pass in a dynamic formula from another column, just like how the template column works. That would make my calculator 10 times easier to calculate complex formulas and I could allow for proper mathematical order of operation by allowing the user to use parenthesis. Maybe that’s something I’ll have to mention for the next live coding session. All we need is the option to select the math formula from another column. Can’t imagine that’s to complicated since the template column already allows for it.

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

---

<div class="post-metadata">

### Author: ![Manu.n](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/manu.n/32/11679_2.png) [@Manu.n](https://community.glideapps.com/u/Manu.n)
#### Post date: [August 3, 2021, 11:12pm UTC](https://community.glideapps.com/t/yc-math/29952/5 "2021-08-03T23:12:32Z")

</div>

Argg  
It also lacks a Toogle function (boolean)

bool =! bool;

---

<div class="post-metadata">

### Author: ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)
#### Post date: [August 4, 2021, 10:29am UTC](https://community.glideapps.com/t/yc-math/29952/6 "2021-08-04T10:29:28Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Mark](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mark/32/125_2.png) [@Mark](https://community.glideapps.com/u/Mark)
#### Post date: [August 4, 2021, 10:41am UTC](https://community.glideapps.com/t/yc-math/29952/7 "2021-08-04T10:41:40Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Eric\_Penn](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/eric_penn/32/73888_2.png) [@Eric\_Penn](https://community.glideapps.com/u/Eric_Penn)
#### Post date: [August 4, 2021, 11:54am UTC](https://community.glideapps.com/t/yc-math/29952/8 "2021-08-04T11:54:51Z")

</div>

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)

---

<div class="post-metadata">

### Author: ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)
#### Post date: [August 4, 2021, 12:17pm UTC](https://community.glideapps.com/t/yc-math/29952/9 "2021-08-04T12:17:01Z")

</div>

> [@Eric\_Penn](#):
>
> When my users request a csv I send the missing bits of a formula to generate a report.
> 
> I.e. dates, person

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

---

<div class="post-metadata">

### Author: ![Eric\_Penn](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/eric_penn/32/73888_2.png) [@Eric\_Penn](https://community.glideapps.com/u/Eric_Penn)
#### Post date: [August 4, 2021, 12:35pm UTC](https://community.glideapps.com/t/yc-math/29952/10 "2021-08-04T12:35:10Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)
#### Post date: [August 4, 2021, 12:41pm UTC](https://community.glideapps.com/t/yc-math/29952/11 "2021-08-04T12:41:08Z")

</div>

> [@Eric\_Penn](#):
>
> 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.

Just out of curiosity, how many is too many?

---

<div class="post-metadata">

### Author: ![Eric\_Penn](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/eric_penn/32/73888_2.png) [@Eric\_Penn](https://community.glideapps.com/u/Eric_Penn)
#### Post date: [August 4, 2021, 12:42pm UTC](https://community.glideapps.com/t/yc-math/29952/12 "2021-08-04T12:42:11Z")

</div>

Growing by around ~5k rows /month

---

<div class="post-metadata">

### Author: ![david](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/david/32/62831_2.png) [@david](https://community.glideapps.com/u/david)
#### Post date: [August 4, 2021, 3:10pm UTC](https://community.glideapps.com/t/yc-math/29952/13 "2021-08-04T15:10:04Z")

</div>

FYI, [Excel Formula Column - #35 by Mark](https://community.glideapps.com/t/excel-formula-column/29865/36) should also provide most of these features.

---

<div class="post-metadata">

### Author: ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)
#### Post date: [August 5, 2021, 4:08am UTC](https://community.glideapps.com/t/yc-math/29952/14 "2021-08-05T04:08:38Z")

</div>

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.
